blob: 079d45beabee2ae9826f8a5fd4ae6495f684c57f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
source '/usr/lib/rebash/core.sh'
core.import exceptions
core.import logging
type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
exceptions.try
{
# NOTE: "getarg" raises an exception so deactivate exceptions for now.
exceptions.deactivate
slx_server="$(getarg slxsrv=)"
slx_server_base="$(getarg slxbase=)"
exceptions.activate
if [ -z "$SLX_NO_CONFIG_TGZ" ]; then
# build config.tgz url
conftgz_url="http://${slx_server#@}/${slx_server_base}/config.tgz"
# check if system's uuid was set
if [ -s "/run/system-uuid" ]; then
uuid="$(cat /run/system-uuid)"
if [ -n "$uuid" ]; then
conftgz_url="${conftgz_url}?uuid=${uuid}"
fi
fi
logging.info "Download config.tgz from '$conftgz_url'..."
slx-tools download_retry -s "${conftgz_url}" > "/etc/config.tgz"
if [[ ! -s "/etc/config.tgz" ]]; then
logging.warn \
"Downloading 'config.tgz' from '${slx_server}' failed with: $return_code"
return 1
fi
fi
}
exceptions.catch
{
logging.error "$exceptions_last_traceback"
emergency_shell "error in ${BASH_SOURCE[0]}"
}
|