]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Add --reset argument to set-default-plugin
authorRay Strode <rstrode@redhat.com>
Wed, 11 Jun 2008 14:58:10 +0000 (10:58 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 11 Jun 2008 16:10:22 +0000 (12:10 -0400)
It just chooses the last installed plugin as the default
or no plugin if there is none available

scripts/plymouth-set-default-plugin

index 42a0266c6319002f96c9ca434f0e03b1f9a1b32b..a4f0616ee1183b494dd6b490603096bdda09cd6a 100755 (executable)
@@ -18,10 +18,19 @@ if [ `id -u` -ne 0 ]; then
         exit 1
 fi
 
-if [ ! -e ${LIBDIR}/plymouth/$1.so ]; then
-        echo "${LIBDIR}/plymouth/$1.so does not exist" > /dev/stderr
+PLUGIN_NAME=$1
+if [ $1 = '--reset' ]; then
+        PLUGIN_NAME=$(basename $(ls -1 -t ${LIBDIR}/plymouth/*.so 2> /dev/null | grep -v graphical.so | head -n 1) .so)
+        if [ $PLUGIN_NAME = .so ]; then
+                rm -f ${LIBDIR}/plymouth/graphical.so
+                exit 0
+        fi
+fi
+
+if [ ! -e ${LIBDIR}/plymouth/${PLUGIN_NAME}.so ]; then
+        echo "${LIBDIR}/plymouth/${PLUGIN_NAME}.so does not exist" > /dev/stderr
         exit 1
 fi
 
-(cd ${LIBDIR}/plymouth; ln -sf $1 graphical.so)
+(cd ${LIBDIR}/plymouth; ln -sf ${PLUGIN_NAME}.so graphical.so)