summaryrefslogtreecommitdiffstats
path: root/builder
diff options
context:
space:
mode:
authortorben2016-03-10 17:32:45 +0100
committertorben2016-03-10 17:32:45 +0100
commit0f9aa9873abcd7664890c9747159b38443748683 (patch)
tree1fa7b6ebca64f415e754951da883ef4fd13ba1e7 /builder
parentupdate rebash (diff)
downloadsystemd-init-0f9aa9873abcd7664890c9747159b38443748683.tar.gz
systemd-init-0f9aa9873abcd7664890c9747159b38443748683.tar.xz
systemd-init-0f9aa9873abcd7664890c9747159b38443748683.zip
Update
Diffstat (limited to 'builder')
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh43
-rwxr-xr-xbuilder/dnbd3-rootfs/module-setup.sh7
-rwxr-xr-xbuilder/dnbd3-rootfs/scripts/container-unpack-qemu.sh3
-rwxr-xr-xbuilder/dnbd3-rootfs/scripts/container-unpack-xmount.sh3
-rwxr-xr-xbuilder/dnbd3-rootfs/scripts/device-add-write-layer.sh3
5 files changed, 37 insertions, 22 deletions
diff --git a/builder/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh b/builder/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh
index 221aa7eb..e17d631c 100755
--- a/builder/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh
+++ b/builder/dnbd3-rootfs/hooks/prepare-kernel-command-line-parameter.sh
@@ -1,5 +1,15 @@
#!/usr/bin/env bash
-( # subshell for variable scoping
+# -*- coding: utf-8 -*-
+# region imports
+source '/usr/lib/rebash/core.sh'
+core.import exceptions
+core.import logging
+# endregion
+exceptions.try
+{
+logging.set_commands_level debug
+logging.set_level debug
+
SLX_INITIAL_KERNEL_COMMAND_LINE="$(cat /proc/cmdline | tr --delete '\n')"
# This location will be used to have a writable kernel command line file
@@ -12,18 +22,18 @@ mount --types tmpfs tmpfs "$writeable_proc_cmdline_path"
echo -n "$SLX_INITIAL_KERNEL_COMMAND_LINE" > \
"${writeable_proc_cmdline_path}/cmdline"
-echo -e \
+logging.debug \
'-----------------------Kernel-Command-Line:--------------------------\n' \
"${SLX_INITIAL_KERNEL_COMMAND_LINE}\n" \
'----------------------------------------------------------------------'
for parameter in $(getargs BOOTIF=); do
- info "PXE given boot interface $parameter"
+ logging.debug "PXE given boot interface $parameter"
dracut_interface_name="bootnet:$(echo $parameter | \
sed --regexp-extended 's/.{2}[:\-]((.{2}[:\-]){5}.{2})/\1/' | \
sed s/-/:/g)"
- info "Dracut interface name is: $dracut_interface_name"
- echo -n " ifname=$dracut_interface_name" >> \
+ logging.debug "Dracut interface name is: $dracut_interface_name"
+ logging.debug -n " ifname=$dracut_interface_name" >> \
"${writeable_proc_cmdline_path}cmdline"
done
for parameter in $(getargs ip=); do
@@ -39,34 +49,37 @@ for parameter in $(getargs ip=); do
[ -n "$3" ] && gateway_ip=$3
[ -n "$4" ] && net_mask=$4
- info "PXE given net configuration: ip: $ip server_ip: $server_ip gateway_ip: $gateway_ip net_mask: $net_mask"
+ logging.debug "PXE given net configuration: ip: $ip server_ip: $server_ip gateway_ip: $gateway_ip net_mask: $net_mask"
dracut_ip_configuration="$ip::$gateway_ip:$net_mask::bootnet:off"
- info "Dracut ip configuration is: $dracut_ip_configuration"
+ logging.debug "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 "$dracut_ip_configuration" ]; then
- warn 'No "ip" parameter found in the kernel command line.'
+ logging.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.'
+ logging.warn 'No "BOOTIF" parameter found in the kernel command line.'
fi
mount --options bind "${writeable_proc_cmdline_path}cmdline" /proc/cmdline
if [ -z $(getargs slxsrv=) ]; then
- warn 'No "slxsrv" parameter found in the kernel command line.'
+ logging.warn 'No "slxsrv" parameter found in the kernel command line.'
exit 1
fi
if [ -z $(getargs slxbase=) ]; then
- warn 'No "slxbase" parameter found in the kernel command line.'
+ logging.warn 'No "slxbase" parameter found in the kernel command line.'
exit 1
fi
-echo '-----------------------Dracut-Kernel-Command-Line:----------------------'
-cat /proc/cmdline
-echo '------------------------------------------------------------------------'
-)
+logging.debug '-----------------------Dracut-Kernel-Command-Line:----------------------'
+logging.debug "$(logging.cat /proc/cmdline)"
+logging.debug '------------------------------------------------------------------------'
+exceptions.catch
+{
+ emergency_shell "error in ${BASH_SOURCE[0]}"
+}
# region vim modline
# vim: set tabstop=4 shiftwidth=4 expandtab:
diff --git a/builder/dnbd3-rootfs/module-setup.sh b/builder/dnbd3-rootfs/module-setup.sh
index 9f412a47..823861e3 100755
--- a/builder/dnbd3-rootfs/module-setup.sh
+++ b/builder/dnbd3-rootfs/module-setup.sh
@@ -85,7 +85,7 @@ clean() {
"$moddir/binaries/systemd-preserve-process-marker/"
return 0
}
-# region dracut plugin api
+# region dracut plugin api
check() {
local __doc__='
Checks weather all template system assumptions are satisfied.
@@ -199,10 +199,9 @@ install() {
inst_hook cmdline 10 \
"$moddir/hooks/prepare-kernel-command-line-parameter.sh"
inst_hook cmdline 90 "$moddir/hooks/set-dracut-environment-variables.sh"
- # load dnbd3.ko
inst_hook pre-udev 00 "$moddir/hooks/load-custom-kernel-modules.sh"
- # get the openslx config from the servers configured in the kernel command
- # line (${SLX_SERVER}/${SLX_SERVER_BASE}/config)
+ # Get the openslx config from the servers configured in the kernel command
+ # line (${SLX_SERVER}/${SLX_SERVER_BASE}/config).
inst_hook pre-mount 00 "$moddir/hooks/fetch-config.sh"
# make the final blockdevice for the root system (dnbd3 -> xmount ->
# device-mapper)
diff --git a/builder/dnbd3-rootfs/scripts/container-unpack-qemu.sh b/builder/dnbd3-rootfs/scripts/container-unpack-qemu.sh
index 2592bfe9..53fd73dc 100755
--- a/builder/dnbd3-rootfs/scripts/container-unpack-qemu.sh
+++ b/builder/dnbd3-rootfs/scripts/container-unpack-qemu.sh
@@ -1,9 +1,10 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
-
+# region imports
source "/usr/lib/rebash/core.sh"
core.import exceptions
exceptions.activate
+# endregion
in_device="$1"
nbd_device="$2" # TODO detect first free nbd device
diff --git a/builder/dnbd3-rootfs/scripts/container-unpack-xmount.sh b/builder/dnbd3-rootfs/scripts/container-unpack-xmount.sh
index 9da0baac..802c4e2f 100755
--- a/builder/dnbd3-rootfs/scripts/container-unpack-xmount.sh
+++ b/builder/dnbd3-rootfs/scripts/container-unpack-xmount.sh
@@ -1,9 +1,10 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
-
+# region imports
source '/usr/lib/rebash/core.sh'
core.import exceptions
exceptions.activate
+# endregion
in_device="$1"
mkdir /mnt
diff --git a/builder/dnbd3-rootfs/scripts/device-add-write-layer.sh b/builder/dnbd3-rootfs/scripts/device-add-write-layer.sh
index c7cd2f6c..4125ba45 100755
--- a/builder/dnbd3-rootfs/scripts/device-add-write-layer.sh
+++ b/builder/dnbd3-rootfs/scripts/device-add-write-layer.sh
@@ -1,9 +1,10 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
-
+# region imports
source "/usr/lib/rebash/core.sh"
core.import exceptions
exceptions.activate
+# endregion
combined_device_name="$1"
read_only_device="$2"