From: Harald Hoyer Date: Fri, 26 Mar 2021 09:29:17 +0000 (+0100) Subject: fix(plymouth): shellcheck for modules.d/50plymouth X-Git-Tag: 054~243 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4cdc2521006874311ac2031b3fdaa93ba583b2e;p=thirdparty%2Fdracut.git fix(plymouth): shellcheck for modules.d/50plymouth --- diff --git a/modules.d/50plymouth/.shchkdir b/modules.d/50plymouth/.shchkdir new file mode 100644 index 000000000..e69de29bb diff --git a/modules.d/50plymouth/module-setup.sh b/modules.d/50plymouth/module-setup.sh index 1c227a9e3..32aa3ff8b 100755 --- a/modules.d/50plymouth/module-setup.sh +++ b/modules.d/50plymouth/module-setup.sh @@ -6,8 +6,8 @@ pkglib_dir() { _dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth" fi for _dir in $_dirs; do - if [ -x $dracutsysrootdir$_dir/plymouth-populate-initrd ]; then - echo $_dir + if [ -x "$dracutsysrootdir""$_dir"/plymouth-populate-initrd ]; then + echo "$_dir" return fi done @@ -16,7 +16,7 @@ pkglib_dir() { # called by dracut check() { [[ "$mount_needs" ]] && return 1 - [ -z $(pkglib_dir) ] && return 1 + [[ $(pkglib_dir) ]] || return 1 require_binaries plymouthd plymouth plymouth-set-default-theme } @@ -29,12 +29,13 @@ depends() { # called by dracut install() { PKGLIBDIR=$(pkglib_dir) - if grep -q nash $dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd \ - || [ ! -x $dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd ]; then + if grep -q nash "$dracutsysrootdir""${PKGLIBDIR}"/plymouth-populate-initrd \ + || [ ! -x "$dracutsysrootdir""${PKGLIBDIR}"/plymouth-populate-initrd ]; then + # shellcheck disable=SC1090 . "$moddir"/plymouth-populate-initrd.sh else PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \ - $dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd -t "$initdir" + "$dracutsysrootdir""${PKGLIBDIR}"/plymouth-populate-initrd -t "$initdir" fi inst_hook emergency 50 "$moddir"/plymouth-emergency.sh diff --git a/modules.d/50plymouth/plymouth-newroot.sh b/modules.d/50plymouth/plymouth-newroot.sh index 3bffa4d90..944f2dc60 100755 --- a/modules.d/50plymouth/plymouth-newroot.sh +++ b/modules.d/50plymouth/plymouth-newroot.sh @@ -1,5 +1,5 @@ #!/bin/sh if type plymouth > /dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then - plymouth --newroot=$NEWROOT + plymouth --newroot="$NEWROOT" fi diff --git a/modules.d/50plymouth/plymouth-populate-initrd.sh b/modules.d/50plymouth/plymouth-populate-initrd.sh index 32f6cf307..52baa2105 100755 --- a/modules.d/50plymouth/plymouth-populate-initrd.sh +++ b/modules.d/50plymouth/plymouth-populate-initrd.sh @@ -8,6 +8,7 @@ inst_multiple plymouthd plymouth \ test -e "${PLYMOUTH_LOGO_FILE}" && inst_simple "${PLYMOUTH_LOGO_FILE}" +# shellcheck disable=SC2174 mkdir -m 0755 -p "${initdir}/usr/share/plymouth" inst_libdir_file "plymouth/text.so" "plymouth/details.so" @@ -20,25 +21,26 @@ if [[ $hostonly ]]; then if [[ -d $dracutsysrootdir/usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/*; do [[ -f "$dracutsysrootdir$x" ]] || break - inst $x + inst "$x" done fi if [[ -L $dracutsysrootdir/usr/share/plymouth/themes/default.plymouth ]]; then inst /usr/share/plymouth/themes/default.plymouth # Install plugin for this theme - PLYMOUTH_PLUGIN=$(grep "^ModuleName=" "$dracutsysrootdir"/usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done) + PLYMOUTH_PLUGIN=$(grep "^ModuleName=" "$dracutsysrootdir"/usr/share/plymouth/themes/default.plymouth | while read -r _ b _ || [ -n "$b" ]; do echo "$b"; done) inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so" fi else for x in "$dracutsysrootdir"/usr/share/plymouth/themes/{text,details}/*; do [[ -f $x ]] || continue THEME_DIR=$(dirname "${x#$dracutsysrootdir}") + # shellcheck disable=SC2174 mkdir -m 0755 -p "${initdir}/$THEME_DIR" inst_multiple "${x#$dracutsysrootdir}" done ( - cd ${initdir}/usr/share/plymouth/themes + cd "${initdir}"/usr/share/plymouth/themes || exit ln -s text/text.plymouth default.plymouth 2>&1 ) fi diff --git a/modules.d/50plymouth/plymouth-pretrigger.sh b/modules.d/50plymouth/plymouth-pretrigger.sh index 59aa99159..3d1199902 100755 --- a/modules.d/50plymouth/plymouth-pretrigger.sh +++ b/modules.d/50plymouth/plymouth-pretrigger.sh @@ -16,7 +16,7 @@ if type plymouthd > /dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then info "Starting plymouth daemon" mkdir -m 0755 /run/plymouth - read consoledev rest < /sys/class/tty/console/active + read -r consoledev rest < /sys/class/tty/console/active consoledev=${consoledev:-tty0} [ -x /lib/udev/console_init -a -e "/dev/$consoledev" ] && /lib/udev/console_init "/dev/$consoledev" plymouthd --attach-to-session --pid-file /run/plymouth/pid