]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(plymouth): shellcheck for modules.d/50plymouth
authorHarald Hoyer <harald@redhat.com>
Fri, 26 Mar 2021 09:29:17 +0000 (10:29 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 29 Mar 2021 08:42:20 +0000 (10:42 +0200)
modules.d/50plymouth/.shchkdir [new file with mode: 0644]
modules.d/50plymouth/module-setup.sh
modules.d/50plymouth/plymouth-newroot.sh
modules.d/50plymouth/plymouth-populate-initrd.sh
modules.d/50plymouth/plymouth-pretrigger.sh

diff --git a/modules.d/50plymouth/.shchkdir b/modules.d/50plymouth/.shchkdir
new file mode 100644 (file)
index 0000000..e69de29
index 1c227a9e30fa315e2414d454f2490348b2e77b91..32aa3ff8b90c4d7eb08011aa216f279b71388765 100755 (executable)
@@ -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
index 3bffa4d9046f49171baecf245176abff40f5650b..944f2dc60c29b565321bb8b5c99337ac4515ccbf 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
 
 if type plymouth > /dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then
-    plymouth --newroot=$NEWROOT
+    plymouth --newroot="$NEWROOT"
 fi
index 32f6cf307945ec7c29a32bfdb6904d987b7a789a..52baa210598d2a4988a71fc35b731b7fe3f57677 100755 (executable)
@@ -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
index 59aa99159de836a25757e307afbae905f6e16395..3d1199902525a133811e36982b4ed6388f5c56ee 100755 (executable)
@@ -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