diff --git a/IMG/cpio/ventoy/hook/debian/pve-hook.sh b/IMG/cpio/ventoy/hook/debian/pve-hook.sh index e54ab4ca..559441c1 100644 --- a/IMG/cpio/ventoy/hook/debian/pve-hook.sh +++ b/IMG/cpio/ventoy/hook/debian/pve-hook.sh @@ -17,5 +17,10 @@ # #************************************************************************************ +if $GREP -q 'rdinit=/vtoy/vtoy' /proc/cmdline; then + echo "fix rdinit" >> $VTLOG + $SED "/switch_root.*\/mnt\/.installer-mp/i\ sh $VTOY_PATH/hook/debian/pve-wa.sh /mnt/.installer-mp/sbin/unconfigured.sh" -i /init +fi + $SED "/\/sys\/block\/hd\*/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/pve-disk.sh" -i /init $SED "s#/sys/block/hd\*#/sys/block/dm* /sys/block/hd*#" -i /init diff --git a/IMG/cpio/ventoy/hook/debian/pve-wa.sh b/IMG/cpio/ventoy/hook/debian/pve-wa.sh new file mode 100644 index 00000000..a2b92449 --- /dev/null +++ b/IMG/cpio/ventoy/hook/debian/pve-wa.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +script=$1 +tmpscript=${script}.tmp + +LINE=$(grep -n 'proc.*proc.*proc' $script | awk -F':' '{print $1}') + +sed -n "1,${LINE}p" $script >> $tmpscript + +echo "if grep -q 'rdinit=/vtoy/vtoy' /proc/cmdline; then" >> $tmpscript +echo " sed 's#rdinit=/vtoy/vtoy##g' /proc/cmdline > /etc/cmdline" >> $tmpscript +echo " mount --bind /etc/cmdline /proc/cmdline" >> $tmpscript +echo "fi" >> $tmpscript + + +let LINE++ +sed -n "${LINE},\$p" $script >> $tmpscript + +cat $tmpscript > $script +