]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
50plymouth: improve distro compatibility
authorDaniel Molkentin <dmolkentin@suse.com>
Thu, 18 Jan 2018 16:45:01 +0000 (17:45 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Tue, 30 Jan 2018 09:14:22 +0000 (10:14 +0100)
The existence of dpkg-achitecture is not indicative of a debian
installation. It may well be installed on systems of people who
package for both distros. The previous code path did not take
that into account.

We now traverse all known plymouth directories, locking on the first
valid one, and try to work with it.

At the same time, we do not include the module if the plymouth directory
could not be found.

modules.d/50plymouth/module-setup.sh

index 27dafcac0e6363bc1eddc2dbc81770abecee98c1..5fbca8b00f65bf725beabca6aa5a74fa26e377c5 100755 (executable)
@@ -1,8 +1,23 @@
 #!/bin/bash
 
+pkglib_dir() {
+    local _dirs="/usr/lib/plymouth /usr/libexec/plymouth/"
+    if type -P dpkg-architecture &>/dev/null; then
+        _dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
+    fi
+    for _dir in $_dirs; do
+        if [ -d $_dir ]; then
+            echo $_dir
+            return
+        fi
+    done
+}
+
 # called by dracut
 check() {
     [[ "$mount_needs" ]] && return 1
+    [ -z $(pkglib_dir) ] && return 1
+
     require_binaries plymouthd plymouth plymouth-set-default-theme
 }
 
@@ -13,12 +28,7 @@ depends() {
 
 # called by dracut
 install() {
-    PKGLIBDIR="/usr/lib/plymouth"
-    if type -P dpkg-architecture &>/dev/null; then
-        PKGLIBDIR="/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
-    fi
-    [ -x /usr/libexec/plymouth/plymouth-populate-initrd ] && PKGLIBDIR="/usr/libexec/plymouth"
-
+    PKGLIBDIR=$(pkglib_dir)
     if grep -q nash ${PKGLIBDIR}/plymouth-populate-initrd \
         || [ ! -x ${PKGLIBDIR}/plymouth-populate-initrd ]; then
         . "$moddir"/plymouth-populate-initrd.sh