summaryrefslogtreecommitdiffstats
path: root/testModule/hooks/pre-udev.sh
diff options
context:
space:
mode:
authortorben2015-05-04 13:57:16 +0200
committertorben2015-05-04 13:57:16 +0200
commit0ddd93e6daec1c2eadb025bbc7ab90b9e865516c (patch)
tree58d84520e5a7f802f1fc0abdca7933f47c4d5b4d /testModule/hooks/pre-udev.sh
parentPepare merge. (diff)
parentworking version - STILL TESTING (diff)
downloadsystemd-init-0ddd93e6daec1c2eadb025bbc7ab90b9e865516c.tar.gz
systemd-init-0ddd93e6daec1c2eadb025bbc7ab90b9e865516c.tar.xz
systemd-init-0ddd93e6daec1c2eadb025bbc7ab90b9e865516c.zip
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
Diffstat (limited to 'testModule/hooks/pre-udev.sh')
-rwxr-xr-xtestModule/hooks/pre-udev.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/testModule/hooks/pre-udev.sh b/testModule/hooks/pre-udev.sh
new file mode 100755
index 00000000..578169e9
--- /dev/null
+++ b/testModule/hooks/pre-udev.sh
@@ -0,0 +1,44 @@
+#!/usr/bin/bash
+
+# include dracut-lib.sh to use 'warn'
+command -v warn >/dev/null || . /lib/dracut-lib.sh
+
+SETUP_SCRIPT="/sbin/setup-qcow2"
+NBDROOT_SCRIPT="/sbin/setup-nbdroot"
+NBD_MOD_PATH="/usr/lib/modules/current/extra/nbd.ko"
+DNBD3_MOD_PATH="/usr/lib/modules/current/extra/dnbd3.ko"
+
+# sanity checks
+if [ ! -e "${SETUP_SCRIPT}" ]; then
+ warn "No such file of directory: ${SETUP_SCRIPT}"
+ emergency_shell -n "Error in $0"
+ return 1
+fi
+if [ ! -e "${NBD_MOD_PATH}" ]; then
+ warn "No such file of directory: ${NBD_MOD_PATH}"
+ emergency_shell -n "Error in $0"
+ return 1
+fi
+if [ ! -e "${DNBD3_MOD_PATH}" ]; then
+ warn "No such file of directory: ${DNBD3_MOD_PATH}"
+ emergency_shell -n "Error in $0"
+ return 1
+fi
+
+# load the kernel modules for dnbd3 and nbd
+if ! insmod /usr/lib/modules/current/extra/dnbd3.ko; then
+ warn "Failed to load DNBD3 kernel module..."
+ emergency_shell -n "Error in $0"
+ return 1
+fi
+
+if ! insmod /usr/lib/modules/current/extra/nbd.ko; then
+ warn "Failed to load NBD kernel module..."
+ emergency_shell -n "Error in $0"
+ return 1
+fi
+
+# now let's "install" the setup script in the initqueue
+#/sbin/initqueue --settled --unique "${SETUP_SCRIPT}"
+#/sbin/initqueue --settled --unique "${NBDROOT_SCRIPT}"
+#/sbin/initqueue --settled --unique "/sbin/retry-nbdroot"