diff options
| author | torben | 2015-05-07 23:33:05 +0200 |
|---|---|---|
| committer | torben | 2015-05-07 23:33:05 +0200 |
| commit | ab7c2b5e09247b6b4935c11051f25a1114afad8d (patch) | |
| tree | 1399ea9eb29806e2bd1929abed6855b82cd726f6 /testModule/hooks/pre-mount | |
| parent | Improve docu. (diff) | |
| parent | started configuration stuff (diff) | |
| download | systemd-init-ab7c2b5e09247b6b4935c11051f25a1114afad8d.tar.gz systemd-init-ab7c2b5e09247b6b4935c11051f25a1114afad8d.tar.xz systemd-init-ab7c2b5e09247b6b4935c11051f25a1114afad8d.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
Diffstat (limited to 'testModule/hooks/pre-mount')
| -rwxr-xr-x | testModule/hooks/pre-mount/fetch-config.sh | 12 | ||||
| -rwxr-xr-x | testModule/hooks/pre-mount/mount-qcow.sh | 49 |
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 +############################################################################### |
