summaryrefslogtreecommitdiffstats
path: root/builder/dnbd3-rootfs/module-setup.sh
diff options
context:
space:
mode:
authortorben2016-03-10 14:27:52 +0100
committertorben2016-03-10 14:27:52 +0100
commit006678ba48c567ef528c415a04268e783c869f21 (patch)
tree81a777f85b07dba888741d5987cfa9293f232a35 /builder/dnbd3-rootfs/module-setup.sh
parentWriting (unit) doc tests for enty script. (diff)
downloadsystemd-init-006678ba48c567ef528c415a04268e783c869f21.tar.gz
systemd-init-006678ba48c567ef528c415a04268e783c869f21.tar.xz
systemd-init-006678ba48c567ef528c415a04268e783c869f21.zip
Fix some tests.
Diffstat (limited to 'builder/dnbd3-rootfs/module-setup.sh')
-rwxr-xr-xbuilder/dnbd3-rootfs/module-setup.sh74
1 files changed, 67 insertions, 7 deletions
diff --git a/builder/dnbd3-rootfs/module-setup.sh b/builder/dnbd3-rootfs/module-setup.sh
index 550111ba..9f412a47 100755
--- a/builder/dnbd3-rootfs/module-setup.sh
+++ b/builder/dnbd3-rootfs/module-setup.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
-# region header
+# region imports
source "$(dirname "${BASH_SOURCE[0]}")/scripts/rebash/core.sh"
core.import exceptions
core.import logging
@@ -8,8 +8,34 @@ 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 __doc__='
+ Set log level via dracut logging options and returns current debug state.
+
+ >>> echo "$debug"
+ false
+ >>> _parse_dracut_args; echo $?
+ 1
+
+ >>> _parse_dracut_args --stdlog 3; echo $?
+ 1
+
+ >>> _parse_dracut_args --stdlog 4; echo $?
+ >>> logging.get_commands_level
+ >>> logging.get_level
+ 0
+ debug
+ debug
+
+ >>> logging.get_level
+ critical
+ >>> _parse_dracut_args --verbose
+ >>> logging.get_level
+ info
+
+ >>> _parse_dracut_args --stdlog 4 --unknown-dracut-option; echo $?
+ 0
+ '
local verbose=false
local debug=false
while true; do
@@ -44,8 +70,14 @@ _debug=0
_parse_dracut_args ${dracut_args[*]} || _debug=$?
# endregion
clean() {
- # NOTE: This method is currently triggered manually and not supported by
- # dracut itself.
+ local __doc__='
+ Removes all compiled kernel specific files.
+ NOTE: This method is triggered manually and not supported by dracut itself.
+
+ Example:
+
+ `clean`
+ '
build_clean_xmount "$moddir/binaries/xmount/"
build_clean_qemu_xmount "$moddir/binaries/qemu-xmount/"
build_clean_dnbd3 "$moddir/binaries/dnbd3/"
@@ -53,9 +85,15 @@ clean() {
"$moddir/binaries/systemd-preserve-process-marker/"
return 0
}
-# region dracut plugin api
+# region dracut plugin api
check() {
- # Checks weather all template system assumptions are satisfied
+ local __doc__='
+ Checks weather all template system assumptions are satisfied.
+
+ Example:
+
+ `check`
+ '
exceptions.activate
# NOTE: xmount must be compiled before qemu_xmount
local xmount_is_built=true
@@ -106,15 +144,37 @@ check() {
return 255
}
depends() {
- # NOTE: btrfs module should be used if it would work.
+ local __doc__='
+ Outputs all dependent dracut modules to make this module work.
+
+ >>> depends
+ +doc_test_contains
+ base
+ '
echo base network bash kernel-modules shutdown
}
installkernel() {
+ local __doc__='
+ Copies all needed kernel modules into initramfs file needed work at
+ runtime.
+
+ Example:
+
+ `installkernel`
+ '
inst "$moddir/binaries/dnbd3/build/dnbd3.ko" \
/usr/lib/modules/current/extra/dnbd3.ko
instmods dm_snapshot btrfs crc32c
}
install() {
+ local __doc__='
+ Copies all needed files into the initramfs image and registers all needed
+ dracut hooks.
+
+ Example:
+
+ `install`
+ '
# region binaries
inst "$moddir/binaries/dnbd3/build/dnbd3-client" /usr/bin/dnbd3-client
inst \