]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Move all hooks to "$hookdir"
authorHarald Hoyer <harald@redhat.com>
Fri, 25 Mar 2011 12:31:34 +0000 (13:31 +0100)
committerHarald Hoyer <harald@redhat.com>
Fri, 25 Mar 2011 15:10:46 +0000 (16:10 +0100)
hookdir=/lib/dracut/hooks for now, to keep the root directory clean

36 files changed:
dracut
dracut-functions
modules.d/40network/dhcp-root.sh
modules.d/40network/netroot
modules.d/90crypt/parse-crypt.sh
modules.d/90dmsquash-live/dmsquash-live-genrules.sh
modules.d/90dmsquash-live/dmsquash-live-root
modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh
modules.d/90lvm/lvm_scan.sh
modules.d/90lvm/parse-lvm.sh
modules.d/90mdraid/65-md-incremental-imsm.rules
modules.d/90mdraid/md_finished.sh
modules.d/90mdraid/mdcontainer_start.sh
modules.d/90mdraid/mdraid_start.sh
modules.d/90mdraid/parse-md.sh
modules.d/95iscsi/iscsiroot
modules.d/95iscsi/parse-iscsiroot.sh
modules.d/95nbd/nbdroot
modules.d/95nbd/parse-nbdroot.sh
modules.d/95nfs/nfsroot
modules.d/95nfs/parse-nfsroot.sh
modules.d/95resume/resume-genrules.sh
modules.d/95rootfs-block/block-genrules.sh
modules.d/99base/dracut-lib.sh
modules.d/99base/init
modules.d/99base/initqueue
modules.d/99base/module-setup.sh
test/TEST-10-RAID/test.sh
test/TEST-11-LVM/test.sh
test/TEST-12-RAID-DEG/test.sh
test/TEST-13-ENC-RAID-LVM/test.sh
test/TEST-14-IMSM/test.sh
test/TEST-20-NFS/test.sh
test/TEST-30-ISCSI/test.sh
test/TEST-40-NBD/test.sh
test/TEST-50-MULTINIC/test.sh

diff --git a/dracut b/dracut
index c7ad360e01f8f049a2bb8e295261b05c4d45567a..b0571e18e0e1cd33841f6a7ed9b7bf530dfa5943 100755 (executable)
--- 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 \
index 6702222c8c2edbb87c080a3141cfe2deda8d7d12..4409a8547679567ff7532dcbc7375ebf8ca1c1a0 100755 (executable)
@@ -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() {
index f716bc6f859d8b00272039bb8089aaa611b2a560..8c5d7238fe03b713e8eae3a371eeff73d0a39a84 100755 (executable)
@@ -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
index 2fdb1c796b37a5ec948a2aaa8e49b60015b72eca..5fdfce4d5a509b2e7e36af7823d44a9c2855864a 100755 (executable)
@@ -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 
index 125e84474529519ebb8e63110209262d6333ad2b..b50f49d367ce83004de376c2bc28c3279fd7af16 100755 (executable)
@@ -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' \
index 12e213bb15941c8ddc968b465928b94b2e6cc2eb..1128be43d56e5b8f04be01395eb509b565d48724 100755 (executable)
@@ -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
index 9d83c6deafac39ce2ee887eb003006ea99a70d1e..c54a46d862974ffbc8c969766ebc32e49fdc6da2 100755 (executable)
@@ -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
index f3dde77f8039b9c98ecd6b41817e32c9be811e3c..c05fbb90a53bbf599c7e0e668493c94497ee238a 100755 (executable)
@@ -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
index 3d3afcd1bb4c2febdc7d89f5abc8bb644cfc6a51..fab0017203516de44b1922b628a02b0ff712af19 100755 (executable)
@@ -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
index 8c0c526d67dd6e71b418aa82a217789a64c19fd6..5ee7f9d5ea36d6cca7a672be50bef44f19a5e33a 100755 (executable)
@@ -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
 
index 57db798444cf4b11eb574119baeaa08e387226c8..521a7e11a8d24769dd7de92a68fd0e212ea03008 100644 (file)
@@ -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"
index 8c639d396289283973c2d8a15c128a09fa3fa29e..a06bc4f7fb0967fd362a25781804296c13e1be57 100755 (executable)
@@ -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
 
index 25e41c4b31ed8e5594f292814adda74499b59573..f2c0152123df942a0bbd3541aa87d321b9d7a784 100755 (executable)
@@ -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
index 088d9b15dedb9aad12df24536aa743dc2250011d..1c9d7fe3b8c57dae2b758d8f6659bd25f7c22c0f 100755 (executable)
@@ -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
index 6cfaac35504c834f7583c06d3770a40e79d33142..b879b075c9c399063763ce0b7c6c623b7a651884 100755 (executable)
@@ -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
index 03ef085ac91e3e2e5d8b110b3eaaa50289eb656d..6f7a6d239e73349a94c82fc1e348910ca2efbeda 100755 (executable)
@@ -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
 }
 
