summaryrefslogtreecommitdiffstats
path: root/builder/dnbd3-rootfs/module-setup.sh
diff options
context:
space:
mode:
authortorben2016-03-01 17:22:38 +0100
committertorben2016-03-01 17:22:38 +0100
commite21f4b7b498de444d3ad3c16011da922e00a83fe (patch)
tree045e4961ee673db7e5808069f029a5ec99f093da /builder/dnbd3-rootfs/module-setup.sh
parentRefactoring. (diff)
downloadsystemd-init-e21f4b7b498de444d3ad3c16011da922e00a83fe.tar.gz
systemd-init-e21f4b7b498de444d3ad3c16011da922e00a83fe.tar.xz
systemd-init-e21f4b7b498de444d3ad3c16011da922e00a83fe.zip
Refactor.
Diffstat (limited to 'builder/dnbd3-rootfs/module-setup.sh')
-rwxr-xr-xbuilder/dnbd3-rootfs/module-setup.sh47
1 files changed, 21 insertions, 26 deletions
diff --git a/builder/dnbd3-rootfs/module-setup.sh b/builder/dnbd3-rootfs/module-setup.sh
index 257d71ab..550111ba 100755
--- a/builder/dnbd3-rootfs/module-setup.sh
+++ b/builder/dnbd3-rootfs/module-setup.sh
@@ -1,11 +1,13 @@
#!/usr/bin/env bash
-
+# -*- coding: utf-8 -*-
+# region header
source "$(dirname "${BASH_SOURCE[0]}")/scripts/rebash/core.sh"
core.import exceptions
core.import logging
core.import utils
core.import "$(core_abs_path "$(dirname "${BASH_SOURCE[0]}")/scripts/build.sh")"
-
+# endregion
+# region forward "build-initrfams.sh" logging configuration if present.
# set log level via dracut logging options
_parse_dracut_args() {
local verbose=false
@@ -40,7 +42,7 @@ _parse_dracut_args() {
}
_debug=0
_parse_dracut_args ${dracut_args[*]} || _debug=$?
-
+# endregion
clean() {
# NOTE: This method is currently triggered manually and not supported by
# dracut itself.
@@ -51,11 +53,10 @@ clean() {
"$moddir/binaries/systemd-preserve-process-marker/"
return 0
}
-
+# region dracut plugin api
check() {
-
+ # Checks weather all template system assumptions are satisfied
exceptions.activate
-
# NOTE: xmount must be compiled before qemu_xmount
local xmount_is_built=true
if [[ ! -f "$moddir/binaries/xmount/trunk/build/src/xmount" ]]; then
@@ -78,13 +79,11 @@ check() {
build_compile_dnbd3 "$moddir/binaries/dnbd3/"
[[ $? != 0 ]] && return 1
fi
-
if [[ ! -f "$moddir/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker" ]]; then
build_compile_systemd_preserve_process_marker \
"$moddir/binaries/systemd-preserve-process-marker/"
[[ $? != 0 ]] && return 1
fi
-
# NOTE: This are workarounds for:
# - distributions where "systemd-udevd" doesn't lives in "/usr/lib" but in
# "/lib".
@@ -101,37 +100,33 @@ check() {
if [[ ! -f /usr/bin/sh ]] && [[ -f /bin/sh ]]; then
ln --symbolic --force /bin/sh /usr/bin/sh
fi
-
exceptions.deactivate
-
# Tell dracut that this module should only be included if it is required
# explicitly.
return 255
}
-
depends() {
# NOTE: btrfs module should be used if it would work.
echo base network bash kernel-modules shutdown
}
-
installkernel() {
inst "$moddir/binaries/dnbd3/build/dnbd3.ko" \
/usr/lib/modules/current/extra/dnbd3.ko
instmods dm_snapshot btrfs crc32c
}
-
install() {
-
# region binaries
inst "$moddir/binaries/dnbd3/build/dnbd3-client" /usr/bin/dnbd3-client
- inst "$moddir/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker" \
+ inst \
+ "$moddir/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker" \
/usr/bin/systemd-preserve-process-marker
inst "$moddir/scripts/device-add-write-layer.sh" \
/usr/bin/device-add-write-layer
inst "$moddir/scripts/container-unpack-xmount.sh" \
/usr/bin/container-unpack-xmount
# xmount
- local xmount_installation="$moddir/binaries/xmount/trunk/build/release_build"
+ local \
+ xmount_installation="$moddir/binaries/xmount/trunk/build/release_build"
inst "${xmount_installation}/usr/bin/xmount" /usr/bin/xmount
for file in ${xmount_installation}/usr/lib/xmount/*; do
inst "$file" /usr/lib/xmount/"$(basename "$file")"
@@ -141,7 +136,8 @@ install() {
# endregion
# region hooks
inst_hook cmdline 00 "$moddir/hooks/enable-sysrq.sh"
- inst_hook cmdline 10 "$moddir/hooks/prepare-kernel-command-line-parameter.sh"
+ 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"
@@ -163,17 +159,18 @@ install() {
"${initdir}/${systemdsystemunitdir}/initrd.target.requires"
ln_r "${systemdsystemunitdir}/dnbd3root.service" \
"${systemdsystemunitdir}/initrd.target.requires/dnbd3root.service"
-
- # copy systemd services to new root (so they don't get killed after
+ # Copy systemd services to new root (so they don't get killed after
# switch_root)
- inst_hook pre-pivot 00 "$moddir/hooks/copy-dnbd3-service-into-newroot.sh"
- inst_hook pre-pivot 00 "$moddir/hooks/copy-dracut-systemd-files-into-newroot.sh"
+ inst_hook pre-pivot 00 \
+ "$moddir/hooks/copy-dnbd3-service-into-newroot.sh"
+ inst_hook pre-pivot 00 \
+ "$moddir/hooks/copy-dracut-systemd-files-into-newroot.sh"
else
inst_hook pre-mount 10 "$moddir/hooks/prepare-root-partition.sh"
fi
inst_hook mount 10 "$moddir/hooks/mount-root-device.sh"
- inst_hook pre-pivot 00 "$moddir/hooks/copy-openslx-configuration-into-newroot.sh"
- #inst_hook pre-pivot 00 "$moddir/hooks/mount-tmp.sh"
+ inst_hook pre-pivot 00 \
+ "$moddir/hooks/copy-openslx-configuration-into-newroot.sh"
# endregion
# region scripts
local file_path
@@ -207,10 +204,8 @@ install() {
touch tr \
wget
}
-
+# endregion
# region vim modline
-
# vim: set tabstop=4 shiftwidth=4 expandtab:
# vim: foldmethod=marker foldmarker=region,endregion:
-
# endregion