diff options
Diffstat (limited to 'testModule/parse-ip.sh')
| -rw-r--r-- | testModule/parse-ip.sh | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/testModule/parse-ip.sh b/testModule/parse-ip.sh index 07f61d50..75fca7b2 100644 --- a/testModule/parse-ip.sh +++ b/testModule/parse-ip.sh @@ -1,3 +1,37 @@ +# Converts ip configuration format given by the pxe pre boot provider to a +# dracut compatible static ip configuration. + +temporary_kernel_commandline_file_path='/temporary_kernel_commandline.txt' +warn +warn 'Running ip kernel command line transformation.' +warn + for parameter in $(getargs ip=); do - COMMAND_LINE_IP="$parameter" + set -- + while [ -n "$parameter" ]; do + set -- "$@" "${parameter%%:*}" + parameter=${parameter#*:} + warn + warn JAU + warn + done + + [ -n "$1" ] && ip=$1 + [ -n "$2" ] && server_ip=$2 + [ -n "$3" ] && broadcast_ip=$3 + [ -n "$4" ] && net_mask=$4 + + warn + warn "PXE given net configuration: ip: $ip server_ip: $server_ip broadcast_ip: $broadcast_ip net_mask: $net_mask" + warn + # TODO + gateway_ip="$broadcast_ip" + echo "ip=$ip::$gateway_ip:$net_mask:dracut_test_client:enp0s3:none" > /etc/cmdline + warn + warn "Converted ip configuration: \"$ip\"." + warn done + +#cat /proc/cmdline | sed --regexp-extended 's/ ip=[^ ]+//g' \ +# >"$temporary_kernel_commandline_file_path" && \ +#mount -n --bind -o ro "$temporary_kernel_commandline_file_path" /proc/cmdline |
