[PATCH v2] [scripts] Don't hardcode LIBEXECDIR and DATADIR paths
Scott James Remnant
scott at ubuntu.com
Tue Mar 2 12:06:43 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 | 7 +++++++
scripts/Makefile.am | 18 +-----------------
scripts/plymouth-generate-initrd | 24 ------------------------
scripts/plymouth-generate-initrd.in | 24 ++++++++++++++++++++++++
scripts/plymouth-populate-initrd.in | 28 ++++++++++++++--------------
scripts/plymouth-set-default-theme.in | 28 ++++++++++++++--------------
6 files changed, 60 insertions(+), 69 deletions(-)
delete mode 100755 scripts/plymouth-generate-initrd
create mode 100755 scripts/plymouth-generate-initrd.in
diff --git a/configure.ac b/configure.ac
index 6ade4c8..fafef27 100644
--- a/configure.ac
+++ b/configure.ac
@@ -208,6 +208,10 @@ AS_AC_EXPAND(PLYMOUTH_THEME_PATH, $plymouththemedir)
plymouthplugindir=$libdir/plymouth/
AS_AC_EXPAND(PLYMOUTH_PLUGIN_PATH, $plymouthplugindir)
+AS_AC_EXPAND(PLYMOUTH_LIBDIR, $libdir)
+AS_AC_EXPAND(PLYMOUTH_LIBEXECDIR, $libexecdir)
+AS_AC_EXPAND(PLYMOUTH_DATADIR, $datadir)
+
AC_OUTPUT([Makefile
src/libply/Makefile
src/libply-splash-core/Makefile
@@ -245,6 +249,9 @@ AC_OUTPUT([Makefile
themes/glow/Makefile
themes/script/Makefile
images/Makefile
+ scripts/plymouth-generate-initrd
+ 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..ba492df 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-generate-initrd.in \
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-generate-initrd b/scripts/plymouth-generate-initrd
deleted file mode 100755
index 1a2ca83..0000000
--- a/scripts/plymouth-generate-initrd
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-[ -z "$DESTDIR" ] || exit 0
-
-[ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="/usr/libexec"
-[ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="/usr/share"
-[ -z "$PLYMOUTH_POPULATE_INITRD" ] && PLYMOUTH_POPULATE_INITRD="$PLYMOUTH_LIBEXECDIR/plymouth/plymouth-populate-initrd"
-[ -z "$PLYMOUTH_DESTDIR" ] && PLYMOUTH_DESTDIR="/boot"
-[ -z "$PLYMOUTH_IMAGE_FILE" ] && PLYMOUTH_IMAGE_FILE="$PLYMOUTH_DESTDIR/initrd-plymouth.img"
-
-PLYMOUTH_INITRD_DIR="$(mktemp --tmpdir -d plymouth-XXXXXXX)"
-
-$PLYMOUTH_POPULATE_INITRD -t "$PLYMOUTH_INITRD_DIR"
-
-if [ $? -eq 0 ]; then
- (cd $PLYMOUTH_INITRD_DIR;
- # FIXME: might make sense to add a flag to plymouth-populate-initrd to
- # skip these from the start
- rm -f lib*/{ld*,libc*,libdl*,libm*,libz*,libpthread*}
- find | cpio -Hnewc -o | gzip -9 > $PLYMOUTH_IMAGE_FILE
- )
-fi
-
-rm -rf $PLYMOUTH_INITRD_DIR
diff --git a/scripts/plymouth-generate-initrd.in b/scripts/plymouth-generate-initrd.in
new file mode 100755
index 0000000..35509a1
--- /dev/null
+++ b/scripts/plymouth-generate-initrd.in
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+[ -z "$DESTDIR" ] || exit 0
+
+[ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="@PLYMOUTH_LIBEXECDIR@"
+[ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="@PLYMOUTH_DATADIR@"
+[ -z "$PLYMOUTH_POPULATE_INITRD" ] && PLYMOUTH_POPULATE_INITRD="${PLYMOUTH_LIBEXECDIR}/plymouth/plymouth-populate-initrd"
+[ -z "$PLYMOUTH_DESTDIR" ] && PLYMOUTH_DESTDIR="/boot"
+[ -z "$PLYMOUTH_IMAGE_FILE" ] && PLYMOUTH_IMAGE_FILE="${PLYMOUTH_DESTDIR}/initrd-plymouth.img"
+
+PLYMOUTH_INITRD_DIR="$(mktemp --tmpdir -d plymouth-XXXXXXX)"
+
+$PLYMOUTH_POPULATE_INITRD -t "$PLYMOUTH_INITRD_DIR"
+
+if [ $? -eq 0 ]; then
+ (cd $PLYMOUTH_INITRD_DIR;
+ # FIXME: might make sense to add a flag to plymouth-populate-initrd to
+ # skip these from the start
+ rm -f lib*/{ld*,libc*,libdl*,libm*,libz*,libpthread*}
+ find | cpio -Hnewc -o | gzip -9 > $PLYMOUTH_IMAGE_FILE
+ )
+fi
+
+rm -rf $PLYMOUTH_INITRD_DIR
diff --git a/scripts/plymouth-populate-initrd.in b/scripts/plymouth-populate-initrd.in
index 14eb6fc..0214ee3 100755
--- a/scripts/plymouth-populate-initrd.in
+++ b/scripts/plymouth-populate-initrd.in
@@ -2,20 +2,20 @@
[ -z "$DESTDIR" ] || exit 0
-[ -z "$LIBEXECDIR" ] && LIBEXECDIR="/usr/libexec"
-[ -z "$DATADIR" ] && DATADIR="/usr/share"
+[ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="@PLYMOUTH_LIBEXECDIR@"
+[ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="@PLYMOUTH_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)
if [ -z "$PLYMOUTH_POPULATE_SOURCE_FUNCTIONS" ]; then
- if [ -f "${LIBEXECDIR}/initrd-functions" ]; then
- PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="${LIBEXECDIR}/initrd-functions"
+ if [ -f "${PLYMOUTH_LIBEXECDIR}/initrd-functions" ]; then
+ PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="${PLYMOUTH_LIBEXECDIR}/initrd-functions"
fi
- if [ -f "${DATADIR}/dracut/dracut-functions" ]; then
- PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="${DATADIR}/dracut/dracut-functions"
+ if [ -f "${PLYMOUTH_DATADIR}/dracut/dracut-functions" ]; then
+ PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="${PLYMOUTH_DATADIR}/dracut/dracut-functions"
fi
fi
@@ -69,12 +69,12 @@ set_verbose $verbose || :
[ -z "$INITRDDIR" ] && usage error
-mkdir -p ${INITRDDIR}${DATADIR}/plymouth/themes
+mkdir -p ${INITRDDIR}${PLYMOUTH_DATADIR}/plymouth/themes
inst /sbin/plymouthd $INITRDDIR /bin/plymouthd
inst /bin/plymouth $INITRDDIR
-inst ${DATADIR}/plymouth/themes/text/text.plymouth $INITRDDIR
+inst ${PLYMOUTH_DATADIR}/plymouth/themes/text/text.plymouth $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/text.so $INITRDDIR
-inst ${DATADIR}/plymouth/themes/details/details.plymouth $INITRDDIR
+inst ${PLYMOUTH_DATADIR}/plymouth/themes/details/details.plymouth $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/details.so $INITRDDIR
inst ${PLYMOUTH_LOGO_FILE} $INITRDDIR
inst @RELEASE_FILE@ $INITRDDIR
@@ -84,7 +84,7 @@ if [ -z "$PLYMOUTH_THEME_NAME" ]; then
exit 1
fi
-PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//')
+PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//')
if [ ! -f ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then
echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" > /dev/stderr
@@ -96,15 +96,15 @@ inst ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/renderers/frame-buffer.so $INITRDDIR
-if [ -d ${DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME} ]; then
- for x in ${DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/* ; do
+if [ -d ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME} ]; then
+ for x in ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/* ; do
[ ! -f "$x" ] && break
inst $x $INITRDDIR
done
fi
-if [ -L ${DATADIR}/plymouth/themes/default.plymouth ]; then
- cp -a ${DATADIR}/plymouth/themes/default.plymouth $INITRDDIR${DATADIR}/plymouth/themes
+if [ -L ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth ]; then
+ cp -a ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth $INITRDDIR${PLYMOUTH_DATADIR}/plymouth/themes
fi
# vim:ts=8:sw=4:sts=4:et
diff --git a/scripts/plymouth-set-default-theme.in b/scripts/plymouth-set-default-theme.in
index e5e2ef0..2154972 100755
--- a/scripts/plymouth-set-default-theme.in
+++ b/scripts/plymouth-set-default-theme.in
@@ -2,14 +2,14 @@
set -e
-[ -z "$LIBEXECDIR" ] && LIBEXECDIR="/usr/libexec"
-[ -z "$DATADIR" ] && DATADIR="/usr/share"
+[ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="@PLYMOUTH_LIBEXECDIR@"
+[ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="@PLYMOUTH_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"
- PLYMOUTH_PLUGIN_PATH=${LIBDIR}/plymouth/
+ [ -z "$PLYMOUTH_LIBDIR" ] && PLYMOUTH_LIBDIR="@PLYMOUTH_LIBDIR@"
+ PLYMOUTH_PLUGIN_PATH=${PLYMOUTH_LIBDIR}/plymouth/
fi
fi
@@ -34,7 +34,7 @@ EOF
function list_themes ()
{
- for theme in ${DATADIR}/plymouth/themes/*/*.plymouth; do
+ for theme in ${PLYMOUTH_DATADIR}/plymouth/themes/*/*.plymouth; do
[ -f $theme ] || continue;
echo "$(basename $theme .plymouth)"
done
@@ -42,10 +42,10 @@ function list_themes ()
function get_default_theme ()
{
- THEME_NAME=$(basename $(readlink ${DATADIR}/plymouth/themes/default.plymouth) .plymouth)
+ THEME_NAME=$(basename $(readlink ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth) .plymouth)
if [ "$THEME_NAME" = ".plymouth" ]; then
$0 --reset
- THEME_NAME=$(basename $(readlink ${DATADIR}/plymouth/themes/default.plymouth) .plymouth)
+ THEME_NAME=$(basename $(readlink ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth) .plymouth)
fi
[ "$THEME_NAME" = ".so" ] || echo $THEME_NAME && exit 1
}
@@ -144,27 +144,27 @@ if [ `id -u` -ne 0 ]; then
fi
if [ $DO_RESET -ne 0 ]; then
- THEME_NAME=$(basename $(ls -1 -t ${DATADIR}/plymouth/themes/*/*.plymouth 2> /dev/null | tail -n 1) .plymouth)
+ THEME_NAME=$(basename $(ls -1 -t ${PLYMOUTH_DATADIR}/plymouth/themes/*/*.plymouth 2> /dev/null | tail -n 1) .plymouth)
if [ $THEME_NAME = .plymouth ]; then
- rm -f ${DATADIR}/plymouth/themes/default.plymouth
+ rm -f ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth
exit 0
fi
fi
-if [ ! -e ${DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth ]; then
- echo "${DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth does not exist" > /dev/stderr
+if [ ! -e ${PLYMOUTH_DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth ]; then
+ echo "${PLYMOUTH_DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth does not exist" > /dev/stderr
exit 1
fi
-MODULE_NAME=$(grep "ModuleName *= *" ${DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth | sed 's/ModuleName *= *//')
+MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth | sed 's/ModuleName *= *//')
if [ ! -e ${PLYMOUTH_PLUGIN_PATH}${MODULE_NAME}.so ]; then
echo "${PLYMOUTH_PLUGIN_PATH}${MODULE_NAME}.so does not exist" > /dev/stderr
exit 1
fi
-(cd ${DATADIR}/plymouth/themes;
+(cd ${PLYMOUTH_DATADIR}/plymouth/themes;
ln -sf ${THEME_NAME}/${THEME_NAME}.plymouth default.plymouth && \
([ $DO_INITRD_REBUILD -ne 0 ] && \
- $LIBEXECDIR/plymouth/plymouth-update-initrd) || :)
+ ${PLYMOUTH_LIBEXECDIR}/plymouth/plymouth-update-initrd) || :)
--
1.6.3.3
More information about the plymouth
mailing list