]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - LiveCD/livecd.sh
Update CI
[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
21
22 ls -la
23 if ! [ -d ISO_TMP ]; then
24 echo "Copy ISO_TMP failed"
25 exit 1
26 fi
27
28 if ! [ -d VTOY_TMP ]; then
29 echo "Copy VTOY_TMP failed"
30 exit 1
31 fi
32
33 mkdir -p ISO_TMP/EFI/ventoy
34 cd VTOY_TMP
35
36 gcc -O2 -m32 ./ventoy/disksize.c -o ./ventoy/disksize
37 rm -f ./ventoy/disksize.c
38 find . | cpio -o -H newc | gzip -c -9 > ../ISO_TMP/EFI/ventoy/ventoy.gz
39 cd .. && rm -rf VTOY_TMP
40
41
42 cp -a $VENTOY_PATH/INSTALL/ventoy-${version}-linux.tar.gz ISO_TMP/EFI/ventoy/
43 cp -a GRUB/cdrom.img ISO_TMP/EFI/boot/
44 cp -a GRUB/bootx64.efi ISO_TMP/EFI/boot/
45
46
47 rm -rf efimnt
48 rm -f efi.img
49 mkdir -p efimnt
50
51 dd if=/dev/zero of=efi.img bs=1M count=2
52 mkfs.vfat efi.img
53 mount efi.img efimnt
54 mkdir -p efimnt/EFI/boot
55 cp -a GRUB/bootx64.efi efimnt/EFI/boot/
56 umount efimnt
57
58 sync
59 cp -a efi.img ISO_TMP/EFI/boot/
60
61 rm -rf efimnt
62 rm -f efi.img
63
64
65 cd ISO_TMP
66
67 sed "s/xxx/$version/g" -i EFI/boot/grub.cfg
68
69 rm -f ../ventoy-${version}-livecd.iso
70
71 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 .
72
73 cd ../
74 rm -rf ISO_TMP
75