From 2e98b0942de05bcc2eacd41b0bbac6ab70f620f5 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 30 Apr 2015 15:29:44 +0200 Subject: working version - STILL TESTING --- testModule/hooks/cmdline.sh | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) (limited to 'testModule/hooks/cmdline.sh') diff --git a/testModule/hooks/cmdline.sh b/testModule/hooks/cmdline.sh index 340467df..c38f9ae7 100755 --- a/testModule/hooks/cmdline.sh +++ b/testModule/hooks/cmdline.sh @@ -1,29 +1,23 @@ -# Converts ip configuration format given by the pxe pre boot provider to a -# dracut compatible static ip configuration. +# giev powa +echo 1 > /proc/sys/kernel/sysrq -source /usr/lib/test-library.sh +# fakes the cmdline to fix the ip parsing when using +# syslinux's IPAPPEND 1 mask +[ -d /fake ] || mkdir /fake -for parameter in $(getargs ip=); do - local temp="$parameter:" - set -- - while [ -n "$temp" ]; do - set -- "$@" "${temp%%:*}" - temp=${temp#*:} - done +# need to be a tmpfs for the hack to work +mount -t tmpfs tmpfs /fake - [ -n "$1" ] && ip=$1 - [ -n "$2" ] && server_ip=$2 - [ -n "$3" ] && gateway_ip=$3 - [ -n "$4" ] && net_mask=$4 +# append ':hiwi:eth0:none' to the 'ip=' parameter we got +# from syslinux's IPAPPEND 1 +sed 's/\(ip=\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}:\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}:\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}:\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\)/\1:hiwi:eno1:none/' /proc/cmdline > /fake/cmdline - 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:dracut_test_client:enp0s3:none" - warn "Final dracut ip config: $final_dracut_ip_config" - replace_cmd ip "$final_dracut_ip_config" -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 -# 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 --rbind -o ro "$temporary_kernel_commandline_file_path" /proc/cmdline +# check if it worked +if ! grep 'hiwi:eth0:none' /proc/cmdline; then + command -v warn >/dev/null || . /lib/dracut-lib.sh + warn 'Haxing cmdline did not work :( sad pandaz...' +fi -- cgit v1.2.3-55-g7522