blob: ba2fea8fc039963d55d4dbe387fe42137ce9d315 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#!/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=*) # TODO: Still working? Still needed? Also see related code in setup_stage32
NFS=${opts#nfs=}
NFSPATH=${NFS#*:}
NFSSERVER=${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
|