Separate custom comments from shellcheck comments

Having a shellcheck directive and custom comments in the same line can trigger SC1107 on old versions of shellcheck.
This commit is contained in:
nl6720 2020-07-16 15:49:23 +03:00
parent 2993b80816
commit b40fb2ae53
No known key found for this signature in database
GPG Key ID: 5CE88535E188D369
6 changed files with 38 additions and 19 deletions

View File

@ -63,7 +63,8 @@ _mnt_sfs() {
local img_fullname="${img##*/}" local img_fullname="${img##*/}"
local sfs_dev local sfs_dev
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ "${copytoram}" = "y" ]; then if [ "${copytoram}" = "y" ]; then
msg -n ":: Copying squashfs image to RAM..." msg -n ":: Copying squashfs image to RAM..."
if ! cp -- "${img}" "/run/archiso/copytoram/${img_fullname}" ; then if ! cp -- "${img}" "/run/archiso/copytoram/${img_fullname}" ; then
@ -129,10 +130,12 @@ run_hook() {
[ -z "${copytoram_size}" ] && copytoram_size="75%" [ -z "${copytoram_size}" ] && copytoram_size="75%"
[ -z "${archisobasedir}" ] && archisobasedir="arch" [ -z "${archisobasedir}" ] && archisobasedir="arch"
[ -z "${dm_snap_prefix}" ] && dm_snap_prefix="arch" [ -z "${dm_snap_prefix}" ] && dm_snap_prefix="arch"
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
[ -z "${archisodevice}" ] && archisodevice="/dev/disk/by-label/${archisolabel}" [ -z "${archisodevice}" ] && archisodevice="/dev/disk/by-label/${archisolabel}"
[ -z "${cow_spacesize}" ] && cow_spacesize="256M" [ -z "${cow_spacesize}" ] && cow_spacesize="256M"
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ -n "${cow_label}" ]; then if [ -n "${cow_label}" ]; then
cow_device="/dev/disk/by-label/${cow_label}" cow_device="/dev/disk/by-label/${cow_label}"
[ -z "${cow_persistent}" ] && cow_persistent="P" [ -z "${cow_persistent}" ] && cow_persistent="P"
@ -163,7 +166,8 @@ archiso_mount_handler() {
fi fi
fi fi
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ "${checksum}" = "y" ]; then if [ "${checksum}" = "y" ]; then
if [ -f "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sha512" ]; then if [ -f "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sha512" ]; then
msg -n ":: Self-test requested, please wait..." msg -n ":: Self-test requested, please wait..."
@ -180,7 +184,8 @@ archiso_mount_handler() {
fi fi
fi fi
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ "${verify}" = "y" ]; then if [ "${verify}" = "y" ]; then
if [ -f "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sfs.sig" ]; then if [ -f "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sfs.sig" ]; then
msg -n ":: Signature verification requested, please wait..." msg -n ":: Signature verification requested, please wait..."

View File

@ -1,10 +1,12 @@
#!/bin/ash #!/bin/ash
run_hook () { run_hook () {
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
[ -n "${img_label}" ] && img_dev="/dev/disk/by-label/${img_label}" [ -n "${img_label}" ] && img_dev="/dev/disk/by-label/${img_label}"
[ -z "${img_flags}" ] && img_flags="defaults" [ -z "${img_flags}" ] && img_flags="defaults"
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ -n "${img_dev}" ] && [ -n "${img_loop}" ]; then if [ -n "${img_dev}" ] && [ -n "${img_loop}" ]; then
export mount_handler="archiso_loop_mount_handler" export mount_handler="archiso_loop_mount_handler"
fi fi
@ -17,7 +19,8 @@ archiso_loop_mount_handler () {
msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}" msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}"
_mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r" "${img_flags}" _mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r" "${img_flags}"
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ "${copytoram}" != "y" ]; then if [ "${copytoram}" != "y" ]; then
readlink -f "${img_dev}" >> /run/archiso/used_block_devices readlink -f "${img_dev}" >> /run/archiso/used_block_devices
fi fi

View File

