Add GUI LiveCD

This commit is contained in:
longpanda 2021-09-29 19:26:50 +08:00
parent d72bb15956
commit 32c5b5deea
19 changed files with 315 additions and 3 deletions

View File

@ -5,6 +5,6 @@ RUN yum -y -q install \
mpfr.i686 mpfr-devel.i686 rsync autogen autoconf automake libtool gettext* bison binutils \ mpfr.i686 mpfr-devel.i686 rsync autogen autoconf automake libtool gettext* bison binutils \
flex device-mapper-devel SDL libpciaccess libusb freetype freetype-devel gnu-free-* qemu-* virt-* \ flex device-mapper-devel SDL libpciaccess libusb freetype freetype-devel gnu-free-* qemu-* virt-* \
libvirt* vte* NetworkManager-bluetooth brlapi fuse-devel dejavu* gnu-efi* pesign shim \ libvirt* vte* NetworkManager-bluetooth brlapi fuse-devel dejavu* gnu-efi* pesign shim \
iscsi-initiator-utils grub2-tools zip nasm acpica-tools glibc-static zlib-static xorriso iscsi-initiator-utils grub2-tools zip nasm acpica-tools glibc-static zlib-static xorriso lz4 squashfs-tools
CMD cd /ventoy/INSTALL && ls -la && sh docker_ci_build.sh CMD cd /ventoy/INSTALL && ls -la && sh docker_ci_build.sh

View File

@ -179,11 +179,11 @@ zip -r ventoy-${curver}-windows.zip $tmpdir/
rm -rf $tmpdir rm -rf $tmpdir
echo "=============== run livecd.sh ===============" echo "=============== run livecd.sh ==============="
cd ../LiveCD cd ../LiveCDGUI
sh livecd.sh $1 sh livecd.sh $1
cd $CurDir cd $CurDir
mv ../LiveCD/ventoy*.iso ./ mv ../LiveCDGUI/ventoy*.iso ./
if [ -e ventoy-${curver}-windows.zip ] && [ -e ventoy-${curver}-linux.tar.gz ]; then if [ -e ventoy-${curver}-windows.zip ] && [ -e ventoy-${curver}-linux.tar.gz ]; then
echo -e "\n ============= SUCCESS =================\n" echo -e "\n ============= SUCCESS =================\n"

View File

@ -0,0 +1,3 @@
Porteus Kiosk follows GPL license (see gpl-3.0.txt)
Ventoy does not modify its source code, only its library is used.

11
LiveCDGUI/EXT/README.txt Normal file
View File

