diff options
Diffstat (limited to 'builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh')
-rwxr-xr-x | builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh b/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh index 19737eaa..93713edd 100755 --- a/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh +++ b/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh @@ -1,3 +1,5 @@ +SLX_INITIAL_KERNEL_COMMAND_LINE="$(cat /proc/cmdline)" + # This location will be used to have a writable kernel command line file # location. local writeable_proc_cmdline_path='/writable_proc_cmdline/' @@ -5,8 +7,24 @@ mkdir --parents "$writeable_proc_cmdline_path" # NOTE: The fake writeable overlay have to be a temporary filesystem for the # hack to work. mount --types tmpfs tmpfs "$writeable_proc_cmdline_path" +echo "$SLX_INITIAL_KERNEL_COMMAND_LINE" > \ + "${writeable_proc_cmdline_path}/cmdline" + +echo \ + '-----------------------Kernel-Command-Line:---------------------------' \ + "$SLX_INITIAL_KERNEL_COMMAND_LINE" \ + '----------------------------------------------------------------------' local parameter +for parameter in $(getargs BOOTIF=); do + info "PXE given boot interface $parameter" + local dracut_interface_name="bootnet:$(echo $parameter | sed --regexp-extended \ + 's/[0-9]{2}-(([0-9]{2}-){5}[0-9]{2})/\1/' | sed s/-/:/g)" + info "Dracut interface name is: $dracut_interface_name" + echo " ifname=$dracut_interface_name" >> \ + "${writeable_proc_cmdline_path}cmdline" +done +local parameter for parameter in $(getargs ip=); do local temp="$parameter:" set -- @@ -21,16 +39,18 @@ for parameter in $(getargs ip=); do [ -n "$4" ] && net_mask=$4 info "PXE given net configuration: ip: $ip server_ip: $server_ip gateway_ip: $gateway_ip net_mask: $net_mask" - # TODO arch needs enp0s3 and ubuntu needs eth0 here! - local final_dracut_ip_configuration="$ip::$gateway_ip:$net_mask::enp0s3:off" - info "Final dracut ip configuration is: $final_dracut_ip_configuration" - sed --regexp-extended "s/ip=[^ ]*/ip=$final_dracut_ip_configuration/g" \ - /proc/cmdline > "${writeable_proc_cmdline_path}cmdline" + local dracut_ip_configuration="$ip::$gateway_ip:$net_mask::bootnet:off" + info "Dracut ip configuration is: $dracut_ip_configuration" + sed --regexp-extended "s/ip=[^ ]*/ip=$dracut_ip_configuration/g" \ + --in-place "${writeable_proc_cmdline_path}cmdline" done -if [ -z "$final_dracut_ip_configuration" ]; then +if [ -z "$dracut_ip_configuration" ]; then warn 'No "ip" parameter found in the kernel command line.' fi +if [ -z "$dracut_interface_name" ]; then + warn 'No "BOOTIF" parameter found in the kernel command line.' +fi mount --options bind "${writeable_proc_cmdline_path}cmdline" /proc/cmdline for parameter in $(getargs slxsrv=); do @@ -47,3 +67,7 @@ if [ -z "$SLX_SERVER_BASE" ]; then warn 'No "slxbase" parameter found in the kernel command line.' return 1 fi + +echo '-----------------------Dracut-Kernel-Command-Line:----------------------' +cat /proc/cmdline +echo '------------------------------------------------------------------------' |