summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2017-12-30 18:16:12 +0100
committerDave Reisner <dreisner@archlinux.org>2017-12-30 18:21:55 +0100
commite2a1189dbd0f3d8c051e2d21b8c8aec9b3b091c7 (patch)
treed2c53c84c30eb7d1ec592f7338edf6be69f0acaa
parentf8cc481e7a4cb33a351308b3f440870fef57fe72 (diff)
downloadmkinitcpio-e2a1189dbd0f3d8c051e2d21b8c8aec9b3b091c7.tar.gz
mkinitcpio-e2a1189dbd0f3d8c051e2d21b8c8aec9b3b091c7.tar.xz
cleanup some shellcheck lint warnings
-rwxr-xr-xmkinitcpio24
1 files changed, 11 insertions, 13 deletions
diff --git a/mkinitcpio b/mkinitcpio
index 42b8290..5583d07 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -74,7 +74,7 @@ cleanup() {
if [[ $_d_workdir ]]; then
# when _optpreset is set, we're in the main loop, not a worker process
- if (( _optsavetree )) && [[ -z $_optpreset ]]; then
+ if (( _optsavetree )) && [[ -z ${_optpreset[*]} ]]; then
printf '%s\n' "${!_autodetect_cache[@]}" > "$_d_workdir/autodetect_modules"
msg "build directory saved in %s" "$_d_workdir"
else
@@ -82,7 +82,7 @@ cleanup() {
fi
fi
- exit $err
+ exit "$err"
}
resolve_kernver() {
@@ -171,12 +171,12 @@ hook_list() {
done
msg "Available hooks"
- printf '%s\n' "${hooklist[@]}" | sort -u | column -c$(tput cols)
+ printf '%s\n' "${hooklist[@]}" | sort -u | column -c"$(tput cols)"
if (( ${#depr[*]} )); then
echo
for p in "${!depr[@]}"; do
- printf "%s This hook is deprecated in favor of '%s'\n" \
+ printf $'%s This hook is deprecated in favor of \'%s\'\n' \
"${ss_ordinals[p]}" "${depr[p]}"
done
fi
@@ -195,21 +195,19 @@ build_image() {
local out=$1 compress=$2 errmsg=
local -a pipesave cpio_opts
- if [[ $compress = cat ]]; then
- msg "Creating uncompressed initcpio image: %s" "$out"
- else
- msg "Creating %s-compressed initcpio image: %s" "$compress" "$out"
- fi
-
case $compress in
cat)
+ msg "Creating uncompressed initcpio image: %s" "$out"
unset COMPRESSION_OPTIONS
;;
+ *)
+ msg "Creating %s-compressed initcpio image: %s" "$compress" "$out"
+ ;;&
xz)
- COMPRESSION_OPTIONS+=(--check=crc32)
+ COMPRESSION_OPTIONS+=('--check=crc32')
;;
lz4)
- COMPRESSION_OPTIONS+=(-l)
+ COMPRESSION_OPTIONS+=('-l')
;;
esac
@@ -221,7 +219,7 @@ build_image() {
fi
pushd "$BUILDROOT" >/dev/null
- find -mindepth 1 -printf '%P\0' |
+ find . -mindepth 1 -printf '%P\0' |
LANG=C bsdcpio "${cpio_opts[@]}" |
$compress "${COMPRESSION_OPTIONS[@]}" > "$out"
pipesave=("${PIPESTATUS[@]}") # save immediately