summaryrefslogtreecommitdiffstats
path: root/builder/dnbd3-rootfs
diff options
context:
space:
mode:
Diffstat (limited to 'builder/dnbd3-rootfs')
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/cmdline/enable-sysrq.sh2
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh37
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/cmdline/set-dracut-environment-variables.sh4
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh2
4 files changed, 26 insertions, 19 deletions
diff --git a/builder/dnbd3-rootfs/hooks/cmdline/enable-sysrq.sh b/builder/dnbd3-rootfs/hooks/cmdline/enable-sysrq.sh
index f779aa7a..30b12ea0 100755
--- a/builder/dnbd3-rootfs/hooks/cmdline/enable-sysrq.sh
+++ b/builder/dnbd3-rootfs/hooks/cmdline/enable-sysrq.sh
@@ -1,2 +1,2 @@
-# enables magic sysrq keys
+# Enables magic sysrq kernel supported key combinations.
echo 1 > /proc/sys/kernel/sysrq
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
diff --git a/builder/dnbd3-rootfs/hooks/cmdline/set-dracut-environment-variables.sh b/builder/dnbd3-rootfs/hooks/cmdline/set-dracut-environment-variables.sh
index 6deeb78f..c47af818 100755
--- a/builder/dnbd3-rootfs/hooks/cmdline/set-dracut-environment-variables.sh
+++ b/builder/dnbd3-rootfs/hooks/cmdline/set-dracut-environment-variables.sh
@@ -1,5 +1,5 @@
-# set rootok and root as dracut expects them to be set by
-# the module preparing the root filesystem.
+# Set rootok and root as dracut expects them to be set by the module preparing
+# the root filesystem.
rootok=1
root=block:/dev/devicemapper/root
diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh b/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh
index 91662d6c..e0987711 100755
--- a/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh
+++ b/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh
@@ -1,4 +1,4 @@
-# Load dracut library if not already loaded.
+# Load dracUT library if not already loaded.
command -v getarg >/dev/null || . /lib/dracut-lib.sh
# read SLX_SERVER and SLX_BASE from the kernel command line