blob: 2eb722a68774a61a792fc284f46173cd6e47224e (
plain) (
tree)
|
|
#!/bin/ash
getip () {
echo "${IPINFO}" | awk -F ':' "{print \$$1}"
}
parse_ip () {
local IPINFO=$1
export ip="$(getip 1)"
SERVERIP="$(getip 2)"
export router="$(getip 3)"
export subnet="$(getip 4)"
# we might have an idea of the dns server via preboot
export dns="$(getip 5)"
}
parse_ipv4 () {
local var arg
var="${1%%=*}"
case "$var" in
ip|router|dns|hostname|domain|search|if|ntpsrv|subnet) ;;
*) return ;;
esac
arg="$( printf "%s" "${1#*=}" | tr -d "\`'\n\r" )"
export "$var=${arg}"
}
# read kernel command line
DEBUG=0
SPLASH=0
read -r KCL < "/proc/cmdline"
for opts in ${KCL}; do
case "${opts}" in
debug=*)
DEBUG=${opts#debug=}
DEBUG_SHELL=set
;;
ipv4.*)
parse_ipv4 "${opts#ipv4.}"
;;
ip=*)
# process IP info
parse_ip ${opts#ip=} ;;
nfs=*)
NFS=${opts#nfs=}
;;
BOOTIF=*)
MAC="$( echo "$opts" | cut -b 11- | tr '-' ':' | tr '[A-Z]' '[a-z]' )" ;; # make mac lowercase for udev (see setup_network)
slxsrv=*)
SLX_KCL_SERVERS="$( echo "${opts#slxsrv=}" | tr ',' " " )" ;;
slxbase=*)
SLX_BASE_PATH="${opts#slxbase=}" ;;
splash)
SPLASH=1 ;;
nvidia)
GFX=nvidia ;;
amdgpu)
GFX=amdgpu ;;
radeon)
GFX=radeon ;;
dhcpuuid)
USE_DHCP_UUID=yes
echo "SLX_NET_DHCP_UUID='yes'" >> "/run/config"
;;
esac
done
dns="${dns//,/ }"
search="${search//,/ }"
ntpsrv="${ntpsrv//,/ }"
[ -z "$MAC" ] && MAC="${if//-/:}"
# If slxsrv was not given on command line, just use the PXE server's address
[ -z "$SLX_KCL_SERVERS" ] && [ -n "$SERVERIP" ] && SLX_KCL_SERVERS="$SERVERIP"
# Reverse case
[ -z "$SERVERIP" ] && SERVERIP="${SLX_KCL_SERVERS%% *}"
# Now save to config file
echo "SLX_KCL_SERVERS='$SLX_KCL_SERVERS'" >> "${FUTURE_ROOT}/opt/openslx/config"
echo "SLX_BASE_PATH='$SLX_BASE_PATH'" >> "${FUTURE_ROOT}/opt/openslx/config"
true
|