Change hard coded dracut hooks directory to variable. (#3753)
Ventoy CI / build (push) Canceled after 0s
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Canceled after 0s

Some distros (e.g.  Fedora 45) change dracut hooks directory from /lib/dracut/hooks to /var/lib/dracut/hooks
This commit is contained in:
longpanda
2026-09-28 20:56:47 +08:00
parent 6568972abc
commit ca552e14c0
10 changed files with 28 additions and 15 deletions
@@ -20,6 +20,6 @@
. $VTOY_PATH/hook/ventoy-os-lib.sh
ventoy_set_inotify_script blackPanther/ventoy-inotifyd-hook.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/blackPanther/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/00-ventoy-inotifyd-start.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/blackPanther/ventoy-inotifyd-start.sh $VT_DRACUT_HOOKS/pre-udev/00-ventoy-inotifyd-start.sh
$SED "s#printf\(.*\)\$CMDLINE#printf\1 root=/dev/ventoy \$CMDLINE root=/dev/ventoy#" -i /lib/dracut-lib.sh
+1 -1
View File
@@ -23,4 +23,4 @@ $SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=live:/dev/mapper/ventoy#" -
ventoy_set_inotify_script gobo/ventoy-inotifyd-hook.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/gobo/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/01-ventoy-inotifyd-start.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/gobo/ventoy-inotifyd-start.sh $VT_DRACUT_HOOKS/pre-udev/01-ventoy-inotifyd-start.sh
+1 -1
View File
@@ -24,4 +24,4 @@ $SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=/dev/ventoy#" -i /lib/dracu
$BUSYBOX_PATH/rm -f /usr/lib/systemd/system-generators/systemd-fstab-generator /lib/systemd/system-generators/systemd-fstab-generator
ventoy_set_inotify_script lunar/ventoy-inotifyd-hook.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/lunar/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/01-ventoy-inotifyd-start.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/lunar/ventoy-inotifyd-start.sh $VT_DRACUT_HOOKS/pre-udev/01-ventoy-inotifyd-start.sh
+1 -1
View File
@@ -23,7 +23,7 @@
#ventoy_add_udev_rule "$VTOY_PATH/hook/mageia/udev_disk_hook.sh %k noreplace"
ventoy_set_inotify_script mageia/ventoy-inotifyd-hook.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/mageia/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/99-ventoy-inotifyd-start.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/mageia/ventoy-inotifyd-start.sh $VT_DRACUT_HOOKS/pre-udev/99-ventoy-inotifyd-start.sh
@@ -93,9 +93,9 @@ else
vtPriority=01
fi
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/${vtPriority}-ventoy-inotifyd-start.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/${vtPriority}-ventoy-timeout.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-repo.sh /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-inotifyd-start.sh $VT_DRACUT_HOOKS/pre-udev/${vtPriority}-ventoy-inotifyd-start.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-timeout.sh $VT_DRACUT_HOOKS/initqueue/timeout/${vtPriority}-ventoy-timeout.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/openEuler/ventoy-repo.sh $VT_DRACUT_HOOKS/pre-pivot/99-ventoy-repo.sh
if [ -f /sbin/dmsquash-live-root ]; then
echo "patch /sbin/dmsquash-live-root ..." >> $VTLOG
@@ -109,5 +109,5 @@ fi
if [ -f $VTOY_PATH/autoinstall ]; then
cp -a $VTOY_PATH/hook/openEuler/ventoy-autoexp.sh /lib/dracut/hooks/pre-mount/99-ventoy-autoexp.sh
cp -a $VTOY_PATH/hook/openEuler/ventoy-autoexp.sh $VT_DRACUT_HOOKS/pre-mount/99-ventoy-autoexp.sh
fi
+5 -5
View File
@@ -24,7 +24,7 @@
if [ -f $VTOY_PATH/autoinstall ]; then
VTKS="inst.ks=file:$VTOY_PATH/autoinstall"
cp -a $VTOY_PATH/hook/rhel7/ventoy-autoexp.sh /lib/dracut/hooks/pre-mount/99-ventoy-autoexp.sh
cp -a $VTOY_PATH/hook/rhel7/ventoy-autoexp.sh $VT_DRACUT_HOOKS/pre-mount/99-ventoy-autoexp.sh
else
for vtParam in $($CAT /proc/cmdline); do
if echo $vtParam | $GREP -q 'ks=file:/'; then
@@ -119,7 +119,7 @@ fi
echo "vtNeedRepo=$vtNeedRepo" >> $VTLOG
if [ "$vtNeedRepo" = "yes" ]; then
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-repo.sh /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-repo.sh $VT_DRACUT_HOOKS/pre-pivot/99-ventoy-repo.sh
fi
@@ -161,8 +161,8 @@ else
vtPriority=01
fi
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/${vtPriority}-ventoy-inotifyd-start.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-timeout.sh /lib/dracut/hooks/initqueue/timeout/${vtPriority}-ventoy-timeout.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-inotifyd-start.sh $VT_DRACUT_HOOKS/pre-udev/${vtPriority}-ventoy-inotifyd-start.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/rhel7/ventoy-timeout.sh $VT_DRACUT_HOOKS/initqueue/timeout/${vtPriority}-ventoy-timeout.sh
if [ -e /sbin/dmsquash-live-root ]; then
@@ -178,7 +178,7 @@ fi
#For Fedora CoreOS
if $GREP -i -q 'fedora.*coreos' /etc/os-release; then
$SED "s#isosrc=.*#isosrc=/dev/mapper/ventoy#" -i /lib/systemd/system-generators/live-generator
cp -a $VTOY_PATH/hook/rhel7/ventoy-make-link.sh /lib/dracut/hooks/pre-mount/99-ventoy-premount-mklink.sh
cp -a $VTOY_PATH/hook/rhel7/ventoy-make-link.sh $VT_DRACUT_HOOKS/pre-mount/99-ventoy-premount-mklink.sh
fi
@@ -34,7 +34,7 @@ if is_inotify_ventoy_part $3; then
vtlog "find ventoy partition ..."
vtReplaceOpt=noreplace
if [ -f /lib/dracut/hooks/pre-pivot/99-ventoy-repo.sh ]; then
if [ -f $VT_DRACUT_HOOKS/pre-pivot/99-ventoy-repo.sh ]; then
vtReplaceOpt=""
fi
@@ -30,5 +30,5 @@ else
#don't call it too early issue 2225
#$BUSYBOX_PATH/sh $vtHook n /dev "${vtdisk#/dev/}2"
cp -a $VTOY_PATH/hook/rhel7/ventoy-inotifyd-call.sh /lib/dracut/hooks/initqueue/settled/90-ventoy-inotifyd-call.sh
cp -a $VTOY_PATH/hook/rhel7/ventoy-inotifyd-call.sh $VT_DRACUT_HOOKS/initqueue/settled/90-ventoy-inotifyd-call.sh
fi
+6
View File
@@ -32,6 +32,11 @@ VTOY_DM_PATH=/dev/mapper/ventoy
VTOY_DEBUG_LEVEL=$($BUSYBOX_PATH/hexdump -n 1 -s 450 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
VTOY_LINUX_REMOUNT=$($BUSYBOX_PATH/hexdump -n 1 -s 454 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
VTOY_VLNK_BOOT=$($BUSYBOX_PATH/hexdump -n 1 -s 455 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
if [ -d /var/lib/dracut/hooks ]; then
VT_DRACUT_HOOKS=/var/lib/dracut/hooks
else
VT_DRACUT_HOOKS=/lib/dracut/hooks
fi
if [ "$VTOY_DEBUG_LEVEL" = "01" ]; then
if [ -e /dev/console ]; then
@@ -39,6 +44,7 @@ if [ "$VTOY_DEBUG_LEVEL" = "01" ]; then
fi
fi
vtlog() {
if [ "$VTLOG" = "$VTOY_PATH/log" ]; then
echo "$*" >>$VTLOG
+7
View File
@@ -22,6 +22,13 @@ VT_PRINTK_LEVEL=0
VT_UDEV_RULE_FILE_NAME="99-ventoy.rules"
VT_UDEV_RULE_PREFIX="ACTION==\"add\", SUBSYSTEM==\"block\","
if [ -d /var/lib/dracut/hooks ]; then
VT_DRACUT_HOOKS=/var/lib/dracut/hooks
else
VT_DRACUT_HOOKS=/lib/dracut/hooks
fi
ventoy_close_printk() {
VT_PRINTK_LEVEL=$($CAT /proc/sys/kernel/printk | $AWK '{print $1}')
if [ -e /proc/sys/kernel/printk ]; then