diff options
Diffstat (limited to 'builder/modules.d/dnbd3-rootfs/module-setup.sh')
-rwxr-xr-x | builder/modules.d/dnbd3-rootfs/module-setup.sh | 85 |
1 files changed, 10 insertions, 75 deletions
diff --git a/builder/modules.d/dnbd3-rootfs/module-setup.sh b/builder/modules.d/dnbd3-rootfs/module-setup.sh index 0356aa14..63bb0b29 100755 --- a/builder/modules.d/dnbd3-rootfs/module-setup.sh +++ b/builder/modules.d/dnbd3-rootfs/module-setup.sh @@ -1,13 +1,5 @@ #!/usr/bin/env bash # -*- coding: utf-8 -*- -# region imports -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]}")/helper/build.inc")" -# endregion -# region forward "build-initrfams.sh" logging configuration if present. _parse_dracut_args() { local __doc__=' Set log level via dracut logging options and returns current debug state. @@ -59,41 +51,23 @@ _parse_dracut_args() { local level $verbose && level=info $debug && level=debug - logging.set_level "$level" - logging.set_commands_level debug + #logging.set_level "$level" + #logging.set_commands_level debug done $debug return $? } +# WTF does this actually do aside from taking space! _debug=0 _parse_dracut_args ${dracut_args[*]} || _debug=$? # endregion -# region initialize function to build required components clean() { - local __doc__=' - Removes all compiled kernel specific files. - NOTE: This method is triggered manually and not supported by dracut itself. - - Example: - - `clean` - ' . "${moddir}/helper/build.inc" clean_components - return 0 } -# endregion # region dracut plugin api check() { - local __doc__=' - Checks wether all template system assumptions are satisfied. - - Example: - - `check` - ' - exceptions.activate build_initialize_components # NOTE: xmount must be compiled before qemu_xmount local xmount_is_built=true @@ -101,12 +75,11 @@ check() { [[ ! -f "$moddir/binaries/qemu-xmount/libxmount_input_qemu.so" ]]; then xmount_is_built=false fi - $xmount_is_built || logging.warn \ - "Compiling \"xmount\" failed." + # non-critical if failed + $xmount_is_built || warn "Compiling 'xmount'/'libxmount_input_qemu' failed." if [[ ! -f "$moddir/binaries/dnbd3/build/dnbd3.ko" ]] || \ - [[ ! -f "$moddir/binaries/dnbd3/build/dnbd3-client" ]] - then + [[ ! -f "$moddir/binaries/dnbd3/build/dnbd3-client" ]]; then CMAKE_FLAGS="-DKERNEL_VERSION=${kernel}" \ build_compile_dnbd3 "$moddir/binaries/dnbd3/" [[ $? != 0 ]] && return 1 @@ -116,6 +89,7 @@ check() { "$moddir/binaries/systemd-preserve-process-marker/" [[ $? != 0 ]] && return 1 fi + # TODO do we still need this ? # NOTE: This are workarounds for: # - distributions where "systemd-udevd" doesn't lives in "/usr/lib" but in # "/lib". @@ -125,39 +99,18 @@ check() { mkdir --parents "${initdir}${systemdutildir}" ln --symbolic --force "$alternate_systemd_udevd_location" \ "${initdir}${systemdutildir}/systemd-udevd" - #cp "$alternate_systemd_udevd_location" \ - # "${initdir}${systemdutildir}/systemd-udevd" 1>&2 fi + # WTF? # - "/usr/bin/sh" isn't available but "/bin/sh". 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() { - local __doc__=' - Outputs all dependent dracut modules to make this module work. - - >>> depends - +doc_test_contains - base - ' - #local network_module="network" - #dracut_module_included "systemd-initrd" && network_module="systemd-networkd-ext" - echo base bash kernel-modules shutdown slx-dmsetup slx-network # "$network_module" + echo base bash kernel-modules shutdown slx-dmsetup slx-network } installkernel() { - local __doc__=' - Copies all needed kernel modules into initramfs file needed work at - runtime. - - Example: - - `installkernel` - ' local block_kmod_dir="/lib/modules/${kernel}/kernel/drivers/block" # dnbd3 @@ -171,14 +124,6 @@ installkernel() { done } 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/local/bin/dnbd3-client inst "$moddir/binaries/systemd-preserve-process-marker/systemd-preserve-process-marker" \ @@ -202,7 +147,7 @@ install() { local losetup_qcow2_dir="$moddir/binaries/kernel-qcow2-util-linux" if [[ -f "${losetup_qcow2_dir}/.libs/losetup" ]]; then inst "${losetup_qcow2_dir}/.libs/losetup" /usr/local/bin/losetup - mkdir -p "${initdir}/usr/local/lib" + mkdir -p "${initdir}/usr/local/lib" cp -a "${losetup_qcow2_dir}/.libs/"*.so* "${initdir}/usr/local/lib" fi # endregion @@ -248,11 +193,6 @@ install() { "$moddir/hooks/copy-openslx-configuration-into-newroot.sh" # endregion # region scripts - local file_path - for file_path in "$moddir/scripts/rebash/"*; do - inst "$file_path" "/usr/lib/rebash/$(basename "$file_path")" - done - #inst "$moddir/scripts/tools.sh" "/usr/lib/openslx/tools.sh" # endregion # region configuration files # Use terminal readline settings from the template system. @@ -276,8 +216,3 @@ install() { sed sleep sort \ tee touch tr } -# endregion -# region vim modline -# vim: set tabstop=4 shiftwidth=4 expandtab: -# vim: foldmethod=marker foldmarker=region,endregion: -# endregion |