summaryrefslogtreecommitdiffstats
path: root/dev-tools
diff options
context:
space:
mode:
authortorben2016-03-24 18:55:14 +0100
committertorben2016-03-24 18:55:14 +0100
commita2f651ab7c304c366bb7589d5e5216e89ff4e4b4 (patch)
treeab0abc11cd79875a24a88293c6d991ddb35dec4e /dev-tools
parentImprove openslx config file. (diff)
downloadsystemd-init-a2f651ab7c304c366bb7589d5e5216e89ff4e4b4.tar.gz
systemd-init-a2f651ab7c304c366bb7589d5e5216e89ff4e4b4.tar.xz
systemd-init-a2f651ab7c304c366bb7589d5e5216e89ff4e4b4.zip
Improve dummy module.
Diffstat (limited to 'dev-tools')
-rwxr-xr-xdev-tools/exampleDracutModule/apply-package.sh37
1 files changed, 33 insertions, 4 deletions
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]}"
+}