3 dos2unix
-q .
/tool
/ventoy_lib.sh
7 GRUB_DIR
=..
/GRUB
2/INSTALL
10 if ! [ -d $GRUB_DIR ]; then
11 echo "$GRUB_DIR not exist"
24 dd if=/dev
/zero of
=img.bin bs
=1M count
=256 status
=none
26 losetup
-P $LOOP img.bin
28 while ! grep -q 524288 /sys
/block
/${LOOP#/dev/}/size
2>/dev
/null
; do
33 format_ventoy_disk
$LOOP
35 $GRUB_DIR/sbin
/grub
-bios-setup --skip-fs-probe --directory="./grub/i386-pc" $LOOP
37 curver
=$(get_ventoy_version_from_cfg ./grub/grub.cfg)
39 tmpmnt
=.
/ventoy
-${curver}-mnt
40 tmpdir
=.
/ventoy
-${curver}
45 mount
${LOOP}p2
$tmpmnt
49 # First copy grub.cfg file, to make it locate at front of the part2
50 cp -a .
/grub
/grub.cfg
$tmpmnt/grub
/
52 ls -1 .
/grub
/ | grep -v 'grub\.cfg' | while read line
; do
53 cp -a .
/grub
/$line $tmpmnt/grub
/
56 cp -a .
/ventoy
$tmpmnt/
58 cp -a .
/tool
/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
$tmpmnt/
62 cp -a .
/tool
/mount
* $tmpmnt/tool
/
64 rm -f $tmpmnt/grub
/i386
-pc/*
67 umount
$tmpmnt && rm -rf $tmpmnt
72 mkdir -p $tmpdir/ventoy
73 echo $curver > $tmpdir/ventoy
/version
74 dd if=$LOOP of
=$tmpdir/boot
/boot.img bs
=1 count
=512 status
=none
75 dd if=$LOOP of
=$tmpdir/boot
/core.img bs
=512 count
=2047 skip
=1 status
=none
76 xz
--check=crc32
$tmpdir/boot
/core.img
79 cp -a Ventoy2Disk.sh
$tmpdir/
81 dos2unix
-q $tmpdir/Ventoy2Disk.sh
84 dd status
=none
if=$LOOP of
=$tmpdir/ventoy
/ventoy.disk.img bs
=512 count
=$VENTOY_SECTOR_NUM skip
=$part2_start_sector
85 xz
--check=crc32
$tmpdir/ventoy
/ventoy.disk.img
87 losetup
-d $LOOP && rm -f img.bin
89 rm -f ventoy
-${curver}-linux.
tar.gz
96 if [ "$file" != "xzcat" ] && [ "$file" != "ventoy_lib.sh" ]; then
97 xz
--check=crc32
$file
102 tar -czvf ventoy
-${curver}-linux.
tar.gz
$tmpdir
104 rm -f ventoy
-${curver}-windows.
zip
105 cp -a Ventoy2Disk.exe
$tmpdir/
106 cp -a $LANG_DIR/languages.ini
$tmpdir/ventoy
/
111 zip -r ventoy
-${curver}-windows.
zip $tmpdir/
115 if [ -e ventoy
-${curver}-windows.
zip ] && [ -e ventoy
-${curver}-linux.
tar.gz
]; then
116 echo -e "\n ============= SUCCESS =================\n"
118 echo -e "\n ============= FAILED =================\n"