diff options
| author | torben | 2016-03-10 14:27:52 +0100 |
|---|---|---|
| committer | torben | 2016-03-10 14:27:52 +0100 |
| commit | 006678ba48c567ef528c415a04268e783c869f21 (patch) | |
| tree | 81a777f85b07dba888741d5987cfa9293f232a35 | |
| parent | Writing (unit) doc tests for enty script. (diff) | |
| download | systemd-init-006678ba48c567ef528c415a04268e783c869f21.tar.gz systemd-init-006678ba48c567ef528c415a04268e783c869f21.tar.xz systemd-init-006678ba48c567ef528c415a04268e783c869f21.zip | |
Fix some tests.
| -rwxr-xr-x | builder/build-initramfs.sh | 17 | ||||
| -rwxr-xr-x | builder/dnbd3-rootfs/module-setup.sh | 74 |
2 files changed, 74 insertions, 17 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh index c05694d1..846663a4 100755 --- a/builder/build-initramfs.sh +++ b/builder/build-initramfs.sh @@ -16,13 +16,12 @@ # -------- # Start install progress command (Assuming internet is available): -# >>> ./build_initramfs.sh +# >>> ./build-initramfs.sh # Note that you only get very necessary output until you provide "--verbose" as # commandline options. ## region ensure presence of needed dependencies - set -o errexit _needed_location="$(dirname "${BASH_SOURCE[0]}")/dnbd3-rootfs" if ! [[ -d "$_needed_location" ]]; then @@ -48,9 +47,7 @@ if ! [[ -d "$_needed_location" ]]; then rm --recursive --force "$_temporary_repository_location" fi set +o errexit - ## endregion - source "$(dirname "${BASH_SOURCE[0]}")/dnbd3-rootfs/scripts/rebash/core.sh" core.import exceptions exceptions.activate @@ -333,13 +330,13 @@ parse_command_line() { ## endregion ## region helper dependency_check() { - __doc__=' + local __doc__=' Check for given dependencies with given dependency checker and log corresponding messages. Example: - dependency_check core dependencies utils_dependency_check program + `dependency_check core dependencies utils_dependency_check program` ' local result=0 @@ -368,12 +365,12 @@ dependency_check() { return $result } initialize_dracut() { - __doc__=' + local __doc__=' Downloads and compiles dracut. Example: - initialize_dracut + `initialize_dracut` ' if [[ ! -f "$(dirname "${BASH_SOURCE[0]}")/dracut/install/dracut-install" ]] then @@ -400,12 +397,12 @@ initialize_dracut() { return $? } cleanup() { - __doc__=' + local __doc__=' Removes distribution specific generated files. Example: - cleanup + `cleanup` ' local plugin_path="$(dirname "${BASH_SOURCE[0]}")/dnbd3-rootfs/" source "${plugin_path}module-setup.sh" 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 \ |