@ -11,7 +11,8 @@ run_hook () {
if [ -n "${ip}" ]; then if [ -n "${ip}" ]; then
if [ -n "${BOOTIF}" ]; then if [ -n "${BOOTIF}" ]; then
bootif_mac="${BOOTIF#01-}" bootif_mac="${BOOTIF#01-}"
# shellcheck disable=SC2169 # ash supports bash-like string replacment # shellcheck disable=SC2169
# ash supports bash-like string replacment
bootif_mac="${bootif_mac//-/:}" bootif_mac="${bootif_mac//-/:}"
for i in /sys/class/net/*/address; do for i in /sys/class/net/*/address; do
read -r net_mac < "${i}" read -r net_mac < "${i}"
@ -36,7 +37,8 @@ run_hook () {
launch_interactive_shell launch_interactive_shell
fi fi
# shellcheck disable=SC1090 # ipconfig generates these files # shellcheck disable=SC1090
# ipconfig generates these files
. /tmp/net-*.conf . /tmp/net-*.conf
export pxeserver="${ROOTSERVER}" export pxeserver="${ROOTSERVER}"
@ -60,7 +62,8 @@ run_latehook () {
if [ -n "${ip}" ]; then if [ -n "${ip}" ]; then
[ -z "${copy_resolvconf}" ] && copy_resolvconf="y" [ -z "${copy_resolvconf}" ] && copy_resolvconf="y"
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ "${copytoram}" = "y" ]; then if [ "${copytoram}" = "y" ]; then
if [ -n "${bootif_dev}" ]; then if [ -n "${bootif_dev}" ]; then
ip addr flush dev "${bootif_dev}" ip addr flush dev "${bootif_dev}"

View File

@ -1,7 +1,8 @@
#!/bin/ash #!/bin/ash
run_hook() { run_hook() {
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ -n "${ip}" ] && [ -n "${archiso_http_srv}" ]; then if [ -n "${ip}" ] && [ -n "${archiso_http_srv}" ]; then
# booting with http is always copy-to-ram, so set here to make sure # booting with http is always copy-to-ram, so set here to make sure
@ -24,7 +25,8 @@ _curl_get() {
local _dst="${2}" local _dst="${2}"
msg ":: Downloading '${_url}'" msg ":: Downloading '${_url}'"
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if ! curl -L -f -o "/run/archiso/httpspace/${archisobasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then if ! curl -L -f -o "/run/archiso/httpspace/${archisobasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then
echo "ERROR: Downloading '${_url}'" echo "ERROR: Downloading '${_url}'"
echo " Falling back to interactive prompt" echo " Falling back to interactive prompt"
@ -40,14 +42,17 @@ archiso_pxe_http_mount_handler () {
mkdir -p "/run/archiso/httpspace" mkdir -p "/run/archiso/httpspace"
mount -t tmpfs -o size="${archiso_http_spc}",mode=0755 httpspace "/run/archiso/httpspace" mount -t tmpfs -o size="${archiso_http_spc}",mode=0755 httpspace "/run/archiso/httpspace"
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
_curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sfs" "/${arch}" _curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sfs" "/${arch}"
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ "${checksum}" = "y" ]; then if [ "${checksum}" = "y" ]; then
_curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sha512" "/${arch}" _curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sha512" "/${arch}"
fi fi
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ "${verify}" = "y" ]; then if [ "${verify}" = "y" ]; then
_curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sfs.sig" "/${arch}" _curl_get "${archiso_http_srv}${archisobasedir}/${arch}/airootfs.sfs.sig" "/${arch}"
fi fi

View File

@ -1,7 +1,8 @@
#!/bin/ash #!/bin/ash
run_earlyhook() { run_earlyhook() {
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ -n "${ip}" ] && [ -n "${archiso_nbd_srv}" ]; then if [ -n "${ip}" ] && [ -n "${archiso_nbd_srv}" ]; then
# Module autoloading like with loop devices does not work, doing manually... # Module autoloading like with loop devices does not work, doing manually...
modprobe nbd 2> /dev/null modprobe nbd 2> /dev/null

View File

@ -1,7 +1,8 @@
#!/bin/ash #!/bin/ash
run_hook() { run_hook() {
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ -n "${ip}" ] && [ -n "${archiso_nfs_srv}" ]; then if [ -n "${ip}" ] && [ -n "${archiso_nfs_srv}" ]; then
archiso_nfs_srv=$(eval echo "${archiso_nfs_srv}") archiso_nfs_srv=$(eval echo "${archiso_nfs_srv}")
@ -15,7 +16,8 @@ archiso_nfs_mount_handler() {
newroot="${1}" newroot="${1}"
mkdir -p "/run/archiso/bootmnt" mkdir -p "/run/archiso/bootmnt"
msg ":: Mounting '${archiso_nfs_srv}'" msg ":: Mounting '${archiso_nfs_srv}'"
# shellcheck disable=SC2154 # defined via initcpio's parse_cmdline() # shellcheck disable=SC2154
# defined via initcpio's parse_cmdline()
if [ -n "${archiso_nfs_opt}" ]; then if [ -n "${archiso_nfs_opt}" ]; then
nfsmount -o "${archiso_nfs_opt}" "${archiso_nfs_srv}" "/run/archiso/bootmnt" nfsmount -o "${archiso_nfs_opt}" "${archiso_nfs_srv}" "/run/archiso/bootmnt"
mount_status=$? mount_status=$?