toaruos/util/mkdisk.sh

35 lines
691 B
Bash
Raw Normal View History

2018-07-11 03:43:31 +03:00
#!/bin/bash
OUT=$1
IN=$2
OUTDIR=`dirname $1`
rm -f $OUT
2018-07-14 12:34:10 +03:00
mkdir -p cdrom
2018-07-19 08:31:45 +03:00
fallocate -l 64M $OUT || dd if=/dev/zero bs=1M count=64 of=$OUT
mkfs.fat -s 1 -S 2048 $OUT
2018-07-11 03:43:31 +03:00
#echo "Turning $IN into $OUT"
for i in $(find $IN)
do
if [[ $i == $IN ]]; then
continue
fi
OUT_FILE=`echo $i | sed s"/^$IN/$OUTDIR/"`
IN_FILE=`echo $i | sed s"/^$IN//"`
#echo $IN_FILE $OUT_FILE
if [ -d "$i" ]; then
mmd -i $OUT $IN_FILE
mkdir -p $OUT_FILE
else
mcopy -i $OUT $i '::'$IN_FILE
touch $OUT_FILE
fi
done
rm -f cdrom/efi/boot/bootia32.efi # Otherwise virtualbox may erroneously try to load from this
rm -f cdrom/efi/boot/bootx64.efi # Same
2018-07-11 04:55:49 +03:00