[PATCH 2/2] [scripts] Don't hardcode LIBEXECDIR and DATADIR paths

Scott James Remnant scott at ubuntu.com
Tue Mar 2 10:13:26 PST 2010


The scripts hard-coded the paths for LIBEXECDIR and DATADIR, unless
passed as environment variables.  Instead of doing this, which breaks
if plymouth is installed outside of /usr, set these derived from the
configure @libexecdir@ and @datadir@ variables just as we do for
pkg-config, etc.

Since we use so many variables, it makes more sense to generate these
scripts from config.status rather than having special Makefile rules
for them.
---
 configure.ac                          |    2 ++
 scripts/Makefile.am                   |   16 ----------------
 scripts/plymouth-populate-initrd.in   |   11 +++++++++--
 scripts/plymouth-set-default-theme.in |   13 ++++++++++---
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6ade4c8..7b2390e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -245,6 +245,8 @@ AC_OUTPUT([Makefile
            themes/glow/Makefile
            themes/script/Makefile
            images/Makefile
+	   scripts/plymouth-populate-initrd
+	   scripts/plymouth-set-default-theme
            scripts/Makefile
            docs/Makefile
 ])
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 3de5046..dea4caf 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -6,25 +6,9 @@ initrdscript_SCRIPTS = plymouth-update-initrd plymouth-generate-initrd plymouth-
 sbinscriptsdir = $(sbindir)
 sbinscripts_SCRIPTS = plymouth-set-default-theme
 
-plymouth-populate-initrd: $(srcdir)/plymouth-populate-initrd.in
-	sed -e 's,[@]logofile[@],$(logofile),g'                                \
-	    -e 's,[@]plymouthclientdir[@],$(plymouthclientdir),g'              \
-	    -e 's,[@]plymouthdaemondir[@],$(plymouthdaemondir),g'              \
-	    -e 's,[@]RELEASE_FILE[@],$(RELEASE_FILE),g'              \
-	    $(srcdir)/plymouth-populate-initrd.in > plymouth-populate-initrd
-
-plymouth-set-default-theme: $(srcdir)/plymouth-set-default-theme.in
-	sed -e 's,[@]logofile[@],$(logofile),g'                                \
-	    -e 's,[@]plymouthclientdir[@],$(plymouthclientdir),g'              \
-	    -e 's,[@]plymouthdaemondir[@],$(plymouthdaemondir),g'              \
-	    $(srcdir)/plymouth-set-default-theme.in > plymouth-set-default-theme
-
 EXTRA_DIST= plymouth-update-initrd                                             \
 	    plymouth-generate-initrd                                           \
 	    plymouth-populate-initrd.in                                        \
 	    plymouth-set-default-theme.in                                     \
 	    $(noinst_SCRIPTS)                                                  \
 	    default.cfg
-
-CLEANFILES = plymouth-populate-initrd plymouth-set-default-theme
-MAINTAINERCLEANFILES = Makefile.in plymouth-populate-initrd plymouth-set-default-theme
diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
index 14eb6fc..db545d7 100755
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -2,8 +2,15 @@
 
 [ -z "$DESTDIR" ] || exit 0
 
-[ -z "$LIBEXECDIR" ] && LIBEXECDIR="/usr/libexec"
-[ -z "$DATADIR" ] && DATADIR="/usr/share"
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+libexecdir="@libexecdir@"
+datarootdir="@datarootdir@"
+datadir="@datadir@"
+
+[ -z "$LIBEXECDIR" ] && LIBEXECDIR="${libexecdir}"
+[ -z "$DATADIR" ] && DATADIR="${datadir}"
 [ -z "$PLYMOUTH_PLUGIN_PATH" ] && PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
 [ -z "$PLYMOUTH_LOGO_FILE" ] && PLYMOUTH_LOGO_FILE="@logofile@"
 [ -z "$PLYMOUTH_THEME_NAME" ] && PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme)
diff --git a/scripts/plymouth-set-default-theme.in b/scripts/plymouth-set-default-theme.in
index e5e2ef0..aeea304 100755
--- a/scripts/plymouth-set-default-theme.in
+++ b/scripts/plymouth-set-default-theme.in
@@ -2,13 +2,20 @@
 
 set -e
 
-[ -z "$LIBEXECDIR" ] && LIBEXECDIR="/usr/libexec"
-[ -z "$DATADIR" ] && DATADIR="/usr/share"
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libdir="@libdir@"
+libexecdir="@libexecdir@"
+datarootdir="@datarootdir@"
+datadir="@datadir@"
+
+[ -z "$LIBEXECDIR" ] && LIBEXECDIR="${libexec}"
+[ -z "$DATADIR" ] && DATADIR="${datadir}"
 if [ -z "$PLYMOUTH_PLUGIN_PATH" ]; then
     if [ -z "$LIB" ]; then
         PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
     else
-        [ -z "$LIBDIR" ] && LIBDIR="/usr/$LIB"
+        [ -z "$LIBDIR" ] && LIBDIR="${libdir}"
         PLYMOUTH_PLUGIN_PATH=${LIBDIR}/plymouth/
     fi
 fi
-- 
1.6.3.3



More information about the plymouth mailing list