summaryrefslogtreecommitdiffstats
path: root/testModule/hooks/pre-mount
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-mount
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-mount')
-rwxr-xr-xtestModule/hooks/pre-mount/mount-qcow.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/testModule/hooks/pre-mount/mount-qcow.sh b/testModule/hooks/pre-mount/mount-qcow.sh
new file mode 100755
index 00000000..d70492bf
--- /dev/null
+++ b/testModule/hooks/pre-mount/mount-qcow.sh
@@ -0,0 +1,49 @@
+###############################################################################
+# CHECKS
+#
+
+SETUP_ROOTFS_SCRIPT="/sbin/setup-qcow2"
+
+if [ ! -e "${SETUP_ROOTFS_SCRIPT}" ]; then
+ warn "No such file of directory: ${SETUP_ROOTFS_SCRIPT}"
+ emergency_shell -n "Error in $0"
+ return 1
+fi
+
+if [ ! -x "${SETUP_ROOTFS_SCRIPT}" ]; then
+ warn "Cannot execute: ${SETUP_ROOTFS_SCRIPT}"
+ emergency_shell -n "Error in $0"
+ return 1
+fi
+
+#
+# END CHECKS
+###############################################################################
+
+###############################################################################
+# MAIN CODE
+#
+
+# ok, let's source the setup script
+if ! . ${SETUP_ROOTFS_SCRIPT} ; then
+ warn "Could not source: ${SETUP_ROOTFS_SCRIPT}"
+ emergency_shell -n "Error in $0"
+ return 1
+fi
+
+# just go over the functions in the right order ;-)
+for fun in connect_dnbd3 create_qcow export_qcow connect_qcow; do
+ if ! $fun; then
+ # something failed, drop a shell for debugging
+ warn "'$fun' failed with: $?"
+ emergency_shell -n "Error in $fun"
+ return 1
+ fi
+done
+
+# all good, we are done
+return 0
+
+#
+# END MAIN CODE
+###############################################################################