]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - LiveCD/livecd.sh
1.0.22 release
[Ventoy.git] / LiveCD / livecd.sh
1 #!/bin/bash
2
3 VENTOY_PATH=$PWD/../
4
5 if ! [ -f $VENTOY_PATH/INSTALL/grub/grub.cfg ]; then
6 echo "no grub.cfg detected"
7 exit 1
8 fi
9
10 version=$(grep 'set.*VENTOY_VERSION=' $VENTOY_PATH/INSTALL/grub/grub.cfg | awk -F'"' '{print $2}')
11
12 if ! [ -e $VENTOY_PATH/INSTALL/ventoy-${version}-linux.tar.gz ]; then
13 echo "no ventoy-${version}-linux.tar.gz detected"
14 exit 1
15 fi
16
17 rm -rf ISO_TMP
18 cp -a ISO ISO_TMP
19
20 cp -a VTOY VTOY_TMP && cd VTOY_TMP
21 gcc -O2 -m32 ./ventoy/disksize.c -o ./ventoy/disksize
22 rm -f ./ventoy/disksize.c
23 find . | cpio -o -H newc | gzip -9 > ../ISO_TMP/EFI/ventoy/ventoy.gz
24 cd .. && rm -rf VTOY_TMP
25
26
27 cp -a $VENTOY_PATH/INSTALL/ventoy-${version}-linux.tar.gz ISO_TMP/EFI/ventoy/
28 cp -a GRUB/cdrom.img ISO_TMP/EFI/boot/
29 cp -a GRUB/bootx64.efi ISO_TMP/EFI/boot/
30
31
32 rm -rf efimnt
33 rm -f efi.img
34 mkdir -p efimnt
35
36 dd if=/dev/zero of=efi.img bs=1M count=2
37 mkfs.vfat efi.img
38 mount efi.img efimnt
39 mkdir -p efimnt/EFI/boot
40 cp -a GRUB/bootx64.efi efimnt/EFI/boot/
41 umount efimnt
42
43 sync
44 cp -a efi.img ISO_TMP/EFI/boot/
45
46 rm -rf efimnt
47 rm -f efi.img
48
49
50 cd ISO_TMP
51
52 sed "s/xxx/$version/g" -i EFI/boot/grub.cfg
53
54 rm -f ../ventoy-${version}-livecd.iso
55
56 xorriso -as mkisofs -allow-lowercase --sort-weight 0 / --sort-weight 1 /EFI -v -R -J -V 'VentoyLiveCD' -P 'VENTOY COMPATIBLE' -p 'https://www.ventoy.net' -sysid 'Ventoy' -A 'VentoyLiveCD' -b EFI/boot/cdrom.img --grub2-boot-info --grub2-mbr ../GRUB/boot_hybrid.img -c EFI/boot/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e EFI/boot/efi.img -no-emul-boot -append_partition 2 0xEF EFI/boot/efi.img -o ../ventoy-${version}-livecd.iso .
57
58 cd ../
59 rm -rf ISO_TMP
60