5 GRUB_DIR
=..
/GRUB
2/INSTALL
8 if ! [ -d $GRUB_DIR ]; then
9 echo "$GRUB_DIR not exist"
22 dd if=/dev
/zero of
=img.bin bs
=1M count
=256 status
=none
24 losetup
-P $LOOP img.bin
26 while ! grep -q 524288 /sys
/block
/${LOOP#/dev/}/size
2>/dev
/null
; do
31 format_ventoy_disk
$LOOP
33 $GRUB_DIR/sbin
/grub
-bios-setup --skip-fs-probe --directory="./grub/i386-pc" $LOOP
35 curver
=$(get_ventoy_version_from_cfg ./grub/grub.cfg)
37 tmpmnt
=.
/ventoy
-${curver}-mnt
38 tmpdir
=.
/ventoy
-${curver}
43 mount
${LOOP}p2
$tmpmnt
47 # First copy grub.cfg file, to make it locate at front of the part2
48 cp -a .
/grub
/grub.cfg
$tmpmnt/grub
/
50 ls -1 .
/grub
/ | grep -v 'grub\.cfg' | while read line
; do
51 cp -a .
/grub
/$line $tmpmnt/grub
/
54 cp -a .
/ventoy
$tmpmnt/
56 cp -a .
/tool
/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
$tmpmnt/
60 cp -a .
/tool
/mount
* $tmpmnt/tool
/
62 rm -f $tmpmnt/grub
/i386
-pc/*
65 umount
$tmpmnt && rm -rf $tmpmnt
70 mkdir -p $tmpdir/ventoy
71 echo $curver > $tmpdir/ventoy
/version
72 dd if=$LOOP of
=$tmpdir/boot
/boot.img bs
=1 count
=512 status
=none
73 dd if=$LOOP of
=$tmpdir/boot
/core.img bs
=512 count
=2047 skip
=1 status
=none
74 xz
--check=crc32
$tmpdir/boot
/core.img
77 cp -a Ventoy2Disk.sh
$tmpdir/
81 dd status
=none
if=$LOOP of
=$tmpdir/ventoy
/ventoy.disk.img bs
=512 count
=$VENTOY_SECTOR_NUM skip
=$part2_start_sector
82 xz
--check=crc32
$tmpdir/ventoy
/ventoy.disk.img
84 losetup
-d $LOOP && rm -f img.bin
86 rm -f ventoy
-${curver}-linux.
tar.gz
93 if [ "$file" != "xzcat" ] && [ "$file" != "ventoy_lib.sh" ]; then
94 xz
--check=crc32
$file
99 tar -czvf ventoy
-${curver}-linux.
tar.gz
$tmpdir
101 rm -f ventoy
-${curver}-windows.
zip
102 cp -a Ventoy2Disk.exe
$tmpdir/
103 cp -a $LANG_DIR/languages.ini
$tmpdir/ventoy
/
108 zip -r ventoy
-${curver}-windows.
zip $tmpdir/
112 if [ -e ventoy
-${curver}-windows.
zip ] && [ -e ventoy
-${curver}-linux.
tar.gz
]; then
113 echo -e "\n ============= SUCCESS =================\n"
115 echo -e "\n ============= FAILED =================\n"