]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Add new plymouth-set-default-plugin script
authorRay Strode <rstrode@redhat.com>
Wed, 11 Jun 2008 14:21:18 +0000 (10:21 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 11 Jun 2008 16:03:20 +0000 (12:03 -0400)
This script updates which plugin graphical.so points to

scripts/Makefile.am
scripts/plymouth-set-default-plugin [new file with mode: 0755]

index 793285187563c96f5f0c0697d5f712bb248d1419..b780f2e189307f85c56894d4b07b581e01cd9bbb 100644 (file)
@@ -3,10 +3,13 @@ noinst_SCRIPTS = new-object.sh
 initrdscriptdir = $(libexecdir)/plymouth
 initrdscript_SCRIPTS = plymouth-update-initrd plymouth-populate-initrd
 
+sbinscriptsdir = $(sbindir)
+sbinscripts_SCRIPTS = plymouth-set-default-plugin
+
 if ADD_BOOT_ENTRY
 install-data-hook:
        PLYMOUTH_LOGO_FILE=$(logofile) $(initrdscriptdir)/plymouth-update-initrd
 endif
 
-EXTRA_DIST=$(initrdscript_SCRIPTS) $(noinst_SCRIPTS) default.cfg
+EXTRA_DIST=$(initrdscript_SCRIPTS) $(sbinscripts_SCRIPTS) $(noinst_SCRIPTS) default.cfg
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/scripts/plymouth-set-default-plugin b/scripts/plymouth-set-default-plugin
new file mode 100755 (executable)
index 0000000..42a0266
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -e
+
+[ -z "$LIBEXECDIR" ] && LIBEXECDIR="/usr/libexec"
+[ -z "$DATADIR" ] && DATADIR="/usr/share"
+[ -z "$LIB" ] && $(eu-readelf -h /usr/bin/plymouth | grep Class | grep -q ELF64) && LIB="lib64" || LIB="lib"
+[ -z "$LIBDIR" ] && LIBDIR="/usr/$LIB"
+[ -z "$BINDIR" ] && BINDIR="/usr/bin"
+
+if [ $# -lt 1 ]; then
+        basename $(readlink ${LIBDIR}/plymouth/graphical.so) .so
+        exit $?
+fi
+
+if [ `id -u` -ne 0 ]; then
+        echo "This program must be run as root" > /dev/stderr
+        exit 1
+fi
+
+if [ ! -e ${LIBDIR}/plymouth/$1.so ]; then
+        echo "${LIBDIR}/plymouth/$1.so does not exist" > /dev/stderr
+        exit 1
+fi
+
+(cd ${LIBDIR}/plymouth; ln -sf $1 graphical.so)
+