blob: 9f617b09f404b8c0e10f9efbe6a1f16bf95bf1bb (
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
|
command -v warn >/dev/null || . /lib/dracut-lib.sh
# fakes the cmdline to fix the ip parsing in darcut's net-lib.sh
[ -d /fake ] || mkdir /fake
# need to be a tmpfs for the hack to work
mount -t tmpfs tmpfs /fake
for parameter in $(getargs ip=); do
local temp="$parameter:"
set --
while [ -n "$temp" ]; do
set -- "$@" "${temp%%:*}"
temp=${temp#*:}
done
[ -n "$1" ] && ip=$1
[ -n "$2" ] && server_ip=$2
[ -n "$3" ] && gateway_ip=$3
[ -n "$4" ] && net_mask=$4
warn "PXE given net configuration: ip: $ip server_ip: $server_ip gateway_ip: $gateway_ip net_mask: $net_mask"
local final_dracut_ip_config="$ip::$gateway_ip:$net_mask:hiwi-test-28:eno1:none"
warn "Final dracut ip config: $final_dracut_ip_config"
sed --regexp-extended "s/ip=[^ ]*/ip=$final_dracut_ip_config/g" /proc/cmdline > /fake/cmdline
done
# bind mount it. Can we trust mount return codes here?
# # if so, we should check what we get in $?
mount -o bind /fake/cmdline /proc/cmdline
# check if it worked
if ! grep 'hiwi-test-28:eno1:none' /proc/cmdline; then
warn 'Haxing cmdline did not work :( sad pandaz...'
fi
|