summaryrefslogblamecommitdiffstats
path: root/testModule/hooks/pre-mount/fetch-config.sh
blob: 5151c3b7a074c95f98a95bf737b50670c3c739ee (plain) (tree)
1
2
3

                                                    
 















                                                                       
 
                                                   





                                                                  



                                                                               
# load dracut functions
command -v getarg >/dev/null || . /lib/dracut-lib.sh

# read SLX_SERVER and SLX_BASE from the kernel command line
SLX_SERVER=$(getarg slxsrv)
SLX_BASE=$(getarg slxbase)
SLX_CONFIG_DIR="/opt/openslx"
SLX_CONFIG_FILE="/opt/openslx/config"

if [ -z "$SLX_SERVER" ]; then
	warn "No 'slxsrv' parameter found in the kernel command line!"
	warn "Skipping OpenSLX configuration..."
	exit 1
fi
if [ -z "$SLX_BASE" ]; then
	warn "No 'slxbase' parameter found in the kernel command line!"
	warn "Skipping OpenSLX configuration..."
	exit 1
fi

info "Getting configuration from OPENSLX-Server..."
WGET="$(busybox which wget)"
if [ -z $WGET ]; then
	# do nothing
	warn "'wget' not found. Skipping openslx configuration..."
	exit 1
fi

# ok then we are ready to download the config
mkdir -p "${SLX_CONFIG_DIR}"
$WGET -T 5 -q "http://${SLX_SERVER}/${SLX_BASE}/config" -O "${SLX_CONFIG_FILE}"