From c8cc76e880a20f3e4c273feff3548db913bd8403 Mon Sep 17 00:00:00 2001 From: jandob Date: Fri, 11 Mar 2016 13:32:53 +0100 Subject: make build-initram-fs shellcheck compatible --- builder/build-initramfs.sh | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'builder/build-initramfs.sh') diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh index 7b01bfc5..8199d954 100755 --- a/builder/build-initramfs.sh +++ b/builder/build-initramfs.sh @@ -4,6 +4,7 @@ # Copyright Torben Sickert (info["~at~"]torben.website) 29.10.2015 # Janosch Dobler (info["~at~"]jandob.com) 29.10.2015 + # License # ------- # This library written by Torben Sickert and Janosch Dobler stand under a @@ -35,6 +36,7 @@ if ! [[ -d "$_needed_location" ]]; then "$_temporary_repository_location" pushd "$_temporary_repository_location" git submodule init + # shellcheck disable=SC2016 git submodule foreach ' branch="$(git config --file "$toplevel/.gitmodules" "submodule.$name.branch")" git clone --depth 1 --branch "$branch" @@ -48,6 +50,7 @@ if ! [[ -d "$_needed_location" ]]; then fi set +o errexit ## endregion +# shellcheck source=./dnbd3-rootfs/scripts/rebash/core.sh source "$(dirname "${BASH_SOURCE[0]}")/dnbd3-rootfs/scripts/rebash/core.sh" core.import exceptions core.import logging @@ -55,6 +58,7 @@ core.import utils core.import change_root # endregion # region properties +# shellcheck disable=SC2034 build_initramfs__doc_test_setup__='exceptions.activate' dracut_resource_url='https://www.kernel.org/pub/linux/utils/boot/dracut/dracut-043.tar.gz' file_path='/boot/initramfs.img' @@ -65,6 +69,7 @@ target='' cleanup='no' full_cleanup='no' use_systemd_in_initramfs='no' +# shellcheck disable=SC2034 declare -A core_dependencies=( [cat]='print messages' \ [cpio]='pack initramfs' \ @@ -78,20 +83,26 @@ declare -A core_dependencies=( [shift]='parse command line' \ [sed]='process strings' \ ['cmake gcc make']='dynamically compile needed resources against current or given kernel') +# shellcheck disable=SC2034 declare -A optional_dependencies=( [chroot]='build against a distribution other than this program runs in' \ ['curl git gzip tar']='dynamically retrieve and unpack missing application which will be compiled for current or given kernel' \ [qemu-img]='support template systems in container (usually used by virtual runtime environments') +# shellcheck disable=SC2034 declare -A core_shared_library_pattern_dependencies=( [libz]='compile dnbd3 for given or current kernel') +# shellcheck disable=SC2034 declare -A optional_shared_library_pattern_dependencies=() +# shellcheck disable=SC2034 declare -A core_package_dependencies=() +# shellcheck disable=SC2034 declare -A optional_package_dependencies=( ['fuse glib-2.0 pixman-1']='support template systems in container (usually used by virtual runtime environments)') # endregion # region functions ## region command line interface print_usage_message() { + # shellcheck disable=SC2016,SC2034 local __doc__=' Prints a description about how to use this program. @@ -103,6 +114,7 @@ initramfs. EOF } print_usage_examples() { + # shellcheck disable=SC2016,SC2034 local __doc__=' Prints a description about how to use this program by providing examples. @@ -114,6 +126,7 @@ Start install progress: EOF } print_command_line_option_description() { + # shellcheck disable=SC2016,SC2034 local __doc__=' Prints descriptions about each available command line option. @@ -149,6 +162,7 @@ concatenated.). EOF } print_help_message() { + # shellcheck disable=SC2016,SC2034 local __doc__=' Provides a help message for this module. @@ -163,6 +177,7 @@ print_help_message() { logging.plain } parse_command_line() { + # shellcheck disable=SC2016,SC2034 local __doc__=' Provides the command line interface and interactive questions. @@ -332,6 +347,7 @@ parse_command_line() { ## endregion ## region helper dependency_check() { + # shellcheck disable=SC2016,SC2034 local __doc__=' Check for given dependencies with given dependency checker and log corresponding messages. @@ -342,7 +358,8 @@ dependency_check() { ' local result=0 - eval 'for dependency_group in "${!'$1'_'$2'[@]}"; do + # shellcheck disable=SC2016,SC1004 + eval 'for dependency_group in "${!'"$1"'_'"$2"'[@]}"; do # NOTE: If "dependency_check_result" would be marked as local it is # empty later. dependency_check_result="$($3 $dependency_group)" || \ @@ -367,6 +384,7 @@ dependency_check() { return $result } initialize_dracut() { + # shellcheck disable=SC2016,SC2034 local __doc__=' Downloads and compiles dracut. @@ -399,6 +417,7 @@ initialize_dracut() { return $? } cleanup() { + # shellcheck disable=SC2016,SC2034 local __doc__=' Removes distribution specific generated files. @@ -406,8 +425,11 @@ cleanup() { `cleanup` ' - local plugin_path="$(dirname "${BASH_SOURCE[0]}")/dnbd3-rootfs/" + local plugin_path + plugin_path="$(dirname "${BASH_SOURCE[0]}")/dnbd3-rootfs/" + # shellcheck disable=SC1090 source "${plugin_path}module-setup.sh" + # shellcheck disable=SC2034 moddir="$(cd "$plugin_path" &>/dev/null && pwd)" clean return $? @@ -416,6 +438,7 @@ cleanup() { # endregion # region controller main() { + # shellcheck disable=SC2016,SC2034 local __doc__=' Main Entry point for the build initramfs logic. Triggers command line parsing and calls sub routines depending on given command line arguments. @@ -495,6 +518,7 @@ main() { # To avoid to broke the "fakechroot" environment pipe the ldconfig call # to the native one: # >>> FAKECHROOT_CMD_SUBST=/usr/bin/ldconfig=/usr/bin/ldconfig + # shellcheck disable=SC2086 change_root "${_target}" \ "${_temporary_working_directory}/${BASH_SOURCE[0]}" \ ${_parameter_to_forward[*]} @@ -567,6 +591,7 @@ main() { _log_level_backup="$(logging.get_level)" logging.set_level debug logging.set_commands_level debug + # shellcheck disable=SC2086 "$(dirname "${BASH_SOURCE[0]}")/dracut/dracut.sh" --local \ $_loglevel --modules "$_modules" ${dracut_parameter[*]} "$file_path" _return_code=$? -- cgit v1.2.3-55-g7522