diff options
| author | torben | 2015-04-09 02:02:46 +0200 |
|---|---|---|
| committer | torben | 2015-04-09 02:02:46 +0200 |
| commit | 46dfa60a5faf8c460143beabb9592588abed3902 (patch) | |
| tree | 3842b8b856741ffb54aa0acad68ea8c85f5ff742 /testModule/parse-ip.sh | |
| parent | Remove old approach to get internet. Adding command line parsing for (diff) | |
| download | systemd-init-46dfa60a5faf8c460143beabb9592588abed3902.tar.gz systemd-init-46dfa60a5faf8c460143beabb9592588abed3902.tar.xz systemd-init-46dfa60a5faf8c460143beabb9592588abed3902.zip | |
Trying convert given pxe ip configuration to dracut compatible one.
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 |
