2020-05-20 14:36:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-01-29 09:54:04 +00:00
|
|
|
if [ "$1" = "CI" ]; then
|
2021-01-29 12:58:02 +00:00
|
|
|
OPT='-dR'
|
2021-01-29 09:54:04 +00:00
|
|
|
else
|
|
|
|
OPT='-a'
|
|
|
|
fi
|
|
|
|
|
2020-05-24 12:43:31 +00:00
|
|
|
dos2unix -q ./tool/ventoy_lib.sh
|
2020-05-30 12:13:04 +00:00
|
|
|
dos2unix -q ./tool/VentoyWorker.sh
|
2020-05-24 12:43:31 +00:00
|
|
|
|
2020-05-20 14:36:27 +00:00
|
|
|
. ./tool/ventoy_lib.sh
|
|
|
|
|
|
|
|
GRUB_DIR=../GRUB2/INSTALL
|
|
|
|
LANG_DIR=../LANGUAGES
|
|
|
|
|
|
|
|
if ! [ -d $GRUB_DIR ]; then
|
|
|
|
echo "$GRUB_DIR not exist"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
cd ../IMG
|
|
|
|
sh mkcpio.sh
|
2020-08-29 05:12:36 +00:00
|
|
|
sh mkloopex.sh
|
2020-05-20 14:36:27 +00:00
|
|
|
cd -
|
|
|
|
|
|
|
|
|
|
|
|
LOOP=$(losetup -f)
|
|
|
|
|
|
|
|
rm -f img.bin
|
|
|
|
dd if=/dev/zero of=img.bin bs=1M count=256 status=none
|
|
|
|
|
|
|
|
losetup -P $LOOP img.bin
|
|
|
|
|
|
|
|
while ! grep -q 524288 /sys/block/${LOOP#/dev/}/size 2>/dev/null; do
|
|
|
|
echo "wait $LOOP ..."
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
2020-07-04 14:29:54 +00:00
|
|
|
format_ventoy_disk_mbr 0 $LOOP fdisk
|
2020-05-20 14:36:27 +00:00
|
|
|
|
2021-02-02 10:54:56 +00:00
|
|
|
$GRUB_DIR/sbin/grub-bios-setup --skip-fs-probe --directory="./grub/i386-pc" $LOOP
|
2020-05-20 14:36:27 +00:00
|
|
|
|
|
|
|
curver=$(get_ventoy_version_from_cfg ./grub/grub.cfg)
|
|
|
|
|
|
|
|
tmpmnt=./ventoy-${curver}-mnt
|
|
|
|
tmpdir=./ventoy-${curver}
|
|
|
|
|
|
|
|
rm -rf $tmpmnt
|
|
|
|
mkdir -p $tmpmnt
|
|
|
|
|
|
|
|
mount ${LOOP}p2 $tmpmnt
|
|
|
|
|
|
|
|
mkdir -p $tmpmnt/grub
|
|
|
|
|
|
|
|
# First copy grub.cfg file, to make it locate at front of the part2
|
2021-01-29 09:54:04 +00:00
|
|
|
cp $OPT ./grub/grub.cfg $tmpmnt/grub/
|
2020-05-20 14:36:27 +00:00
|
|
|
|
|
|
|
ls -1 ./grub/ | grep -v 'grub\.cfg' | while read line; do
|
2021-01-29 09:54:04 +00:00
|
|
|
cp $OPT ./grub/$line $tmpmnt/grub/
|
2020-05-20 14:36:27 +00:00
|
|
|
done
|
|
|
|
|
2021-01-29 09:54:04 +00:00
|
|
|
cp $OPT ./ventoy $tmpmnt/
|
|
|
|
cp $OPT ./EFI $tmpmnt/
|
|
|
|
cp $OPT ./tool/ENROLL_THIS_KEY_IN_MOKMANAGER.cer $tmpmnt/
|
2020-05-20 14:36:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
mkdir -p $tmpmnt/tool
|
2021-01-29 09:54:04 +00:00
|
|
|
cp $OPT ./tool/i386/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_i386
|
|
|
|
cp $OPT ./tool/x86_64/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_x86_64
|
|
|
|
cp $OPT ./tool/aarch64/mount.exfat-fuse $tmpmnt/tool/mount.exfat-fuse_aarch64
|
2020-05-20 14:36:27 +00:00
|
|
|
|
2020-07-22 15:30:01 +00:00
|
|
|
rm -f $tmpmnt/grub/i386-pc/*.img
|
2020-05-20 14:36:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
umount $tmpmnt && rm -rf $tmpmnt
|
|
|
|
|
|
|
|
|
|
|
|
rm -rf $tmpdir
|
|
|
|
mkdir -p $tmpdir/boot
|
|
|
|
mkdir -p $tmpdir/ventoy
|
|
|
|
echo $curver > $tmpdir/ventoy/version
|
|
|
|
dd if=$LOOP of=$tmpdir/boot/boot.img bs=1 count=512 status=none
|
|
|
|
dd if=$LOOP of=$tmpdir/boot/core.img bs=512 count=2047 skip=1 status=none
|
|
|
|
xz --check=crc32 $tmpdir/boot/core.img
|
|
|
|
|
2021-01-29 09:54:04 +00:00
|
|
|
cp $OPT ./tool $tmpdir/
|
2020-07-18 14:06:59 +00:00
|
|
|
rm -f $tmpdir/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
|
2021-01-29 09:54:04 +00:00
|
|
|
cp $OPT Ventoy2Disk.sh $tmpdir/
|
|
|
|
cp $OPT README $tmpdir/
|
|
|
|
cp $OPT plugin $tmpdir/
|
|
|
|
cp $OPT CreatePersistentImg.sh $tmpdir/
|
2020-05-24 12:43:31 +00:00
|
|
|
dos2unix -q $tmpdir/Ventoy2Disk.sh
|
2020-05-30 12:13:04 +00:00
|
|
|
dos2unix -q $tmpdir/CreatePersistentImg.sh
|
2020-05-20 14:36:27 +00:00
|
|
|
|
|
|
|
#32MB disk img
|
|
|
|
dd status=none if=$LOOP of=$tmpdir/ventoy/ventoy.disk.img bs=512 count=$VENTOY_SECTOR_NUM skip=$part2_start_sector
|
|
|
|
xz --check=crc32 $tmpdir/ventoy/ventoy.disk.img
|
|
|
|
|
|
|
|
losetup -d $LOOP && rm -f img.bin
|
|
|
|
|
|
|
|
rm -f ventoy-${curver}-linux.tar.gz
|
|
|
|
|
|
|
|
|
|
|
|
CurDir=$PWD
|
|
|
|
|
2020-12-11 23:56:52 +00:00
|
|
|
for d in i386 x86_64 aarch64; do
|
|
|
|
cd $tmpdir/tool/$d
|
|
|
|
for file in $(ls); do
|
|
|
|
if [ "$file" != "xzcat" ]; then
|
|
|
|
xz --check=crc32 $file
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
cd $CurDir
|
2020-05-20 14:36:27 +00:00
|
|
|
done
|
|
|
|
|
2020-08-29 05:12:36 +00:00
|
|
|
#chmod
|
|
|
|
find $tmpdir/ -type d -exec chmod 755 "{}" +
|
|
|
|
find $tmpdir/ -type f -exec chmod 644 "{}" +
|
|
|
|
chmod +x $tmpdir/Ventoy2Disk.sh
|
|
|
|
chmod +x $tmpdir/CreatePersistentImg.sh
|
|
|
|
|
2020-05-20 14:36:27 +00:00
|
|
|
tar -czvf ventoy-${curver}-linux.tar.gz $tmpdir
|
|
|
|
|
2020-08-29 05:12:36 +00:00
|
|
|
|
|
|
|
|
2020-05-20 14:36:27 +00:00
|
|
|
rm -f ventoy-${curver}-windows.zip
|
2021-01-29 09:54:04 +00:00
|
|
|
cp $OPT Ventoy2Disk*.exe $tmpdir/
|
|
|
|
cp $OPT $LANG_DIR/languages.ini $tmpdir/ventoy/
|
2020-05-20 14:36:27 +00:00
|
|
|
rm -rf $tmpdir/tool
|
|
|
|
rm -f $tmpdir/*.sh
|
2020-07-22 15:30:01 +00:00
|
|
|
rm -f $tmpdir/README
|
2020-05-20 14:36:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
zip -r ventoy-${curver}-windows.zip $tmpdir/
|
|
|
|
|
|
|
|
rm -rf $tmpdir
|
|
|
|
|
2020-09-02 11:29:19 +00:00
|
|
|
cd ../LiveCD
|
2021-01-29 09:54:04 +00:00
|
|
|
if [ "$1" = "CI" ]; then
|
|
|
|
echo "=============== run docker_ci.sh ==============="
|
2021-01-29 12:58:02 +00:00
|
|
|
sh docker_ci.sh $1
|
2021-01-29 09:54:04 +00:00
|
|
|
fi
|
|
|
|
echo "=============== run livecd.sh ==============="
|
2021-01-29 12:58:02 +00:00
|
|
|
sh livecd.sh $1
|
2020-09-02 11:29:19 +00:00
|
|
|
cd $CurDir
|
|
|
|
|
|
|
|
mv ../LiveCD/ventoy*.iso ./
|
|
|
|
|
2020-05-20 14:36:27 +00:00
|
|
|
if [ -e ventoy-${curver}-windows.zip ] && [ -e ventoy-${curver}-linux.tar.gz ]; then
|
|
|
|
echo -e "\n ============= SUCCESS =================\n"
|
|
|
|
else
|
|
|
|
echo -e "\n ============= FAILED =================\n"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-05-30 12:13:04 +00:00
|
|
|
rm -f log.txt
|
2020-05-20 14:36:27 +00:00
|
|
|
|