diff options
author | torben | 2016-03-24 18:55:14 +0100 |
---|---|---|
committer | torben | 2016-03-24 18:55:14 +0100 |
commit | a2f651ab7c304c366bb7589d5e5216e89ff4e4b4 (patch) | |
tree | ab0abc11cd79875a24a88293c6d991ddb35dec4e | |
parent | Improve openslx config file. (diff) | |
download | systemd-init-a2f651ab7c304c366bb7589d5e5216e89ff4e4b4.tar.gz systemd-init-a2f651ab7c304c366bb7589d5e5216e89ff4e4b4.tar.xz systemd-init-a2f651ab7c304c366bb7589d5e5216e89ff4e4b4.zip |
Improve dummy module.
-rwxr-xr-x | builder/dnbd3-rootfs/hooks/prepare-root-partition.sh | 9 | ||||
-rwxr-xr-x | dev-tools/exampleDracutModule/apply-package.sh | 37 |
2 files changed, 37 insertions, 9 deletions
diff --git a/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh b/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh index b57a915c..f97b04ce 100755 --- a/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh +++ b/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh @@ -84,15 +84,13 @@ else writable_device="$(losetup --find)" losetup "$writable_device" "$ramdisk_location" fi - - # endregion # region connect dnbd3 IFS_backup="$IFS" IFS="," return_code=1 for host in ${SLX_DNBD3_SERVERS}; do - logging.info "Trying host \"host\"." + logging.info "Trying host \"$host\"." if systemd-preserve-process-marker dnbd3-client --host "$host" --image \ "${SLX_DNBD3_IMAGE}" --device "$SLX_DNBD3_DEVICE" \ --rid "$SLX_DNBD3_RID" @@ -104,8 +102,9 @@ done IFS="$IFS_backup" if [[ $return_code != 0 ]]; then - logging.warn "Failed to connect '${SLX_DNBD3_IMAGE}' from" \ - "one of '$SLX_DNBD3_SERVERS' to '$SLX_DNBD3_DEVICE'." + logging.warn "Failed to connect \"${SLX_DNBD3_IMAGE}\" (revision" \ + "\"$SLX_DNBD3_RID\") from one of \"$SLX_DNBD3_SERVERS\" to" \ + "\"$SLX_DNBD3_DEVICE\"." exit 1 fi # endregion diff --git a/dev-tools/exampleDracutModule/apply-package.sh b/dev-tools/exampleDracutModule/apply-package.sh index 218740ef..10964a5e 100755 --- a/dev-tools/exampleDracutModule/apply-package.sh +++ b/dev-tools/exampleDracutModule/apply-package.sh @@ -1,8 +1,37 @@ #!/usr/bin/env bash # -*- coding: utf-8 -*- -source /etc/openslx +source '/usr/lib/rebash/core.sh' +core.import exceptions +core.import logging +type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh -echo -------------------------------------------------------------------------- -echo TEST -echo -------------------------------------------------------------------------- +exceptions.try +{ + logging.set_commands_level debug + logging.set_level debug + # NOTE: "getarg" raises an exception so deactivate exceptions for now. + exceptions.deactivate + slx_server="$(getarg slxsrv=)" + slx_server_base="$(getarg slxbase=)" + exceptions.activate + + logging.info 'Getting package.' + IFS_backup="$IFS" + IFS=',' + for host in ${slx_server}; do + logging.info "Trying host \"$host\"." + if wget --timeout 5 \ + "http://${host}/${slx_server_base}config.tar.gz" \ + --output-document '/tmp/config.tar.gz' + then + break + fi + done + IFS="$IFS_backup" +} +exceptions.catch +{ + logging.error "$exceptions_last_traceback" + emergency_shell "error in ${BASH_SOURCE[0]}" +} |