Blob Blame Raw
From 736822e2f273596e0a7179f5384002903be3d3db Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 9 Sep 2009 11:26:46 -0400
Subject: [PATCH] [populate-initrd] Try to find inst more aggressively

We've been using the inst function provided by mkinitrd
to install plymouth and its dependencies into the initrd
root, but mkinitrd may not be installed in a dracut world,
and dracut has its own inst function.

This commit tries getting access to either of them, before
bailing. At some point we may want to bundle our own inst
function or get a new flag added to /usr/bin/install to do
what inst does.
---
 scripts/plymouth-populate-initrd.in |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
index 3857197..dd502b9 100755
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -8,10 +8,23 @@
 [ -z "$PLYMOUTH_LOGO_FILE" ] && PLYMOUTH_LOGO_FILE="@logofile@"
 [ -z "$PLYMOUTH_THEME_NAME" ] && PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme)
 
-if [ -f "${LIBEXECDIR}/initrd-functions" ]; then
-    . "${LIBEXECDIR}/initrd-functions"
-else
-    echo "Couldn't import initrd functions." > /dev/stderr
+if [ -z "$PLYMOUTH_POPULATE_SOURCE_FUNCTIONS" ]; then
+
+    if [ -f "${LIBEXECDIR}/initrd-functions" ]; then
+        PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="${LIBEXECDIR}/initrd-functions"
+    fi
+
+    if [ -f "${DATADIR}/dracut/dracut-functions" ]; then
+        PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="${DATADIR}/dracut/dracut-functions"
+    fi
+fi
+
+if [ -n "$PLYMOUTH_POPULATE_SOURCE_FUNCTIONS" ]; then
+    source $PLYMOUTH_POPULATE_SOURCE_FUNCTIONS
+fi
+
+if [ " $(type -t inst) " != " function " ]; then
+    echo "Need 'inst' function, try setting PLYMOUTH_POPULATE_SOURCE_FUNCTIONS to a file that defines it" 1>&2
     exit 1
 fi
 
@@ -48,7 +61,7 @@ while [ $# -gt 0 ]; do
     esac
     shift
 done
-set_verbose $verbose
+set_verbose $verbose || :
 
 [ -z "$INITRDDIR" ] && usage error
 
-- 
1.6.4.2

From 3c2e1453d9652bbe6a29d89edd80664b87ab7271 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 10 Sep 2009 09:54:44 -0400
Subject: [PATCH] [populate-initrd] Don't require set_verbose function

If it's not around, define it, so we can use it without error
---
 scripts/plymouth-populate-initrd.in |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
index dd502b9..dcf2b42 100755
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -28,6 +28,10 @@ if [ " $(type -t inst) " != " function " ]; then
     exit 1
 fi
 
+if [ " $(type -t set_verbose) " != " function " ]; then
+    function set_verbose { true; }
+fi
+
 function usage() {
     local output="/dev/stdout"
     local rc=0
-- 
1.6.4.2