summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Drung <benjamin.drung@cloud.ionos.com>2018-12-10 16:52:36 +0100
committerBenjamin Drung <benjamin.drung@cloud.ionos.com>2018-12-18 13:37:07 +0100
commit2bab73b939f196c3dd86988d4d95f71152f18f4c (patch)
tree4690087bb4890184468274b520ef7007829882c8
parentf277309e0b6b57ff2f8f9411c026394b7635f3d6 (diff)
Disable shellcheck for desired behaviour
Sometimes globbing and word splitting is wanted. Therefore explicitly disable the check for these line. Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
-rw-r--r--docs/framebuffer3
-rw-r--r--hook-functions8
-rwxr-xr-xhooks/fsck1
-rwxr-xr-xhooks/resume2
-rwxr-xr-xinit4
-rwxr-xr-xkernel/postinst.d/initramfs-tools1
-rwxr-xr-xkernel/postrm.d/initramfs-tools1
-rwxr-xr-xlsinitramfs1
-rwxr-xr-xmkinitramfs3
-rw-r--r--scripts/functions4
-rwxr-xr-xscripts/init-top/all_generic_ide1
-rwxr-xr-xscripts/init-top/keymap1
-rw-r--r--scripts/local2
-rw-r--r--scripts/nfs2
-rwxr-xr-xunmkinitramfs2
-rwxr-xr-xupdate-initramfs4
16 files changed, 40 insertions, 0 deletions
diff --git a/docs/framebuffer b/docs/framebuffer
index bc1f335..508fc51 100644
--- a/docs/framebuffer
+++ b/docs/framebuffer
@@ -64,6 +64,7 @@ parse_video_opts()
FB=""
OPTS=""
+# shellcheck disable=SC2013
for x in $(cat /proc/cmdline); do
case ${x} in
vga=*)
@@ -99,10 +100,12 @@ esac
if [ -n "${FB}" ]; then
unset MODPROBE_OPTIONS
modprobe -q fbcon
+ # shellcheck disable=SC2086
modprobe -q ${FB} ${OPTS}
fi
if [ -e /proc/fb ]; then
+ # shellcheck disable=SC2034
while read -r fbno desc; do
if [ $((fbno < 32)) ]; then
mknod -m 0640 "/dev/fb${fbno}" c 29 "${fbno}"
diff --git a/hook-functions b/hook-functions
index 941f6be..d6d66f4 100644
--- a/hook-functions
+++ b/hook-functions
@@ -64,6 +64,7 @@ manual_add_modules()
# module.ko' as we want. However it also means that 'softdep'
# configuration lines and embedded softdep information is not
# processed. So we run twice, with and without this option.
+ # shellcheck disable=SC2034
{ modprobe --all --set-version="${version?}" --ignore-install --quiet --show-depends "$@";
modprobe --all --set-version="${version}" --quiet --show-depends "$@"; } |
while read -r prefix kmod options ; do
@@ -224,9 +225,11 @@ copy_modules_dir()
first=false
done
+ # shellcheck disable=SC2044
for kmod in $(find "${MODULESDIR}/${dir}" "$@" -name '*.ko*' -printf '%f\n'); do
modules="$modules ${kmod%%.*}"
done
+ # shellcheck disable=SC2086
manual_add_modules $modules
}
@@ -341,6 +344,7 @@ dep_add_modules_mount()
fi
# find out block device + fstype
+ # shellcheck disable=SC2034
eval "$(while read -r dev mp fs opts rest ; do \
[ "$mp" = "$dir" ] && [ "$fs" != "rootfs" ] \
&& printf "dev_node=%s\\nFSTYPE=%s" "$dev" "$fs"\
@@ -367,6 +371,7 @@ dep_add_modules_mount()
# Does not exist in our namespace, so look at the
# kernel command line
dev_node=
+ # shellcheck disable=SC2013
for arg in $(cat /proc/cmdline); do
case "$arg" in
root=*)
@@ -487,6 +492,7 @@ dep_add_modules()
modules="$modules sunvnet sunvdc"
fi
+ # shellcheck disable=SC2086
manual_add_modules $modules
}
@@ -606,6 +612,7 @@ auto_add_modules()
esac
done
+ # shellcheck disable=SC2086
manual_add_modules $modules
}
@@ -616,6 +623,7 @@ auto_add_modules()
# hidden dependencies.
hidden_dep_add_modules()
{
+ # shellcheck disable=SC2046
manual_add_modules $(
{
cat "${DESTDIR}/lib/modules/${version}/modules.builtin"
diff --git a/hooks/fsck b/hooks/fsck
index 58b4110..6301b9b 100755
--- a/hooks/fsck
+++ b/hooks/fsck
@@ -18,6 +18,7 @@ _read_fstab_entry () {
for file in /etc/fstab /etc/fstab.d/*.fstab; do
if [ -f "$file" ]; then
+ # shellcheck disable=SC2034
while read -r MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do
case "$MNT_FSNAME" in
""|\#*)
diff --git a/hooks/resume b/hooks/resume
index 1ac24f9..97226fa 100755
--- a/hooks/resume
+++ b/hooks/resume
@@ -43,12 +43,14 @@ report_auto()
# is not ephemeral. We need to be able to read the listed swap partitions.
resume_auto=
if ! ischroot && [ -r /proc/swaps ]; then
+ # shellcheck disable=SC2013
for resume_auto in $(grep ^/dev/ /proc/swaps | sort -rnk3 | cut -d " " -f 1); do
ephemeral=false
dm_name="$(dmsetup info -c --noheadings -o name "$resume_auto" 2>/dev/null)"
# dm-crypt is ephemeral if the key file is /dev/urandom
if [ -n "$dm_name" ] && [ -e /etc/crypttab ]; then
+ # shellcheck disable=SC2034
while read -r cryptdev srcdev keyfile junk; do
if [ "$cryptdev" = "$dm_name" ] && [ "$keyfile" = /dev/urandom ]; then
ephemeral=true
diff --git a/init b/init
index e4174cd..4b6c6a9 100755
--- a/init
+++ b/init
@@ -13,6 +13,7 @@ mkdir -p /var/lock
mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
mount -t proc -o nodev,noexec,nosuid proc /proc
+# shellcheck disable=SC2013
for x in $(cat /proc/cmdline); do
case $x in
initramfs.clear)
@@ -76,6 +77,7 @@ done
. /scripts/functions
# Parse command line options
+# shellcheck disable=SC2013
for x in $(cat /proc/cmdline); do
case $x in
init=*)
@@ -102,6 +104,7 @@ for x in $(cat /proc/cmdline); do
esac
;;
nfsroot=*)
+ # shellcheck disable=SC2034
NFSROOT="${x#nfsroot=}"
;;
initramfs.runsize=*)
@@ -320,6 +323,7 @@ mount -n -o move /sys ${rootmnt}/sys
mount -n -o move /proc ${rootmnt}/proc
# Chain to real filesystem
+# shellcheck disable=SC2086,SC2094
exec run-init ${drop_caps} "${rootmnt}" "${init}" "$@" <"${rootmnt}/dev/console" >"${rootmnt}/dev/console" 2>&1
echo "Something went badly wrong in the initramfs."
panic "Please file a bug on initramfs-tools."
diff --git a/kernel/postinst.d/initramfs-tools b/kernel/postinst.d/initramfs-tools
index 81b9aee..5d02e57 100755
--- a/kernel/postinst.d/initramfs-tools
+++ b/kernel/postinst.d/initramfs-tools
@@ -32,4 +32,5 @@ if [ -n "$DEB_MAINT_PARAMS" ]; then
fi
# we're good - create initramfs. update runs do_bootloader
+# shellcheck disable=SC2086
INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -c -k "${version}" ${bootopt} >&2
diff --git a/kernel/postrm.d/initramfs-tools b/kernel/postrm.d/initramfs-tools
index 98740ee..471da86 100755
--- a/kernel/postrm.d/initramfs-tools
+++ b/kernel/postrm.d/initramfs-tools
@@ -32,4 +32,5 @@ if [ -n "$DEB_MAINT_PARAMS" ]; then
fi
# delete initramfs
+# shellcheck disable=SC2086
INITRAMFS_TOOLS_KERNEL_HOOK=1 update-initramfs -d -k "${version}" ${bootopt} >&2
diff --git a/lsinitramfs b/lsinitramfs
index 4f91a6c..1235e4d 100755
--- a/lsinitramfs
+++ b/lsinitramfs
@@ -16,6 +16,7 @@ umi_opts="--list"
OPTIONS=$(getopt -o hl --long help,long -n "$0" -- "$@")
# Check for non-GNU getopt
+# shellcheck disable=SC2181
if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi
eval set -- "$OPTIONS"
diff --git a/mkinitramfs b/mkinitramfs
index 1b15c36..c372c20 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -14,6 +14,7 @@ export BUSYBOXDIR
OPTIONS=$(getopt -o c:d:ko:r:v -n "$0" -- "$@")
# Check for non-GNU getopt
+# shellcheck disable=SC2181
if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi
eval set -- "$OPTIONS"
@@ -321,6 +322,7 @@ run_scripts /usr/share/initramfs-tools/hooks
run_scripts "${CONFDIR}"/hooks
# Avoid double sleep when using older udev scripts
+# shellcheck disable=SC2016
sed -i 's/^\s*sleep \$ROOTDELAY$/:/' "${DESTDIR}/scripts/init-top/udev"
# cache boot run order
@@ -405,6 +407,7 @@ eval "$(
} | {
LC_ALL=C sort
} | {
+ # shellcheck disable=SC2086
cpio --quiet $cpio_owner_root $cpio_reproducible -o -H newc 4>&-; echo "ec2=$?;" >&4
} | ${compress} >>"${outfile}"
echo "ec3=$?;" >&4
diff --git a/scripts/functions b/scripts/functions
index ae14eba..57ebd0d 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -117,6 +117,7 @@ load_modules()
if [ "$com" = "#" ]; then
continue
fi
+ # shellcheck disable=SC2086
modprobe $m
done < /conf/modules
fi
@@ -148,6 +149,7 @@ parse_numeric() {
;;
esac
+ # shellcheck disable=SC2034
ROOT="/dev/block/${major}:${minor}"
}
@@ -185,6 +187,7 @@ _handle_device_vs_ip()
# - Otherwise, substitute in any device name we already have
local IFS=:
set -f
+ # shellcheck disable=SC2086
set -- ${IP}
set +f
if [ -n "$6" ]; then
@@ -299,6 +302,7 @@ read_fstab_entry() {
for file in ${rootmnt?}/etc/fstab; do
if [ -f "$file" ]; then
+ # shellcheck disable=SC2034
while read -r MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do
case "$MNT_FSNAME" in
""|\#*)
diff --git a/scripts/init-top/all_generic_ide b/scripts/init-top/all_generic_ide
index 120901a..0f408d0 100755
--- a/scripts/init-top/all_generic_ide
+++ b/scripts/init-top/all_generic_ide
@@ -13,6 +13,7 @@ prereqs)
;;
esac
+# shellcheck disable=SC2013
for x in $(cat /proc/cmdline); do
case ${x} in
all_generic_ide)
diff --git a/scripts/init-top/keymap b/scripts/init-top/keymap
index 00578ce..10507fd 100755
--- a/scripts/init-top/keymap
+++ b/scripts/init-top/keymap
@@ -23,5 +23,6 @@ fi
# Load custom keymap
if [ -x /bin/loadkeys ] && [ -r /etc/boottime.kmap.gz ]; then
+ # shellcheck disable=SC2086
loadkeys ${OPTS} /etc/boottime.kmap.gz
fi
diff --git a/scripts/local b/scripts/local
index 06d93de..e3e8426 100644
--- a/scripts/local
+++ b/scripts/local
@@ -181,8 +181,10 @@ local_mount_root()
# FIXME This has no error checking
# Mount root
if [ "${FSTYPE}" != "unknown" ]; then
+ # shellcheck disable=SC2086
mount ${roflag} -t "${FSTYPE}" ${ROOTFLAGS} "${ROOT}" "${rootmnt?}"
else
+ # shellcheck disable=SC2086
mount ${roflag} ${ROOTFLAGS} "${ROOT}" "${rootmnt}"
fi
}
diff --git a/scripts/nfs b/scripts/nfs
index 275e2e4..1fce7f1 100644
--- a/scripts/nfs
+++ b/scripts/nfs
@@ -71,6 +71,7 @@ nfs_mount_root_impl()
roflag="-o rw"
fi
+ # shellcheck disable=SC2086
nfsmount -o nolock ${roflag} ${NFSOPTS} "${NFSROOT}" "${rootmnt?}"
}
@@ -121,6 +122,7 @@ nfs_mount_fs_impl()
read_fstab_entry "$1"
+ # shellcheck disable=SC2086
nfsmount ${roflag} ${NFSOPTS} -o "${MNT_OPTS}" "$MNT_FSNAME" "${rootmnt}${MNT_DIR}"
}
diff --git a/unmkinitramfs b/unmkinitramfs
index a49ab7f..9414403 100755
--- a/unmkinitramfs
+++ b/unmkinitramfs
@@ -119,6 +119,7 @@ splitinitramfs()
OPTIONS=$(getopt -o hv --long help,list,verbose -n "$0" -- "$@")
# Check for non-GNU getopt
+# shellcheck disable=SC2181
if [ $? != 0 ] ; then echo "W: non-GNU getopt" >&2 ; exit 1 ; fi
cpio_opts="--preserve-modification-time --no-absolute-filenames --quiet"
@@ -156,4 +157,5 @@ if [ $# -ne $expected_args ]; then
exit 2
fi
+# shellcheck disable=SC2086
splitinitramfs "$1" "${2:-}" $cpio_opts
diff --git a/update-initramfs b/update-initramfs
index 632c9de..749f685 100755
--- a/update-initramfs
+++ b/update-initramfs
@@ -146,6 +146,7 @@ generate_initramfs()
if [ "${verbose}" = 1 ]; then
OPTS="-v ${OPTS}"
fi
+ # shellcheck disable=SC2086
if mkinitramfs ${OPTS} "${initramfs}.new" "${version}"; then
mv -f "${initramfs}.new" "${initramfs}"
set_sha1
@@ -190,6 +191,7 @@ ro_boot_check()
return 0
fi
+ # shellcheck disable=SC1004
boot_opts=$(awk '/boot/{if ((match($4, /^ro/) || match($4, /,ro/)) \
&& $2 == "/boot") print "ro"}' /proc/mounts)
if [ -n "${boot_opts}" ]; then
@@ -243,6 +245,7 @@ set_highest_version()
version=
return
fi
+ # shellcheck disable=SC2086
set -- ${version_list}
version=${1}
}
@@ -376,6 +379,7 @@ if [ "${version}" = "all" ] \
fi
for u_version in ${version_list}; do
verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}"
+ # shellcheck disable=SC2086
"${0}" -${mode} -k "${u_version}" ${OPTS}
done
exit 0