From a2f651ab7c304c366bb7589d5e5216e89ff4e4b4 Mon Sep 17 00:00:00 2001 From: torben Date: Thu, 24 Mar 2016 18:55:14 +0100 Subject: Improve dummy module. --- dev-tools/exampleDracutModule/apply-package.sh | 37 +++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'dev-tools') 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]}" +} -- cgit v1.2.3-55-g7522