blob: 61174a3ff15b531066c270077e993b7e47812994 (
plain) (
tree)
|
|
#!/usr/bin/env bash
# region imports
type getarg >/dev/null 2>&1 || source /lib/dracut-lib.sh
source "/usr/lib/rebash/core.sh"
core.import exceptions
exceptions.activate
core.import utils
core.import logging
# endregion
( # subshell for variable scoping
logging.set_commands_level debug
logging.set_level debug
configuration_file_name="$(getargs slx_configuration_filename=)"
if [ -z "$configuration_file_name" ]; then
configuration_file_name='config'
fi
slx_server="$(getargs slxsrv=)"
slx_server_base="$(getargs slxbase=)"
logging.info 'Getting configuration file.'
IFS_backup="$IFS"
IFS=','
for host in ${slx_server}; do
logging.info "Trying host \"$host\"."
if wget --timeout 5 "http://${host}/${slx_server_base}${configuration_file_name}" \
--output-document "/etc/openslx"; then
break
fi
done
IFS="$IFS_backup"
if [[ ! -e "/etc/openslx" ]]; then
logging.warn "Downloading OpenSLX configuration file from any of the servers \"${slx_server}\" at location \"${slx_server_base}${configuration_file_name}\" failed. Return code: $return_code"
exit 1
fi
) || exit $?
exceptions.deactivate
# region vim modline
# vim: set tabstop=4 shiftwidth=4 expandtab:
# vim: foldmethod=marker foldmarker=region,endregion:
# endregion
|