summaryrefslogtreecommitdiffstats
path: root/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh
diff options
context:
space:
mode:
authorjandob2015-11-19 17:10:22 +0100
committerjandob2015-11-19 17:10:22 +0100
commite07801dfd6dcb158538bf4d543ca37919da387fe (patch)
treea1cf5b93f4953164a9cc506d7aa24b14553b3609 /builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh
parentsimplifying build script (diff)
parentFixed pxe boot and add example pxe config file. (diff)
downloadsystemd-init-e07801dfd6dcb158538bf4d543ca37919da387fe.tar.gz
systemd-init-e07801dfd6dcb158538bf4d543ca37919da387fe.tar.xz
systemd-init-e07801dfd6dcb158538bf4d543ca37919da387fe.zip
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
Diffstat (limited to 'builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh')
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh37
1 files changed, 22 insertions, 15 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 6d6b9950..5f62a8cd 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,10 +1,13 @@
-command -v warn >/dev/null || . /lib/dracut-lib.sh
+command -v warn &> /dev/null || . /lib/dracut-lib.sh
-# fakes the cmdline to fix the ip parsing in darcut's net-lib.sh
-[ -d /fake ] || mkdir /fake
-
-# need to be a tmpfs for the hack to work
-mount -t tmpfs tmpfs /fake
+set -e
+# This location will be used to have a writable kernel command line file
+# location.
+local writeable_proc_cmdline_path='/writable_proc_cmdline/'
+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"
for parameter in $(getargs ip=); do
local temp="$parameter:"
@@ -19,16 +22,20 @@ for parameter in $(getargs ip=); do
[ -n "$3" ] && gateway_ip=$3
[ -n "$4" ] && net_mask=$4
- 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::enp0s3:off"
- warn "Final dracut ip config: $final_dracut_ip_config"
- sed --regexp-extended "s/ip=[^ ]*/ip=$final_dracut_ip_config/g" /proc/cmdline > /fake/cmdline
+ info "PXE given net configuration: ip: $ip server_ip: $server_ip gateway_ip: $gateway_ip net_mask: $net_mask"
+ 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"
done
+mount --options bind /fake/cmdline /proc/cmdline
-# 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
+for parameter in $(getargs slxsrv=); do
+ slxsrv="$parameter"
+done
+for parameter in $(getargs slxbase=); do
+ slxbase="$parameter"
+done
-grep ':enp0s3:off' /proc/cmdline || \
- warn 'Overwriting kernel commandline did not work.'
+set +e