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: # vim: set ft=sh:
# shellcheck shell=sh # shellcheck shell=sh
# #
# false positive # https://www.shellcheck.net/wiki/SC2154
# shellcheck disable=2154 # shellcheck disable=2154
for _binary in udevd udevadm; do for _binary in udevd udevadm; do

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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