From 3541f12849b277a2405a4d3bf692cf62f2045126 Mon Sep 17 00:00:00 2001 From: torben Date: Thu, 9 Apr 2015 03:27:39 +0200 Subject: Adding functions library. --- testModule/parse-ip.sh | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'testModule/parse-ip.sh') diff --git a/testModule/parse-ip.sh b/testModule/parse-ip.sh index 75fca7b2..2f720c57 100644 --- a/testModule/parse-ip.sh +++ b/testModule/parse-ip.sh @@ -1,19 +1,12 @@ # 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 + local temp="$parameter:" set -- - while [ -n "$parameter" ]; do - set -- "$@" "${parameter%%:*}" - parameter=${parameter#*:} - warn - warn JAU - warn + while [ -n "$temp" ]; do + set -- "$@" "${temp%%:*}" + temp=${temp#*:} done [ -n "$1" ] && ip=$1 @@ -21,17 +14,14 @@ for parameter in $(getargs ip=); do [ -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 + local gateway_ip="$broadcast_ip" + repace_cmd test "$ip::$gateway_ip:$net_mask:dracut_test_client:enp0s3:none" done -#cat /proc/cmdline | sed --regexp-extended 's/ ip=[^ ]+//g' \ +# NOTE: Doesn't work since dracuts needed version of mount doesn't support +# binds. +#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 +#mount -n --rbind -o ro "$temporary_kernel_commandline_file_path" /proc/cmdline -- cgit v1.2.3-55-g7522