Fix/ignore ShellCheck findings

Signed-off-by: szubersk <szuberskidamian@gmail.com>
This commit is contained in:
szubersk 2023-02-27 22:29:35 +10:00
parent dd16eade69
commit 67bddc4d8b
No known key found for this signature in database
GPG Key ID: 5BA2439DCA1ABF18
8 changed files with 12 additions and 9 deletions

View File

@ -885,7 +885,7 @@ call_scripts()
if [ "$ec" -ne 0 ]; then
echo "E: ${initdir}/${cs_x} failed with return $ec." >&2
# only errexit on mkinitramfs
[ -n "${version}" ] && exit $ec
[ -n "${version}" ] && exit "$ec"
fi
# allow boot scripts to modify exported boot parameters
if [ -e /conf/param.conf ]; then

View File

@ -52,6 +52,7 @@ get_fsck_type_fstab () {
# therefore never used at boot time
if [ "${MNT_DIR}" = "/" ] || [ "${MNT_TYPE}" = "auto" ]; then
MNT_FSNAME="$(resolve_device "${MNT_FSNAME}")"
# shellcheck disable=SC2317
fstype() { "/usr/lib/klibc/bin/fstype" "$@"; }
if ! get_fstype "${MNT_FSNAME}"; then
echo "W: Couldn't identify type of $2 file system for fsck hook" >&2

4
init
View File

@ -209,7 +209,7 @@ mount -t tmpfs -o "nodev,noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /ru
mkdir -m 0700 /run/initramfs
if [ -n "$log_output" ]; then
exec >$log_output 2>&1
exec >"$log_output" 2>&1
unset log_output
fi
@ -243,7 +243,7 @@ log_begin_msg "Mounting root file system"
# /usr, irrespective of the boot script used to mount the rootfs).
. /scripts/local
. /scripts/nfs
. /scripts/${BOOT}
. "/scripts/${BOOT}"
parse_numeric "${ROOT}"
maybe_break mountroot
mount_top

View File

@ -53,5 +53,6 @@ if [ "$#" -eq 0 ] ; then
fi
for initramfs in "$@" ; do
# shellcheck disable=SC2086
unmkinitramfs $umi_opts -- "$initramfs"
done

View File

@ -261,6 +261,7 @@ DESTDIR=
__TMPCPIOGZ=
__TMPMAINCPIO=
__TMPEARLYCPIO=
# shellcheck disable=SC2317
clean_on_exit() {
if [ "${keep}" = "y" ]; then
echo "Working files in ${DESTDIR:-<not yet created>}," \

View File

@ -524,7 +524,7 @@ _checkfs_once()
log_warning_msg "File system check failed but did not detect errors"
sleep 5
else
true > $FSCK_STAMPFILE
true >"$FSCK_STAMPFILE"
fi
return 0
}

View File

@ -95,7 +95,7 @@ splitinitramfs()
test "$magic" = 070701 || test "$magic" = 070702 || break
namesize=0x$(readhex "$initramfs" $((end + 94)) 8)
filesize=0x$(readhex "$initramfs" $((end + 54)) 8)
end=$(((end + 110)))
end=$((end + 110))
end=$(((end + namesize + 3) & ~3))
end=$(((end + filesize + 3) & ~3))
done
@ -121,11 +121,11 @@ splitinitramfs()
start=$end
done
if [ $end -gt 0 ]; then
if [ "$end" -gt 0 ]; then
# Extract to main subdirectory
subarchive=$(mktemp "${TMPDIR:-/var/tmp}/unmkinitramfs_XXXXXX")
trap 'rm -f "$subarchive"' EXIT
dd < "$initramfs" skip=$end iflag=skip_bytes 2> /dev/null \
dd < "$initramfs" skip="$end" iflag=skip_bytes 2> /dev/null \
> "$subarchive"
xcpio "$subarchive" "${dir:+$dir/main}" -i "$@"
else

View File

@ -102,7 +102,7 @@ backup_booted_initramfs()
# no backup yet
if [ ! -r "${initramfs}.bak" ]; then
mv -f ${initramfs_bak} "${initramfs}.bak"
mv -f "${initramfs_bak}" "${initramfs}.bak"
verbose "Backup ${initramfs}.bak"
return 0
fi
@ -119,7 +119,7 @@ backup_booted_initramfs()
return 0
fi
verbose "Removing current backup ${initramfs_bak}"
rm -f ${initramfs_bak}
rm -f "${initramfs_bak}"
}
# nuke generated copy