@ -0,0 +1,11 @@
All the files here are from Porteus-Kiosk-5.2.0-x86_64.iso (https://porteus-kiosk.org/public/5.2/)
MD5SUM:
42857b439725a0e1adb0c396849f57c9 EXT/000-kernel.xzm
9b699227f44178dfd323d7503510c868 EXT/001-core.xzm
aafb2191accb37bd6725c84522c92e51 EXT/003-settings.xzm
0cd503757d9829847a01b9403f60fee2 EXT/004-wifi.xzm
501b6096122dcf0da75cdbba1868cd31 EXT/06-fonts.xzm
ce677b50b223ce76df070d23af016338 EXT/initrd.xz
9e96e4550de38f8e22733a0afe56dab3 EXT/vmlinuz

Binary file not shown.

BIN
LiveCDGUI/GRUB/bootx64.efi Normal file

Binary file not shown.

BIN
LiveCDGUI/GRUB/cdrom.img Normal file

Binary file not shown.

5
LiveCDGUI/GRUB/embed.cfg Normal file
View File

@ -0,0 +1,5 @@
search -f /EFI/VentoyLiveCD -s root
configfile ($root)/EFI/boot/grub.cfg

View File

@ -0,0 +1,3 @@
VentoyLiveCD
https://www.ventoy.net

View File

@ -0,0 +1,27 @@
set timeout=3
set default=LiveCD
clear
menuentry 'Ventoy xxx LiveCD GUI' --id=LiveCD {
echo downloading kernel ...
linux /EFI/boot/vmlinuz quiet first_run rdinit=/VTOY/init
echo downloading initrd ...
initrd /EFI/boot/initrd
echo booting LiveCD ...
boot
}
menuentry 'Ventoy xxx LiveCD GUI (Debug Mode)' {
echo downloading kernel ...
linux /EFI/boot/vmlinuz debug loglevel=7 first_run rdinit=/VTOY/init
echo downloading initrd ...
initrd /EFI/boot/initrd
echo booting LiveCD ...
boot
}

13
LiveCDGUI/VTOY/autostart Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
hsetroot -fill /usr/share/wallpapers/wallpaper.png
INIFILE=/ventoy/Ventoy2Disk.ini
echo "[Ventoy]" >> $INIFILE
echo "Language=Chinese Simplified (简体中文)" >> $INIFILE
echo "PartStyle=0" >> $INIFILE
echo "ShowAllDevice=0" >> $INIFILE
/ventoy/tool/x86_64/Ventoy2Disk.gtk3 --kiosk

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB

98
LiveCDGUI/VTOY/init Normal file
View File

@ -0,0 +1,98 @@
#!/bin/sh
#
# Porteus Kiosk initialization script.
# Author: T.Jokiel <http://porteus-kiosk.org>
#
# 2021 longpanda admin@ventoy.net
#
/bin/busybox --install -s
mount -nt proc proc /proc
grep -q -w debug /proc/cmdline || { echo 0 >/proc/sys/kernel/printk 2>/dev/null; clear; }
mount -nt sysfs sysfs /sys
mount -nt devtmpfs none /dev
mkdir -p /dev/shm; chmod 1777 /dev/shm
grep -q -w debug /proc/cmdline && touch /tmp/lspci || quiet=yes
# Use memory as aufs
mount -nt tmpfs -o size=75% tmpfs /memory
mkdir -p /memory/xino /memory/changes /memory/images /memory/copy2ram
# Setup aufs
mount -nt aufs -o nowarn_perm,xino=/memory/xino/.aufs.xino,br:/memory/changes=rw aufs /union
#Draw background
if [ -z "$quiet" ]; then
echo "##################################################"
echo "Starting Ventoy Live GUI <https://www.ventoy.net>"
echo "##################################################"
else
mkdir -p /lib /opt/000 /opt/001; lspci >/tmp/lspci
mount -o loop /000-kernel.xzm /opt/000
mount -o loop /001-core.xzm /opt/001
[ `uname -m` = x86_64 ] && prefix="-x86-64"
ln -sf /opt/000/lib/firmware /lib/firmware
ln -sf /opt/000/lib/modules /lib/modules
ln -sf /opt/001/lib64/libc.so.6 /lib/libc.so.6
ln -sf /opt/001/lib64/ld-linux"$prefix".so.2 /lib/ld-linux"$prefix".so.2
ln -s /opt/001/bin/kmod /bin/modprobe
vga=`lspci | grep 0300: | head -n1 | cut -d: -f3-4 | sed s/:/d0000/g`; [ "$vga" ] && driver="$(grep -i $vga /lib/modules/`uname -r`/modules.alias 2>/dev/null | head -n1 | rev | cut -d" " -f1 | rev)"
# Nvidia quirk:
[ "$driver" ] || { lspci | grep 0300: | head -n1 | cut -d: -f3 | grep -q "10de" && driver=nouveau; }
# VirtualBox quirk:
[ "$driver" = vboxvideo ] || modprobe $driver 2>/dev/null
test -e /dev/fb0 || { cp /opt/001/sbin/v86d /sbin; modprobe uvesafb mode_option=1024x768-32; }
if test -e /dev/fb0; then
rm -r /lib; ln -sf /opt/001/lib64 /lib; ln -sf /opt/001/usr/lib64 /usr/lib
/opt/001/usr/bin/fbv -a -c -u -i -k -e -r /VTOY/background.png 2>/dev/null &
fi
fi
cp -a /*.xzm /memory/copy2ram/
# Populate aufs with modules:
for x in `ls -1 /memory/copy2ram/ | grep \\.xzm$`; do
mkdir -p /memory/images/$x
mount -nt squashfs -o loop /memory/copy2ram/$x /memory/images/$x 2>/dev/null
if [ $? -eq 0 ]; then
mount -no remount,add:1:/memory/images/$x=rr aufs /union
fi
done
#clean
if [ -n "$quiet" ]; then
while [ "`pidof fbv`" ]; do
usleep 500000
done
umount /opt/000 /opt/001 2>/dev/null
rm -r /lib
fi
mkdir -p /union/opt/scripts/
echo 123 > /union/opt/scripts/extras
rm -f /union/lib64/udev/rules.d/10-kiosk-auto_mount.rules
cp -a /VTOY/autostart /union/etc/xdg/openbox/autostart
cp -a /VTOY/*.png /union/ventoy/
cp -a /bin/busybox /union/bin; ln -sf /union/lib /lib
cp -a /VTOY/wallpaper.png /union/usr/share/wallpapers/ 2>/dev/null
#to suppress error message
mkdir -p /mnt/fake/docs
echo 11 > /mnt/fake/docs/kiosk.sgn
# swith_root
exec /sbin/switch_root /union /sbin/init

BIN
LiveCDGUI/VTOY/refresh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
LiveCDGUI/VTOY/secure.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

23
LiveCDGUI/download_ext.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
date +"%Y/%m/%d %H:%M:%S"
echo downloading EXT files ...
wget -q -P ./EXT/ https://github.com/ventoy/KioskFiles/releases/download/v1.0/Porteus-Kiosk-5.2.0-x86_64.iso
wget -q -P ./EXT/ https://github.com/ventoy/KioskFiles/releases/download/v1.0/06-fonts.xzm
[ -d ./__tmp__ ] && rm -rf ./__tmp__
mkdir __tmp__
mount ./EXT/Porteus-Kiosk-5.2.0-x86_64.iso ./__tmp__
cp -a ./__tmp__/boot/vmlinuz ./EXT/
cp -a ./__tmp__/boot/initrd.xz ./EXT/
cp -a ./__tmp__/xzm/* ./EXT/
umount ./__tmp__
rm -rf ./__tmp__
rm -f ./EXT/Porteus-Kiosk-5.2.0-x86_64.iso
date +"%Y/%m/%d %H:%M:%S"
echo downloading EXT files finish ...

42
LiveCDGUI/initrd.sh Normal file
View File

@ -0,0 +1,42 @@
#!/bin/bash
VENTOY_PATH=$PWD/../
if ! [ -f $VENTOY_PATH/INSTALL/grub/grub.cfg ]; then
echo "no grub.cfg detected"
exit 1
fi
version=$(grep 'set.*VENTOY_VERSION=' $VENTOY_PATH/INSTALL/grub/grub.cfg | awk -F'"' '{print $2}')
if ! [ -e $VENTOY_PATH/INSTALL/ventoy-${version}-linux.tar.gz ]; then
echo "no ventoy-${version}-linux.tar.gz detected"
exit 1
fi
echo "Ventoy LiveCD GUI $version"
[ -d _INITRD_ ] && rm -rf _INITRD_
mkdir _INITRD_
cd _INITRD_
xzcat ../EXT/initrd.xz | cpio -idmu --quiet >/dev/null 2>&1
cp -a ../EXT/*.xzm ./
cp -a ../VTOY ./
mkdir ventoy
tar -xf $VENTOY_PATH/INSTALL/ventoy-${version}-linux.tar.gz -C .
mv ./ventoy-${version} ./ventoy/ventoy
chmod -R 777 ./ventoy
mksquashfs ventoy ventoy.xzm -comp xz
rm -rf ./ventoy
rm -f ../initrd.img
find . | cpio --quiet -o -H newc > ../initrd.img
cd ..
rm -rf _INITRD_

87
LiveCDGUI/livecd.sh Normal file
View File

@ -0,0 +1,87 @@
#!/bin/bash
if [ "$1" = "CI" ]; then
OPT='-dR'
else
OPT='-a'
fi
VENTOY_PATH=$PWD/../
if ! [ -f $VENTOY_PATH/INSTALL/grub/grub.cfg ]; then
echo "no grub.cfg detected"
exit 1
fi
version=$(grep 'set.*VENTOY_VERSION=' $VENTOY_PATH/INSTALL/grub/grub.cfg | awk -F'"' '{print $2}')
if ! [ -e $VENTOY_PATH/INSTALL/ventoy-${version}-linux.tar.gz ]; then
echo "no ventoy-${version}-linux.tar.gz detected"
exit 1
fi
if [ "$1" = "CI" ]; then
sh ./download_ext.sh
fi
if [ ! -f ./EXT/vmlinuz ]; then
echo "Please download EXT files first!"
exit 1
fi
sh ./initrd.sh
rm -rf ISO_TMP
cp -a ISO ISO_TMP
if ! [ -d ISO_TMP ]; then
echo "Copy ISO_TMP failed"
exit 1
fi
cp -a ./EXT/vmlinuz ISO_TMP/EFI/boot/
mv ./initrd.img ISO_TMP/EFI/boot/initrd
cp -a GRUB/cdrom.img ISO_TMP/EFI/boot/
cp -a GRUB/bootx64.efi ISO_TMP/EFI/boot/
rm -rf efimnt
rm -f efi.img
mkdir -p efimnt
dd if=/dev/zero of=efi.img bs=1M count=2
mkfs.vfat efi.img
mount efi.img efimnt
mkdir -p efimnt/EFI/boot
cp $OPT GRUB/bootx64.efi efimnt/EFI/boot/
umount efimnt
sync
cp -a efi.img ISO_TMP/EFI/boot/
rm -rf efimnt
rm -f efi.img
cd ISO_TMP
sed "s/xxx/$version/g" -i EFI/boot/grub.cfg
rm -f ../ventoy-${version}-livecd.iso
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 .
cd ../
rm -rf ISO_TMP
echo ""
if [ -f ventoy-${version}-livecd.iso ]; then
echo "========== SUCCESS ============="
else
echo "========== FAILED ============="
fi
echo ""