From 807d313cd56200439adde1079e0596972c5a5d31 Mon Sep 17 00:00:00 2001 From: longpanda Date: Fri, 15 Jan 2021 14:09:59 +0800 Subject: [PATCH] add support for austrumi64-4.3.5.iso/slacko64-7.0.iso --- IMG/cpio/ventoy/hook/austrumi/disk_hook.sh | 10 +++++++-- IMG/cpio/ventoy/hook/austrumi/ventoy-hook.sh | 2 +- IMG/cpio/ventoy/hook/debian/puppy-hook.sh | 6 +++++ IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh | 1 + IMG/cpio/ventoy/hook/ventoy-hook-lib.sh | 10 +++++++++ IMG/cpio/ventoy/ventoy_chain.sh | 6 +++++ INSTALL/CreatePersistentImg.sh | 22 +++++++++++++++++-- INSTALL/grub/arm64-efi/command.lst | 1 + INSTALL/grub/arm64-efi/moddep.lst | 1 + INSTALL/grub/i386-efi/command.lst | 1 + INSTALL/grub/i386-efi/moddep.lst | 1 + INSTALL/grub/i386-pc/command.lst | 1 + INSTALL/grub/i386-pc/moddep.lst | 1 + INSTALL/grub/x86_64-efi/command.lst | 1 + INSTALL/grub/x86_64-efi/moddep.lst | 1 + 15 files changed, 60 insertions(+), 5 deletions(-) diff --git a/IMG/cpio/ventoy/hook/austrumi/disk_hook.sh b/IMG/cpio/ventoy/hook/austrumi/disk_hook.sh index 210eaf0f..431ccd53 100644 --- a/IMG/cpio/ventoy/hook/austrumi/disk_hook.sh +++ b/IMG/cpio/ventoy/hook/austrumi/disk_hook.sh @@ -21,8 +21,6 @@ VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH -wait_for_usb_disk_ready - vtdiskname=$(get_ventoy_disk_name) if [ "$vtdiskname" = "unknown" ]; then vtlog "ventoy disk not found" @@ -30,6 +28,14 @@ if [ "$vtdiskname" = "unknown" ]; then exit 0 fi +if check_usb_disk_ready "$vtdiskname"; then + vtlog "check_usb_disk_ready ok" +else + vtlog "check_usb_disk_ready error" + PATH=$VTPATH_OLD + exit 0 +fi + ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" # blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/') diff --git a/IMG/cpio/ventoy/hook/austrumi/ventoy-hook.sh b/IMG/cpio/ventoy/hook/austrumi/ventoy-hook.sh index 412d7153..5785dee2 100644 --- a/IMG/cpio/ventoy/hook/austrumi/ventoy-hook.sh +++ b/IMG/cpio/ventoy/hook/austrumi/ventoy-hook.sh @@ -19,6 +19,6 @@ . $VTOY_PATH/hook/ventoy-os-lib.sh -$SED "/^ *mdev *-s/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/austrumi/disk_hook.sh" -i /init +$SED "/find_usb *(/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/austrumi/disk_hook.sh" -i /init $SED "s/BOOT_TYPE=livecd/BOOT_TYPE=usb/g" -i /init diff --git a/IMG/cpio/ventoy/hook/debian/puppy-hook.sh b/IMG/cpio/ventoy/hook/debian/puppy-hook.sh index 4d9342ac..cbb5a20b 100644 --- a/IMG/cpio/ventoy/hook/debian/puppy-hook.sh +++ b/IMG/cpio/ventoy/hook/debian/puppy-hook.sh @@ -20,3 +20,9 @@ $SED '1 apmedia=usbhd' -i /init $SED "/^ *HAVE_PARTS=/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/puppy-disk.sh" -i /init $SED "/^ *HAVE_PARTS=/a\ HAVE_PARTS='ventoy|iso9660'" -i /init + +if [ -f /DISTRO_SPECS ]; then + if ! [ -d /dev ]; then + $BUSYBOX_PATH/mkdir /dev + fi +fi diff --git a/IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh b/IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh index d6570d86..84e87709 100644 --- a/IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh +++ b/IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh @@ -126,6 +126,7 @@ fi if [ -n "$VT_BUS_USB" ]; then vtlog "$1 is USB device" + echo /dev/$1 > /ventoy/list-devices-usb-part else vtlog "$1 is NOT USB device (bus $ID_BUS)" diff --git a/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh b/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh index f9dae7ae..689b68c8 100644 --- a/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh +++ b/IMG/cpio/ventoy/hook/ventoy-hook-lib.sh @@ -102,6 +102,16 @@ wait_for_usb_disk_ready() { done } +check_usb_disk_ready() { + if echo $1 | $EGREP -q "nvme|mmc"; then + vtpart2=${1}p2 + else + vtpart2=${1}2 + fi + + [ -e "${vtpart2}" ] +} + is_ventoy_disk() { if $VTOY_PATH/tool/vtoydump -f $VTOY_PATH/ventoy_os_param -c "$1"; then $BUSYBOX_PATH/true diff --git a/IMG/cpio/ventoy/ventoy_chain.sh b/IMG/cpio/ventoy/ventoy_chain.sh index e3446047..6bc993ca 100644 --- a/IMG/cpio/ventoy/ventoy_chain.sh +++ b/IMG/cpio/ventoy/ventoy_chain.sh @@ -313,6 +313,12 @@ ventoy_get_os_type() { echo 'austrumi'; return fi + if [ -f /DISTRO_SPECS ]; then + if $GREP -q '[Pp]uppy' /DISTRO_SPECS; then + echo 'debian'; return + fi + fi + echo "default" } diff --git a/INSTALL/CreatePersistentImg.sh b/INSTALL/CreatePersistentImg.sh index d8f41f8a..8cf01a3e 100644 --- a/INSTALL/CreatePersistentImg.sh +++ b/INSTALL/CreatePersistentImg.sh @@ -3,13 +3,15 @@ size=1024 fstype=ext4 label=casper-rw +config='' print_usage() { - echo 'Usage: CreatePersistentImg.sh [ -s size ] [ -t fstype ] [ -l LABEL ]' + echo 'Usage: CreatePersistentImg.sh [ -s size ] [ -t fstype ] [ -l LABEL ] [ -c CFG ]' echo ' OPTION: (optional)' echo ' -s size in MB, default is 1024' echo ' -t filesystem type, default is ext4 ext2/ext3/ext4/xfs are supported now' echo ' -l label, default is casper-rw' + echo ' -c configfile name inside the persistence file. File content is "/ union"' echo '' } @@ -23,6 +25,9 @@ while [ -n "$1" ]; do elif [ "$1" = "-l" ]; then shift label=$1 + elif [ "$1" = "-c" ]; then + shift + config=$1 elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then print_usage exit 0 @@ -76,5 +81,18 @@ mkfs -t $fstype $fsopt -L $label $freeloop sync -losetup -d $freeloop +if [ -n "$config" ]; then + if [ -d ./persist_tmp_mnt ]; then + rm -rf ./persist_tmp_mnt + fi + + mkdir ./persist_tmp_mnt + if mount $freeloop ./persist_tmp_mnt; then + echo '/ union' > ./persist_tmp_mnt/$config + sync + umount ./persist_tmp_mnt + fi + rm -rf ./persist_tmp_mnt +fi +losetup -d $freeloop diff --git a/INSTALL/grub/arm64-efi/command.lst b/INSTALL/grub/arm64-efi/command.lst index 3a87fe18..1ce3c363 100644 --- a/INSTALL/grub/arm64-efi/command.lst +++ b/INSTALL/grub/arm64-efi/command.lst @@ -32,6 +32,7 @@ *save_env: loadenv *search: search *serial: serial +*setkey: setkey *sha1sum: hashsum *sha256sum: hashsum *sha512sum: hashsum diff --git a/INSTALL/grub/arm64-efi/moddep.lst b/INSTALL/grub/arm64-efi/moddep.lst index 00683f97..1d83658e 100644 --- a/INSTALL/grub/arm64-efi/moddep.lst +++ b/INSTALL/grub/arm64-efi/moddep.lst @@ -1,4 +1,5 @@ videotest: font video gfxmenu +setkey: extcmd odc: archelp loopback: extcmd macho: diff --git a/INSTALL/grub/i386-efi/command.lst b/INSTALL/grub/i386-efi/command.lst index b829210a..581aa0a7 100644 --- a/INSTALL/grub/i386-efi/command.lst +++ b/INSTALL/grub/i386-efi/command.lst @@ -43,6 +43,7 @@ *save_env: loadenv *search: search *serial: serial +*setkey: setkey *setpci: setpci *sha1sum: hashsum *sha256sum: hashsum diff --git a/INSTALL/grub/i386-efi/moddep.lst b/INSTALL/grub/i386-efi/moddep.lst index 91501d7c..1afca1bb 100644 --- a/INSTALL/grub/i386-efi/moddep.lst +++ b/INSTALL/grub/i386-efi/moddep.lst @@ -1,4 +1,5 @@ videotest: font video gfxmenu +setkey: extcmd odc: archelp loopback: extcmd macho: diff --git a/INSTALL/grub/i386-pc/command.lst b/INSTALL/grub/i386-pc/command.lst index 8571ae80..7ee7afdf 100644 --- a/INSTALL/grub/i386-pc/command.lst +++ b/INSTALL/grub/i386-pc/command.lst @@ -47,6 +47,7 @@ *search: search *sendkey: sendkey *serial: serial +*setkey: setkey *setpci: setpci *sha1sum: hashsum *sha256sum: hashsum diff --git a/INSTALL/grub/i386-pc/moddep.lst b/INSTALL/grub/i386-pc/moddep.lst index 92444c3b..6218523c 100644 --- a/INSTALL/grub/i386-pc/moddep.lst +++ b/INSTALL/grub/i386-pc/moddep.lst @@ -1,4 +1,5 @@ videotest: font video gfxmenu +setkey: extcmd odc: archelp loopback: extcmd macho: diff --git a/INSTALL/grub/x86_64-efi/command.lst b/INSTALL/grub/x86_64-efi/command.lst index 343d1709..ea082f5e 100644 --- a/INSTALL/grub/x86_64-efi/command.lst +++ b/INSTALL/grub/x86_64-efi/command.lst @@ -43,6 +43,7 @@ *save_env: loadenv *search: search *serial: serial +*setkey: setkey *setpci: setpci *sha1sum: hashsum *sha256sum: hashsum diff --git a/INSTALL/grub/x86_64-efi/moddep.lst b/INSTALL/grub/x86_64-efi/moddep.lst index 6c76a7ab..c05dfc0f 100644 --- a/INSTALL/grub/x86_64-efi/moddep.lst +++ b/INSTALL/grub/x86_64-efi/moddep.lst @@ -1,4 +1,5 @@ videotest: font video gfxmenu +setkey: extcmd odc: archelp loopback: extcmd macho: