summaryrefslogtreecommitdiffstats
path: root/testModule/hooks/pre-mount
diff options
context:
space:
mode:
Diffstat (limited to 'testModule/hooks/pre-mount')
-rwxr-xr-xtestModule/hooks/pre-mount/fetch-config.sh12
-rwxr-xr-xtestModule/hooks/pre-mount/mount-qcow.sh49
2 files changed, 61 insertions, 0 deletions
diff --git a/testModule/hooks/pre-mount/fetch-config.sh b/testModule/hooks/pre-mount/fetch-config.sh
new file mode 100755
index 00000000..013b0058
--- /dev/null
+++ b/testModule/hooks/pre-mount/fetch-config.sh
@@ -0,0 +1,12 @@
+command -v info >/dev/null || . /lib/dracut-lib.sh
+
+info "Getting configuration from OPENSLX-Server..."
+
+WGET="$(busybox which wget)"
+if [ -z $WGET ]; then
+ # do nothing
+ warn "'wget' not found. Skipping openslx configuration..."
+ exit 1
+fi
+mkdir -p /opt/openslx
+$WGET http://10.4.9.51/openslx/config -O /opt/openslx/config
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
+###############################################################################