summaryrefslogtreecommitdiffstats
path: root/testModule/hooks/pre-udev/load-dnbd3-nbd-modules.sh
diff options
context:
space:
mode:
authorJonathan Bauer2015-05-06 18:13:52 +0200
committerJonathan Bauer2015-05-06 18:13:52 +0200
commitb3312f86061a0d887233f5068cbc335aa2612bed (patch)
tree32a0bace5eb6a7afeb29dae80d7f01fefecb36cc /testModule/hooks/pre-udev/load-dnbd3-nbd-modules.sh
parentMerge branch 'master' of git.openslx.org:openslx-ng/systemd-init (diff)
downloadsystemd-init-b3312f86061a0d887233f5068cbc335aa2612bed.tar.gz
systemd-init-b3312f86061a0d887233f5068cbc335aa2612bed.tar.xz
systemd-init-b3312f86061a0d887233f5068cbc335aa2612bed.zip
current state: udev disk detection still not done!
also improved module structure and code commentary
Diffstat (limited to 'testModule/hooks/pre-udev/load-dnbd3-nbd-modules.sh')
-rwxr-xr-xtestModule/hooks/pre-udev/load-dnbd3-nbd-modules.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/testModule/hooks/pre-udev/load-dnbd3-nbd-modules.sh b/testModule/hooks/pre-udev/load-dnbd3-nbd-modules.sh
new file mode 100755
index 00000000..29f9f210
--- /dev/null
+++ b/testModule/hooks/pre-udev/load-dnbd3-nbd-modules.sh
@@ -0,0 +1,32 @@
+# include dracut-lib.sh to use 'warn'
+command -v warn >/dev/null || . /lib/dracut-lib.sh
+
+NBD_MOD_PATH="/usr/lib/modules/current/extra/nbd.ko"
+DNBD3_MOD_PATH="/usr/lib/modules/current/extra/dnbd3.ko"
+
+# do we actually have our modules?
+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 "${DNBD3_MOD_PATH}"; then
+ warn "Failed to load DNBD3 kernel module..."
+ emergency_shell -n "Error in $0"
+ return 1
+fi
+
+if ! insmod "${NBD_MOD_PATH}"; then
+ warn "Failed to load NBD kernel module..."
+ emergency_shell -n "Error in $0"
+ return 1
+fi
+
+return 0