summaryrefslogtreecommitdiffstats
path: root/modules.d/98dracut-systemd/dracut-pre-udev.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:54:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:54:25 +0000
commit9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a (patch)
tree2efb72864cc69e174c9c5ee33efb88a5f1553b48 /modules.d/98dracut-systemd/dracut-pre-udev.sh
parentInitial commit. (diff)
downloaddracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.tar.xz
dracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.zip
Adding upstream version 060+5.upstream/060+5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/98dracut-systemd/dracut-pre-udev.sh')
-rwxr-xr-xmodules.d/98dracut-systemd/dracut-pre-udev.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/modules.d/98dracut-systemd/dracut-pre-udev.sh b/modules.d/98dracut-systemd/dracut-pre-udev.sh
new file mode 100755
index 0000000..feab32c
--- /dev/null
+++ b/modules.d/98dracut-systemd/dracut-pre-udev.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+export DRACUT_SYSTEMD=1
+if [ -f /dracut-state.sh ]; then
+ . /dracut-state.sh 2> /dev/null
+fi
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
+
+source_conf /etc/conf.d
+
+make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab'
+# pre pivot scripts are sourced just before we doing cleanup and switch over
+# to the new root.
+getarg 'rd.break=pre-udev' 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev"
+source_hook pre-udev
+
+_modprobe_d=/etc/modprobe.d
+if [ -d /usr/lib/modprobe.d ]; then
+ _modprobe_d=/usr/lib/modprobe.d
+elif [ -d /lib/modprobe.d ]; then
+ _modprobe_d=/lib/modprobe.d
+elif [ ! -d $_modprobe_d ]; then
+ mkdir -p $_modprobe_d
+fi
+
+for i in $(getargs rd.driver.pre -d rdloaddriver=); do
+ (
+ IFS=,
+ for p in $i; do
+ modprobe "$p" 2>&1 | vinfo
+ done
+ )
+done
+
+[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
+
+for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
+ (
+ IFS=,
+ for p in $i; do
+ echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
+ done
+ )
+done
+
+for p in $(getargs rd.driver.post -d rdinsmodpost=); do
+ echo "blacklist $p" >> $_modprobe_d/initramfsblacklist.conf
+ _do_insmodpost=1
+done
+
+[ -n "$_do_insmodpost" ] && initqueue --settled --unique --onetime insmodpost.sh
+unset _do_insmodpost _modprobe_d
+unset i
+
+export -p > /dracut-state.sh
+exit 0