diff options
author | torben | 2016-12-01 10:30:54 +0100 |
---|---|---|
committer | torben | 2016-12-01 10:30:54 +0100 |
commit | 09d5a988fdd0fc897c167e9d773dcc1293743955 (patch) | |
tree | a3c92fe7d77686e53850de55ed61deea34fc12ed /builder/build-initramfs.sh | |
parent | a (diff) | |
parent | duh 2.0 (diff) | |
download | systemd-init-09d5a988fdd0fc897c167e9d773dcc1293743955.tar.gz systemd-init-09d5a988fdd0fc897c167e9d773dcc1293743955.tar.xz systemd-init-09d5a988fdd0fc897c167e9d773dcc1293743955.zip |
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
Diffstat (limited to 'builder/build-initramfs.sh')
-rwxr-xr-x | builder/build-initramfs.sh | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh index b705fece..dcab3b1d 100755 --- a/builder/build-initramfs.sh +++ b/builder/build-initramfs.sh @@ -43,9 +43,11 @@ if ! [[ -d "$_needed_location" ]]; then ' git submodule update --remote popd - cp --recursive \ - "${_temporary_repository_location}/builder/dnbd3-rootfs" \ - "$_needed_location" + for mod in dnbd3-rootfs conf-tgz dns ib-conf bootnet-conf; do + cp --recursive \ + "${_temporary_repository_location}/builder/${mod}" \ + "$(dirname $_needed_location)/${mod}" + done rm --recursive --force "$_temporary_repository_location" fi set +o errexit @@ -203,9 +205,10 @@ parse_command_line() { debug >>> parse_command_line -p + +doc_test_capture_stderr +doc_test_contains - Error with given option "-p": +doc_test_ellipsis + Error with given option "-p": Traceback (most recent call first): ... @@ -240,9 +243,10 @@ parse_command_line() { yes >>> parse_command_line -t; echo $? + +doc_test_capture_stderr +doc_test_contains - Error with given option "-t": +doc_test_ellipsis + Error with given option "-t": Traceback (most recent call first): ... @@ -262,9 +266,10 @@ parse_command_line() { vim htop >>> parse_command_line --no-available-option; echo $? + +doc_test_capture_stderr +doc_test_contains - Error with given option "--no-available-option": +doc_test_ellipsis + Error with given option "--no-available-option": Traceback (most recent call first): ... ' @@ -547,30 +552,33 @@ main() { logging.info "Dracut isn't available yet loading it." initialize_dracut fi - - _dracut_modules_source='../../dnbd3-rootfs' - _dracut_modules_target="$(dirname "${BASH_SOURCE[0]}")/dracut/modules.d/90dnbd3-rootfs" - if [[ ! -L "$_dracut_modules_target" || "$(readlink \ - "$_dracut_modules_target")" != "$_dracut_modules_source" ]] - then - logging.info \ - "Link dnbd3 plugin into dracut modules folder ($_dracut_modules_source -> $_dracut_modules_target)." - if ! ln --symbolic --force "$_dracut_modules_source" \ - "$_dracut_modules_target" 2>/dev/null; then - logging.warn \ - "Linking \"$_dracut_modules_source\" to \"$_dracut_modules_target\" failed. We will copy them. So we have to recopy it every time to ensure that recompiled things take effect." - cp --recursive --force --no-target-directory \ - "$(dirname "${BASH_SOURCE[0]}")/$(basename "$_dracut_modules_source")" \ - "$_dracut_modules_target" + + declare -A _dracut_modules=( [dnbd3]='../../dnbd3-rootfs' [conf]='../../conf-tgz' [dns]='../../dns' [ib]='../../ib-conf' [bootnet]='../../bootnet-conf') + for mod in dnbd3 conf dns ib bootnet; do + _dracut_modules_source="${_dracut_modules[$mod]}" + _dracut_modules_target="$(dirname "${BASH_SOURCE[0]}")/dracut/modules.d/90$(basename "${_dracut_modules[$mod]}")" + if [[ ! -L "$_dracut_modules_target" || "$(readlink \ + "$_dracut_modules_target")" != "$_dracut_modules_source" ]] + then + logging.info \ + "Link ${mod} plugin into dracut modules folder ($_dracut_modules_source -> $_dracut_modules_target)." + if ! ln --symbolic --force "$_dracut_modules_source" \ + "$_dracut_modules_target" 2>/dev/null; then + logging.warn \ + "Linking \"$_dracut_modules_source\" to \"$_dracut_modules_target\" failed. We will copy them. So we have to recopy it every time to ensure that recompiled things take effect." + cp --recursive --force --no-target-directory \ + "$(dirname "${BASH_SOURCE[0]}")/$(basename "$_dracut_modules_source")" \ + "$_dracut_modules_target" + fi fi - fi + done # endregion # region prepare and perform final dracut call _loglevel='' if [ "$verbose" == 'yes' ]; then _loglevel='--verbose' fi - _modules='dnbd3-rootfs' + _modules='dnbd3-rootfs conf-tgz dns ib-conf bootnet-conf' if [ "$debug" == 'yes' ]; then _loglevel="$_loglevel --stdlog 4" _modules="$_modules i18n terminfo" @@ -598,7 +606,8 @@ main() { logging.set_commands_level debug # shellcheck disable=SC2086 "$(dirname "${BASH_SOURCE[0]}")/dracut/dracut.sh" --local \ - $_loglevel --modules "$_modules" "${dracut_parameter[@]}" \ + $_loglevel --modules "$_modules" --conf /etc/dracut.conf \ + --confdir /etc/dracut.conf.d "${dracut_parameter[@]}" \ "$file_path" _return_code=$? logging.set_commands_level "$_commands_log_level_backup" @@ -613,7 +622,9 @@ main() { exceptions.deactivate } # endregion -core.is_main && main "$@" +if core.is_main; then + main "$@" +fi # region vim modline # vim: set tabstop=4 shiftwidth=4 expandtab: # vim: foldmethod=marker foldmarker=region,endregion: |