hooks/*: code cleanup

This commit is contained in:
illiliti 2021-05-10 14:23:34 +03:00
parent e8858c1d34
commit 61e9112142
19 changed files with 33 additions and 41 deletions

View File

@ -1,7 +1,7 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
for _binary in udevd udevadm; do

View File

@ -1,8 +1,8 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# shellcheck disable=2154,2034
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
[ "$break" = eudev ] && { print "break before eudev.init"; sh; }

View File

@ -1,7 +1,4 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# shellcheck disable=2154
udevadm control -e

View File

@ -1,7 +1,7 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
copy_file "$keymap_path" "$keymap_path" 644 0

View File

@ -1,9 +1,10 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
[ "$break" = keymap ] && { print "break before keymap.init"; sh; }
# TODO support loadkeys
loadkmap < "$keymap_path"

View File

@ -1,7 +1,7 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
[ "$luks_key" ] && {
@ -30,8 +30,7 @@
copy_module "$_module"
done
# avoid possible issues with libgcc_s.so.1
# see https://bugs.archlinux.org/task/56771
# https://bugs.archlinux.org/task/56771
[ -e /lib/libgcc_s.so.1 ] && copy_file /lib/libgcc_s.so.1 /lib/libgcc_s.so.1 755 1
copy_binary cryptsetup

View File

@ -1,21 +1,17 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
#
# word splitting is safe by design
# shellcheck disable=2068
[ "$break" = luks ] && { print "break before luks.init"; sh; }
export DM_DISABLE_UDEV=1
mkdir -p /run/cryptsetup
resolve_device "$luks_root"
set -- \
"${luks_discard:+--allow-discards}" "${luks_header:+--header $luks_header}" \
"${luks_key:+-d $luks_key}" "$device" "${luks_name:-crypt-${device##*/}}"
cryptsetup open $@ || panic "failed to unlock LUKS"
DM_DISABLE_UDEV=1 cryptsetup open \
"${luks_discard:+--allow-discards}" \
"${luks_header:+--header=$luks_header}" \
"${luks_key:+--key-file=$luks_key}" -- "$device" \
"${luks_name:-crypt-${device##*/}}" || panic "failed to unlock LUKS"

View File

@ -1,7 +1,7 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
[ "$hostonly" = 1 ] &&

View File

@ -1,11 +1,9 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# shellcheck disable=2154
#
# word splitting is safe by design
# shellcheck disable=2068
# https://www.shellcheck.net/wiki/SC2154
# https://www.shellcheck.net/wiki/SC2068
# shellcheck disable=2154,2068
[ "$break" = lvm ] && { print "break before lvm.init"; sh; }

View File

@ -1,7 +1,8 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# https://www.shellcheck.net/wiki/SC2016
# shellcheck disable=2154,2016
for _binary in mdev find; do

View File

@ -1,7 +1,8 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# https://www.shellcheck.net/wiki/SC2034
# shellcheck disable=2154,2034
[ "$break" = mdev ] && { print "break before mdev.init"; sh; }

View File

@ -1,7 +1,7 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
kill "$mdev_pid"

View File

@ -1,7 +1,8 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# https://www.shellcheck.net/wiki/SC2016
# shellcheck disable=2154,2016
for _binary in mdevd mdevd-coldplug; do

View File

@ -1,7 +1,8 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# https://www.shellcheck.net/wiki/SC2034
# shellcheck disable=2154,2034
[ "$break" = mdevd ] && { print "break before mdevd.init"; sh; }

View File

@ -1,7 +1,7 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
kill "$mdevd_pid"

View File

@ -1,14 +1,14 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
[ "$break" = proc ] && { print "break before proc.init"; sh; }
command -v device-helper > /proc/sys/kernel/hotplug
# get ready for fork bomb. kek
# Prepare for fork bomb!
find /sys/devices -name uevent |
while read -r uevent; do

View File

@ -1,7 +1,7 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
for _binary in /lib/systemd/systemd-udevd udevadm; do

View File

@ -1,8 +1,8 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# shellcheck disable=2154,2034
# https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154
[ "$break" = systemd-udevd ] && { print "break before systemd-udevd.init"; sh; }

View File

@ -1,7 +1,4 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# false positive
# shellcheck disable=2154
udevadm control -e