3 dos2unix
-q .
/tool
/ventoy_lib.sh
4 dos2unix
-q .
/tool
/VentoyWorker.sh
8 GRUB_DIR
=..
/GRUB
2/INSTALL
11 if ! [ -d $GRUB_DIR ]; then
12 echo "$GRUB_DIR not exist"
25 dd if=/dev
/zero of
=img.bin bs
=1M count
=256 status
=none
27 losetup
-P $LOOP img.bin
29 while ! grep -q 524288 /sys
/block
/${LOOP#/dev/}/size
2>/dev
/null
; do
34 format_ventoy_disk_mbr
0 $LOOP fdisk
36 $GRUB_DIR/sbin
/grub
-bios-setup --skip-fs-probe --directory="./grub/i386-pc" $LOOP
38 curver
=$(get_ventoy_version_from_cfg ./grub/grub.cfg)
40 tmpmnt
=.
/ventoy
-${curver}-mnt
41 tmpdir
=.
/ventoy
-${curver}
46 mount
${LOOP}p2
$tmpmnt
50 # First copy grub.cfg file, to make it locate at front of the part2
51 cp -a .
/grub
/grub.cfg
$tmpmnt/grub
/
53 ls -1 .
/grub
/ | grep -v 'grub\.cfg' | while read line
; do
54 cp -a .
/grub
/$line $tmpmnt/grub
/
57 cp -a .
/ventoy
$tmpmnt/
59 cp -a .
/tool
/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
$tmpmnt/
63 cp -a .
/tool
/mount
* $tmpmnt/tool
/
65 rm -f $tmpmnt/grub
/i386
-pc/*
68 umount
$tmpmnt && rm -rf $tmpmnt
73 mkdir -p $tmpdir/ventoy
74 echo $curver > $tmpdir/ventoy
/version
75 dd if=$LOOP of
=$tmpdir/boot
/boot.img bs
=1 count
=512 status
=none
76 dd if=$LOOP of
=$tmpdir/boot
/core.img bs
=512 count
=2047 skip
=1 status
=none
77 xz
--check=crc32
$tmpdir/boot
/core.img
80 rm -f $tmpdir/ENROLL_THIS_KEY_IN_MOKMANAGER.cer
81 cp -a Ventoy2Disk.sh
$tmpdir/
82 cp -a CreatePersistentImg.sh
$tmpdir/
83 dos2unix
-q $tmpdir/Ventoy2Disk.sh
84 dos2unix
-q $tmpdir/CreatePersistentImg.sh
87 dd status
=none
if=$LOOP of
=$tmpdir/ventoy
/ventoy.disk.img bs
=512 count
=$VENTOY_SECTOR_NUM skip
=$part2_start_sector
88 xz
--check=crc32
$tmpdir/ventoy
/ventoy.disk.img
90 losetup
-d $LOOP && rm -f img.bin
92 rm -f ventoy
-${curver}-linux.
tar.gz
99 if [ "$file" != "xzcat" ] && [ "$file" != "ventoy_lib.sh" ]; then
100 xz
--check=crc32
$file
105 tar -czvf ventoy
-${curver}-linux.
tar.gz
$tmpdir
107 rm -f ventoy
-${curver}-windows.
zip
108 cp -a Ventoy2Disk
*.exe
$tmpdir/
109 cp -a $LANG_DIR/languages.ini
$tmpdir/ventoy
/
114 zip -r ventoy
-${curver}-windows.
zip $tmpdir/
118 if [ -e ventoy
-${curver}-windows.
zip ] && [ -e ventoy
-${curver}-linux.
tar.gz
]; then
119 echo -e "\n ============= SUCCESS =================\n"
121 echo -e "\n ============= FAILED =================\n"