summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2011-03-25 13:31:34 +0100
committerHarald Hoyer <harald@redhat.com>2011-03-25 16:10:46 +0100
commit0b53ca70b6bafbbed2c484208faba3100c448746 (patch)
treed8e5c8503c82b2288afd486115eaac972dfb0556
parentc9f1e3d1f47c9749494a108ecedfa5b4fc6f7d41 (diff)
downloaddracut-0b53ca70b6bafbbed2c484208faba3100c448746.tar.gz
dracut-0b53ca70b6bafbbed2c484208faba3100c448746.tar.bz2
dracut-0b53ca70b6bafbbed2c484208faba3100c448746.zip
Move all hooks to "$hookdir"
hookdir=/lib/dracut/hooks for now, to keep the root directory clean
-rwxr-xr-xdracut5
-rwxr-xr-xdracut-functions8
-rwxr-xr-xmodules.d/40network/dhcp-root.sh2
-rwxr-xr-xmodules.d/40network/netroot3
-rwxr-xr-xmodules.d/90crypt/parse-crypt.sh4
-rwxr-xr-xmodules.d/90dmsquash-live/dmsquash-live-genrules.sh4
-rwxr-xr-xmodules.d/90dmsquash-live/dmsquash-live-root2
-rwxr-xr-xmodules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh2
-rwxr-xr-xmodules.d/90lvm/lvm_scan.sh4
-rwxr-xr-xmodules.d/90lvm/parse-lvm.sh4
-rw-r--r--modules.d/90mdraid/65-md-incremental-imsm.rules8
-rwxr-xr-xmodules.d/90mdraid/md_finished.sh2
-rwxr-xr-xmodules.d/90mdraid/mdcontainer_start.sh4
-rwxr-xr-xmodules.d/90mdraid/mdraid_start.sh4
-rwxr-xr-xmodules.d/90mdraid/parse-md.sh2
-rwxr-xr-xmodules.d/95iscsi/iscsiroot6
-rwxr-xr-xmodules.d/95iscsi/parse-iscsiroot.sh2
-rwxr-xr-xmodules.d/95nbd/nbdroot4
-rwxr-xr-xmodules.d/95nbd/parse-nbdroot.sh2
-rwxr-xr-xmodules.d/95nfs/nfsroot4
-rwxr-xr-xmodules.d/95nfs/parse-nfsroot.sh2
-rwxr-xr-xmodules.d/95resume/resume-genrules.sh6
-rwxr-xr-xmodules.d/95rootfs-block/block-genrules.sh4
-rwxr-xr-xmodules.d/99base/dracut-lib.sh13
-rwxr-xr-xmodules.d/99base/init22
-rwxr-xr-xmodules.d/99base/initqueue8
-rwxr-xr-xmodules.d/99base/module-setup.sh13
-rwxr-xr-xtest/TEST-10-RAID/test.sh4
-rwxr-xr-xtest/TEST-11-LVM/test.sh4
-rwxr-xr-xtest/TEST-12-RAID-DEG/test.sh4
-rwxr-xr-xtest/TEST-13-ENC-RAID-LVM/test.sh4
-rwxr-xr-xtest/TEST-14-IMSM/test.sh4
-rwxr-xr-xtest/TEST-20-NFS/test.sh2
-rwxr-xr-xtest/TEST-30-ISCSI/test.sh4
-rwxr-xr-xtest/TEST-40-NBD/test.sh4
-rwxr-xr-xtest/TEST-50-MULTINIC/test.sh2
36 files changed, 96 insertions, 80 deletions
diff --git a/dracut b/dracut
index c7ad360e..b0571e18 100755
--- a/dracut
+++ b/dracut
@@ -437,9 +437,6 @@ elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
exit 1
fi
-hookdirs="cmdline pre-udev pre-trigger netroot pre-mount"
-hookdirs+=" pre-pivot mount emergency"
-
[[ $TMPDIR && ! -w $TMPDIR ]] && unset TMPDIR
readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
@@ -451,7 +448,7 @@ trap 'exit 1;' SIGINT
# Need to be able to have non-root users read stuff (rpcbind etc)
chmod 755 "$initdir"
-export initdir hookdirs dracutbasedir dracutmodules drivers \
+export initdir dracutbasedir dracutmodules drivers \
fw_dir drivers_dir debug no_kernel kernel_only \
add_drivers mdadmconf lvmconf filesystems \
use_fstab libdir usrlibdir \
diff --git a/dracut-functions b/dracut-functions
index 6702222c..4409a854 100755
--- a/dracut-functions
+++ b/dracut-functions
@@ -437,6 +437,12 @@ inst() {
return 1
}
+[[ $hookdirs ]] || {
+ hookdirs="cmdline pre-udev pre-trigger netroot initqueue pre-mount"
+ hookdirs+=" pre-pivot mount emergency"
+ export hookdirs
+}
+
# install function specialized for hooks
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
@@ -449,7 +455,7 @@ inst_hook() {
derror "No such hook type $1. Aborting initrd creation."
exit 1
fi
- inst_simple "$3" "/${1}/${2}${3##*/}"
+ inst_simple "$3" "/lib/dracut/hooks/${1}/${2}${3##*/}"
}
dracut_install() {
diff --git a/modules.d/40network/dhcp-root.sh b/modules.d/40network/dhcp-root.sh
index f716bc6f..8c5d7238 100755
--- a/modules.d/40network/dhcp-root.sh
+++ b/modules.d/40network/dhcp-root.sh
@@ -21,5 +21,5 @@ if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; th
# Shut up init error check
[ -z "$root" ] && root="dhcp"
- echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > /initqueue-finished/dhcp.sh
+ echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > $hookdir/initqueue-finished/dhcp.sh
fi
diff --git a/modules.d/40network/netroot b/modules.d/40network/netroot
index 2fdb1c79..5fdfce4d 100755
--- a/modules.d/40network/netroot
+++ b/modules.d/40network/netroot
@@ -51,7 +51,8 @@ if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
# Set netroot to new_root_path, so cmdline parsers don't call
netroot=$new_root_path
- for f in ./cmdline/90*.sh; do
+ # FIXME!
+ for f in $hookdir/cmdline/90*.sh; do
[ -f "$f" ] && . "$f";
done
else
diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh
index 125e8447..b50f49d3 100755
--- a/modules.d/90crypt/parse-crypt.sh
+++ b/modules.d/90crypt/parse-crypt.sh
@@ -24,11 +24,11 @@ else
} >> /etc/udev/rules.d/70-luks.rules
printf '[ -e /dev/disk/by-uuid/*%s* ] || exit 1\n' $luksid \
- >> /initqueue-finished/90-crypt.sh
+ >> $hookdir/initqueue/finished/90-crypt.sh
{
printf '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
printf 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
- } >> /emergency/90-crypt.sh
+ } >> $hookdir/emergency/90-crypt.sh
done
else
echo 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue' \
diff --git a/modules.d/90dmsquash-live/dmsquash-live-genrules.sh b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
index 12e213bb..1128be43 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh
@@ -15,12 +15,12 @@ case "$root" in
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/}
} >> $UDEVRULESD/99-live-squash.rules
- echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
+ echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/dmsquash.sh
;;
live:*)
if [ -f "${root#live:}" ]; then
/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root "${root#live:}"
- echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
+ echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/dmsquash.sh
fi
;;
esac
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root b/modules.d/90dmsquash-live/dmsquash-live-root
index 9d83c6de..c54a46d8 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root
+++ b/modules.d/90dmsquash-live/dmsquash-live-root
@@ -191,6 +191,6 @@ if [ -n "$ROOTFLAGS" ]; then
fi
ln -s /dev/mapper/live-rw /dev/root
-printf '/bin/mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > /mount/01-$$-live.sh
+printf '/bin/mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
exit 0
diff --git a/modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh b/modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh
index f3dde77f..c05fbb90 100755
--- a/modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh
+++ b/modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh
@@ -6,5 +6,5 @@ if [ "${root%%:*}" = "liveiso" ]; then
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
${root#liveiso:}
} >> /etc/udev/rules.d/99-liveiso-mount.rules
- echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
+ echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/dmsquash.sh
fi
diff --git a/modules.d/90lvm/lvm_scan.sh b/modules.d/90lvm/lvm_scan.sh
index 3d3afcd1..fab00172 100755
--- a/modules.d/90lvm/lvm_scan.sh
+++ b/modules.d/90lvm/lvm_scan.sh
@@ -120,7 +120,7 @@ fi
if [ "$lvmwritten" ]; then
rm -f /etc/lvm/lvm.conf
- ln -s /sbin/lvm-cleanup /pre-pivot/30-lvm-cleanup.sh 2>/dev/null
- ln -s /sbin/lvm-cleanup /pre-pivot/31-lvm-cleanup.sh 2>/dev/null
+ ln -s /sbin/lvm-cleanup $hookdir/pre-pivot/30-lvm-cleanup.sh 2>/dev/null
+ ln -s /sbin/lvm-cleanup $hookdir/pre-pivot/31-lvm-cleanup.sh 2>/dev/null
fi
unset lvmwritten
diff --git a/modules.d/90lvm/parse-lvm.sh b/modules.d/90lvm/parse-lvm.sh
index 8c0c526d..5ee7f9d5 100755
--- a/modules.d/90lvm/parse-lvm.sh
+++ b/modules.d/90lvm/parse-lvm.sh
@@ -11,11 +11,11 @@ if ! getargbool 1 rd.lvm -n rd_NO_LVM; then
else
for dev in $(getargs rd.lvm.vg rd_LVM_VG=) $(getargs rd.lvm.lv rd_LVM_LV=); do
printf '[ -e "/dev/%s" ] || exit 1\n' $dev \
- >> /initqueue-finished/lvm.sh
+ >> $hookdir/initqueue/finished/lvm.sh
{
printf '[ -e "/dev/%s" ] || ' $dev
printf 'warn "LVM "%s" not found"\n' $dev
- } >> /emergency/90-lvm.sh
+ } >> $hookdir/emergency/90-lvm.sh
done
fi
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
index 57db7984..521a7e11 100644
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
@@ -28,7 +28,7 @@ LABEL="do_md_inc"
#
ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
-RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto'"
+RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto'"
GOTO="md_inc_end"
@@ -39,7 +39,7 @@ LABEL="md_auto_end"
#
RUN+="/sbin/mdadm -I $env{DEVNAME}"
-RUN+="/bin/ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh"
+RUN+="/bin/ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh"
LABEL="md_inc_end"
@@ -61,7 +61,7 @@ LABEL="do_raidstart"
# check if array is not inactive anymore
TEST=="md/array_state", ATTR{md/array_state}!="|inactive", GOTO="end_raidstart"
-RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdraid_start'"
+RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdraid_start'"
LABEL="end_raidstart"
@@ -80,6 +80,6 @@ GOTO="end_container"
LABEL="do_container"
-RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}'"
+RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}'"
LABEL="end_container"
diff --git a/modules.d/90mdraid/md_finished.sh b/modules.d/90mdraid/md_finished.sh
index 8c639d39..a06bc4f7 100755
--- a/modules.d/90mdraid/md_finished.sh
+++ b/modules.d/90mdraid/md_finished.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
-for f in /initqueue-settled/mdcontainer_start* /initqueue-settled/mdraid_start* /initqueue-settled/mdadm_auto*; do
+for f in $hookdir/initqueue/settled/mdcontainer_start* $hookdir/initqueue/settled/mdraid_start* $hookdir/initqueue/settled/mdadm_auto*; do
[ -e $f ] && return 1
done
diff --git a/modules.d/90mdraid/mdcontainer_start.sh b/modules.d/90mdraid/mdcontainer_start.sh
index 25e41c4b..f2c01521 100755
--- a/modules.d/90mdraid/mdcontainer_start.sh
+++ b/modules.d/90mdraid/mdcontainer_start.sh
@@ -7,6 +7,6 @@ md=$1
udevadm control --stop-exec-queue
# and activate any containers
mdadm -IR $md 2>&1 | vinfo
-ln -s /sbin/mdraid-cleanup /pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
-ln -s /sbin/mdraid-cleanup /pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
+ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
+ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
udevadm control --start-exec-queue
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
index 088d9b15..1c9d7fe3 100755
--- a/modules.d/90mdraid/mdraid_start.sh
+++ b/modules.d/90mdraid/mdraid_start.sh
@@ -21,6 +21,6 @@ for md in /dev/md[0-9]* /dev/md/*; do
done
unset udevinfo
-ln -s /sbin/mdraid-cleanup /pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
-ln -s /sbin/mdraid-cleanup /pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
+ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
+ln -s /sbin/mdraid-cleanup $hookdir/pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
udevadm control --start-exec-queue
diff --git a/modules.d/90mdraid/parse-md.sh b/modules.d/90mdraid/parse-md.sh
index 6cfaac35..b879b075 100755
--- a/modules.d/90mdraid/parse-md.sh
+++ b/modules.d/90mdraid/parse-md.sh
@@ -29,7 +29,7 @@ fi
if [ -e /etc/mdadm.conf ] && getargbool 1 rd.md.conf -n rd_NO_MDADMCONF; then
udevproperty rd_MDADMCONF=1
- rm -f /pre-pivot/*mdraid-cleanup.sh
+ rm -f $hookdir/pre-pivot/*mdraid-cleanup.sh
fi
if ! getargbool 1 rd.md.conf -n rd_NO_MDADMCONF; then
diff --git a/modules.d/95iscsi/iscsiroot b/modules.d/95iscsi/iscsiroot
index 03ef085a..6f7a6d23 100755
--- a/modules.d/95iscsi/iscsiroot
+++ b/modules.d/95iscsi/iscsiroot
@@ -162,10 +162,10 @@ handle_netroot()
fi
# inject new exit_if_exists
- echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > /initqueue/iscsi-settle.sh
+ echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/iscsi-settle.sh
# force udevsettle to break
- > /initqueue/work
+ > $hookdir/initqueue/work
iscsistart -i $iscsi_initiator -t $iscsi_target_name \
-g $iscsi_target_group -a $iscsi_target_ip \
@@ -178,7 +178,7 @@ handle_netroot()
# install mount script
if [ -n "${root%%block:*}" ]; then
# if root is not specified try to mount the whole iSCSI LUN
- echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > /mount/01-$$-iscsi.sh
+ echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > $hookdir/mount/01-$$-iscsi.sh
fi
}
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
index bc82050a..8fcab455 100755
--- a/modules.d/95iscsi/parse-iscsiroot.sh
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
@@ -77,5 +77,5 @@ rootok=1
# Shut up init error check
[ -z "$root" ] && root="iscsi"
-echo '[ -e /dev/root ]' > /initqueue-finished/iscsi.sh
+echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/iscsi.sh
diff --git a/modules.d/95nbd/nbdroot b/modules.d/95nbd/nbdroot
index b16b44f9..7ff7b293 100755
--- a/modules.d/95nbd/nbdroot
+++ b/modules.d/95nbd/nbdroot
@@ -96,11 +96,11 @@ nbd-client $preopts "$nbdserver" "$nbdport" /dev/nbd0 $opts || exit 1
# add the udev rules for mounting the nbd0 device
if [ ! -e /etc/udev/rules.d/99-mount.rules ]; then
echo '[ -e /dev/root ] || { info=$(udevadm info --query=env --name=/dev/nbd0); [ -z "${info%%*ID_FS_TYPE*}" ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; :; };} && rm $job;' \
- > /initqueue-settled/nbd.sh
+ > $hookdir/initqueue/settled/nbd.sh
printf '/bin/mount -t %s -o %s %s %s\n' \
"$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
- > /mount/01-$$-nbd.sh
+ > $hookdir/mount/01-$$-nbd.sh
fi
# NBD doesn't emit uevents when it gets connected, so kick it
diff --git a/modules.d/95nbd/parse-nbdroot.sh b/modules.d/95nbd/parse-nbdroot.sh
index 4edcf17a..61e5d53a 100755
--- a/modules.d/95nbd/parse-nbdroot.sh
+++ b/modules.d/95nbd/parse-nbdroot.sh
@@ -57,5 +57,5 @@ rootok=1
# Shut up init error check
[ -z "$root" ] && root="nbd"
-echo '[ -e /dev/root ]' > /initqueue-finished/nbd.sh
+echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/nbd.sh
diff --git a/modules.d/95nfs/nfsroot b/modules.d/95nfs/nfsroot
index b5d62e4b..486c0e1a 100755
--- a/modules.d/95nfs/nfsroot
+++ b/modules.d/95nfs/nfsroot
@@ -114,8 +114,8 @@ else
fi
# inject new exit_if_exists
-echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > /initqueue/nfs.sh
+echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm "$job"' > $hookdir/initqueue/nfs.sh
# force udevsettle to break
-> /initqueue/work
+> $hookdir/initqueue/work
diff --git a/modules.d/95nfs/parse-nfsroot.sh b/modules.d/95nfs/parse-nfsroot.sh
index 4d8cbdaa..35b095d4 100755
--- a/modules.d/95nfs/parse-nfsroot.sh
+++ b/modules.d/95nfs/parse-nfsroot.sh
@@ -110,4 +110,4 @@ rootok=1
# confused by having /dev/nfs[4]
root="$fstype"
-echo '[ -e $NEWROOT/proc ]' > /initqueue-finished/nfsroot.sh
+echo '[ -e $NEWROOT/proc ]' > $hookdir/initqueue/finished/nfsroot.sh
diff --git a/modules.d/95resume/resume-genrules.sh b/modules.d/95resume/resume-genrules.sh
index 92ce2fb3..06b9544d 100755
--- a/modules.d/95resume/resume-genrules.sh
+++ b/modules.d/95resume/resume-genrules.sh
@@ -33,14 +33,14 @@ if [ -n "$resume" ]; then
} >> /etc/udev/rules.d/99-resume.rules
printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm "$job"; }\n' \
- "$resume" "$resume" >> /initqueue-settled/resume.sh
+ "$resume" "$resume" >> $hookdir/initqueue/settled/resume.sh
- echo '[ -e /dev/resume ]' > /initqueue-finished/resume.sh
+ echo '[ -e /dev/resume ]' > $hookdir/initqueue/finished/resume.sh
{
printf '[ -e /dev/resume ] || '
printf 'warn "resume device "%s" not found"\n' "$resume"
- } >> /emergency/00-resume.sh
+ } >> $hookdir/emergency/00-resume.sh
elif ! getarg noresume; then
diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
index 5cda7a49..968528b7 100755
--- a/modules.d/95rootfs-block/block-genrules.sh
+++ b/modules.d/95rootfs-block/block-genrules.sh
@@ -11,7 +11,7 @@ if [ "${root%%:*}" = "block" ]; then
} >> $UDEVRULESD/99-root.rules
printf '[ -e "%s" ] && { ln -s "%s" /dev/root 2>/dev/null; rm "$job"; }\n' \
- "${root#block:}" "${root#block:}" >> /initqueue-settled/blocksymlink.sh
+ "${root#block:}" "${root#block:}" >> $hookdir/initqueue/settled/blocksymlink.sh
- echo '[ -e /dev/root ]' > /initqueue-finished/block.sh
+ echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/block.sh
fi
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index b4e00c2e..c870bd23 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -215,9 +215,16 @@ source_all() {
for f in "/$1"/*.sh; do [ -e "$f" ] && . "$f"; done
}
+hookdir=/lib/dracut/hooks
+export hookdir
+
+source_hook() {
+ source_all "/lib/dracut/hooks/$1"
+}
+
check_finished() {
local f
- for f in /initqueue-finished/*.sh; do { [ -e "$f" ] && ( . "$f" ) ; } || return 1 ; done
+ for f in $hookdir/initqueue/finished/*.sh; do { [ -e "$f" ] && ( . "$f" ) ; } || return 1 ; done
return 0
}
@@ -237,7 +244,7 @@ die() {
echo "warn dracut: FATAL: \"$@\"";
echo "warn dracut: Refusing to continue";
echo "exit 1"
- } >> /emergency/01-die.sh
+ } >> $hookdir/emergency/01-die.sh
> /.die
exit 1
@@ -305,7 +312,7 @@ udevsettle() {
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
if [ $UDEVVERSION -ge 143 ]; then
- udevadm settle --exit-if-exists=/initqueue/work $settle_exit_if_exists
+ udevadm settle --exit-if-exists=$hookdir/initqueue/work $settle_exit_if_exists
else
udevadm settle --timeout=30
fi
diff --git a/modules.d/99base/init b/modules.d/99base/init
index fcd6ad72..ffab217d 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -47,7 +47,7 @@ emergency_shell()
fi
echo ; echo
warn $@
- source_all emergency
+ source_hook emergency
echo
wait_for_loginit
[ -e /.die ] && exit 1
@@ -146,7 +146,7 @@ source_conf /etc/conf.d
# run scriptlets to parse the command line
getarg 'rd.break=cmdline' 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
-source_all cmdline
+source_hook cmdline
[ -z "$root" ] && die "No or empty root= argument"
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
@@ -163,7 +163,7 @@ source_all cmdline
# pre-udev scripts run before udev starts, and are run only once.
getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev"
-source_all pre-udev
+source_hook pre-udev
# start up udev and trigger cold plugs
udevd --daemon --resolve-names=never
@@ -180,7 +180,7 @@ getargbool 0 rd.udev.info -y rdudevinfo && udevadm control $UDEV_LOG_PRIO_ARG=in
getargbool 0 rd.udev.debug -y rdudevdebug && udevadm control $UDEV_LOG_PRIO_ARG=debug
getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
-source_all pre-trigger
+source_hook pre-trigger
# then the rest
udevadm trigger --action=add $udevtriggeropts >/dev/null 2>&1
@@ -200,11 +200,11 @@ while :; do
check_finished && break
- if [ -f /initqueue/work ]; then
- rm /initqueue/work
+ if [ -f $hookdir/initqueue/work ]; then
+ rm $hookdir/initqueue/work
fi
- for job in /initqueue/*.sh; do
+ for job in $hookdir/initqueue/*.sh; do
[ -e "$job" ] || break
job=$job . $job
check_finished && break 2
@@ -212,7 +212,7 @@ while :; do
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || continue
- for job in /initqueue-settled/*.sh; do
+ for job in $hookdir/initqueue/settled/*.sh; do
[ -e "$job" ] || break
job=$job . $job
check_finished && break 2
@@ -258,7 +258,7 @@ done
# pre-mount happens before we try to mount the root filesystem,
# and happens once.
getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
-source_all pre-mount
+source_hook pre-mount
getarg 'rd.break=mount' 'rdbreak=mount' && emergency_shell -n mount "Break mount"
@@ -267,7 +267,7 @@ getarg 'rd.break=mount' 'rdbreak=mount' && emergency_shell -n mount "Break mount
i=0
while :; do
[ -d "$NEWROOT/proc" ] && break;
- for f in /mount/*.sh; do
+ for f in $hookdir/mount/*.sh; do
[ -f "$f" ] && . "$f"
[ -d "$NEWROOT/proc" ] && break;
done
@@ -284,7 +284,7 @@ done
# pre pivot scripts are sourced just before we switch over to the new root.
getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
-source_all pre-pivot
+source_hook pre-pivot
# by the time we get here, the root filesystem should be mounted.
# Try to find init.
diff --git a/modules.d/99base/initqueue b/modules.d/99base/initqueue
index b5395512..d3f6c5dc 100755
--- a/modules.d/99base/initqueue
+++ b/modules.d/99base/initqueue
@@ -7,14 +7,14 @@
# Copyright 2008-2010, Red Hat, Inc.
# Harald Hoyer <harald@redhat.com>
-type getarg >/dev/null || . /lib/dracut-lib.sh
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
while [ $# -gt 0 ]; do
case "$1" in
--onetime)
onetime="yes";;
--settled)
- settled="-settled";;
+ settled="/settled";;
--unique)
unique="yes";;
--name)
@@ -42,6 +42,6 @@ else
echo "$@" > "/tmp/$$-${job}.sh"
fi
-mv -f "/tmp/$$-${job}.sh" "/initqueue${settled}/${job}.sh"
-[ -z "$settled" ] && >> /initqueue/work
+mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${settled}/${job}.sh"
+[ -z "$settled" ] && >> $hookdir/initqueue/work
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
index c219d8f9..5597fb38 100755
--- a/modules.d/99base/module-setup.sh
+++ b/modules.d/99base/module-setup.sh
@@ -23,10 +23,15 @@ install() {
inst "$moddir/init" "/init"
inst "$moddir/initqueue" "/sbin/initqueue"
inst "$moddir/loginit" "/sbin/loginit"
- mkdir -p ${initdir}/initqueue
- mkdir -p ${initdir}/emergency
- mkdir -p ${initdir}/initqueue-finished
- mkdir -p ${initdir}/initqueue-settled
+
+ mkdir -m 0755 -p ${initdir}/lib
+ mkdir -m 0755 -p ${initdir}/lib/dracut
+ mkdir -m 0755 -p ${initdir}/lib/dracut/hooks
+ for d in $hookdirs emergency \
+ initqueue initqueue/finished initqueue/settled; do
+ mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$d
+ done
+
mkdir -p ${initdir}/tmp
# Bail out if switch_root does not exist
if type -P switch_root >/dev/null; then
diff --git a/test/TEST-10-RAID/test.sh b/test/TEST-10-RAID/test.sh
index 280f0602..4feeb5ff 100755
--- a/test/TEST-10-RAID/test.sh
+++ b/test/TEST-10-RAID/test.sh
@@ -40,7 +40,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install sfdisk mke2fs poweroff cp umount
- inst_simple ./create-root.sh /initqueue/01create-root.sh
+ inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
@@ -63,7 +63,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install poweroff shutdown
- inst_simple ./hard-off.sh /emergency/000-hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst ./cryptroot-ask /sbin/cryptroot-ask
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
diff --git a/test/TEST-11-LVM/test.sh b/test/TEST-11-LVM/test.sh
index 0981f797..945ca1a2 100755
--- a/test/TEST-11-LVM/test.sh
+++ b/test/TEST-11-LVM/test.sh
@@ -40,7 +40,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install sfdisk mke2fs poweroff cp umount
- inst_simple ./create-root.sh /initqueue/01create-root.sh
+ inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
@@ -62,7 +62,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install poweroff shutdown
- inst_simple ./hard-off.sh /emergency/000-hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut -l -i overlay / \
diff --git a/test/TEST-12-RAID-DEG/test.sh b/test/TEST-12-RAID-DEG/test.sh
index bc03e8e4..4c23c0c6 100755
--- a/test/TEST-12-RAID-DEG/test.sh
+++ b/test/TEST-12-RAID-DEG/test.sh
@@ -75,7 +75,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install sfdisk mke2fs poweroff cp umount dd grep
- inst_simple ./create-root.sh /initqueue/01create-root.sh
+ inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
@@ -98,7 +98,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install poweroff shutdown
- inst_simple ./hard-off.sh /emergency/000-hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst ./cryptroot-ask /sbin/cryptroot-ask
mkdir -p overlay/etc
diff --git a/test/TEST-13-ENC-RAID-LVM/test.sh b/test/TEST-13-ENC-RAID-LVM/test.sh
index ff087990..bba23d6a 100755
--- a/test/TEST-13-ENC-RAID-LVM/test.sh
+++ b/test/TEST-13-ENC-RAID-LVM/test.sh
@@ -68,7 +68,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install sfdisk mke2fs poweroff cp umount grep
- inst_simple ./create-root.sh /initqueue/01create-root.sh
+ inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
@@ -97,7 +97,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install poweroff shutdown
- inst_simple ./hard-off.sh /emergency/000-hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst ./cryptroot-ask /sbin/cryptroot-ask
)
diff --git a/test/TEST-14-IMSM/test.sh b/test/TEST-14-IMSM/test.sh
index 738f8e9a..59120b58 100755
--- a/test/TEST-14-IMSM/test.sh
+++ b/test/TEST-14-IMSM/test.sh
@@ -64,7 +64,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install sfdisk mke2fs poweroff cp umount
- inst_simple ./create-root.sh /initqueue/01create-root.sh
+ inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
@@ -86,7 +86,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install poweroff shutdown
- inst_simple ./hard-off.sh /emergency/000-hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut -l -i overlay / \
diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh
index 9241a90a..6969ddc7 100755
--- a/test/TEST-20-NFS/test.sh
+++ b/test/TEST-20-NFS/test.sh
@@ -285,7 +285,7 @@ test_setup() {
mkdir overlay
. $basedir/dracut-functions
dracut_install poweroff shutdown
- inst_simple ./hard-off.sh /emergency/000-hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh
index 25ceb948..32c0d577 100755
--- a/test/TEST-30-ISCSI/test.sh
+++ b/test/TEST-30-ISCSI/test.sh
@@ -99,7 +99,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install sfdisk mke2fs poweroff cp umount
- inst_simple ./create-root.sh /initqueue/01create-root.sh
+ inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
@@ -131,7 +131,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install poweroff shutdown
- inst_simple ./hard-off.sh /emergency/000-hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
sudo $basedir/dracut -l -i overlay / \
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
index 603bdf96..3b1bf0e7 100755
--- a/test/TEST-40-NBD/test.sh
+++ b/test/TEST-40-NBD/test.sh
@@ -198,7 +198,7 @@ make_encrypted_root() {
initdir=overlay
. $basedir/dracut-functions
dracut_install mke2fs poweroff cp umount
- inst_simple ./create-root.sh /initqueue/01create-root.sh
+ inst_hook initqueue 01 ./create-root.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)
@@ -302,7 +302,7 @@ test_setup() {
initdir=overlay
. $basedir/dracut-functions
dracut_install poweroff shutdown
- inst_simple ./hard-off.sh /emergency/000-hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
inst ./cryptroot-ask /sbin/cryptroot-ask
)
diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh
index e39d5d0f..2005508d 100755
--- a/test/TEST-50-MULTINIC/test.sh
+++ b/test/TEST-50-MULTINIC/test.sh
@@ -217,7 +217,7 @@ test_setup() {
mkdir overlay
. $basedir/dracut-functions
dracut_install poweroff shutdown
- inst_simple ./hard-off.sh /emergency/000-hard-off.sh
+ inst_hook emergency 000 ./hard-off.sh
inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules
)