index bc82050ad327e789209da9878c8bd613e38ede1e..8fcab45547cf0897676b4d55e6a3781b653351d7 100755 (executable)
@@ -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
 
index b16b44f9598cb6d500a1ad97115780ed659b7205..7ff7b2939daf15013f7e9a5918be47a4b0b87204 100755 (executable)
@@ -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
index 4edcf17ac9cbc9a3b84a932a4fe0fc2906f0d821..61e5d53a035385527b620c7876e0dbb0b316308c 100755 (executable)
@@ -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
 
index b5d62e4b304d98e96cbc52cb879ea6f2f0172805..486c0e1a126421c8610692397a16831f1c132a6d 100755 (executable)
@@ -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
 
 
index 4d8cbdaada88a71935a5d521aec00d85d164f42d..35b095d44afb71dbef995225cec49816f773b39a 100755 (executable)
@@ -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
index 92ce2fb334cc2d5ce62c35417c4d2d5119813788..06b9544d8891ba57132cba0c8dd119bd47a960e5 100755 (executable)
@@ -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
index 5cda7a496dd48841ce51954374695a62123c54b5..968528b74309fc7ed1599af097e7785ad23be57e 100755 (executable)
@@ -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
index b4e00c2efaf70063ed5aa632d58f0eb8f67c8131..c870bd2385b71ca82cace98bb2d0658254589baa 100755 (executable)
@@ -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
index fcd6ad7250bd724be1fa52c2633004fc5453eee6..ffab217d95d374af6db2ccc08bd45ed1fa74c02b 100755 (executable)
@@ -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.
index b5395512a3084b9855b17f93647c56cb6ceb262c..d3f6c5dcbf4855670da9bd35ec53c437e416854b 100755 (executable)
@@ -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
 
index c219d8f9700bec6cadeaff929253253eba58545d..5597fb384271c06ec24e3fe2fa14a19be75acd2e 100755 (executable)
@@ -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
index 280f0602be85963ccda2735e8e90d1e8c92f9288..4feeb5fff97a605229275accd4aa169e2a97b763 100755 (executable)
@@ -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
     )
index 0981f797e9441076399af5f01c0aa5e51c7d4efa..945ca1a20ca23a3d0c4fa7998ff20eb26272fe96 100755 (executable)
@@ -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 / \
index bc03e8e4af787ed49a50368d5848f943544aa539..4c23c0c6a0d5b2ee557539c3eba8fa5928ba4e98 100755 (executable)
@@ -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
index ff0879908536583dfedce00c57a308ec4e463158..bba23d6a4f9ec4914cbc569eb4db97379fab89ed 100755 (executable)
@@ -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
     )
index 738f8e9a59d62376b6dbbdce2c1dea52295ada3f..59120b582311cd6f3497b0f271c4a4b33455bde5 100755 (executable)
@@ -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 / \
index 9241a90a47e930725ffd78753e6b06209ec702cc..6969ddc7fae4ec8f8203e14ec3819e0cd3d4b66d 100755 (executable)
@@ -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
     )
 
index 25ceb948d9415acd927b1caa46e56d01983a1830..32c0d5772cbbbaa91f00478d3ff6383710978923 100755 (executable)
@@ -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 / \
index 603bdf96117daf78820d44ae1152ee138406ba77..3b1bf0e749dbd3812eff8ba7b2c64d35dd1368da 100755 (executable)
@@ -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
     )
index e39d5d0fe561127cf89b6eb199437ee3bcea732e..2005508dc9b74dd03d4c23360c0ed352499926db 100755 (executable)
@@ -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
     )