]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Add --list to plymouth-set-default-plugin
authorRay Strode <rstrode@redhat.com>
Wed, 19 Nov 2008 19:18:48 +0000 (14:18 -0500)
committerRay Strode <rstrode@redhat.com>
Wed, 19 Nov 2008 19:18:48 +0000 (14:18 -0500)
https://bugs.freedesktop.org/show_bug.cgi?id=18298 requests
the ability to a get a list of plugins.

scripts/plymouth-set-default-plugin.in

index 6d43a9d5be4fc10a9aab0dcde216a05a33ae5091..427803bb89db04bec7fc955fbd9197e6b3f36972 100755 (executable)
@@ -16,7 +16,19 @@ fi
 
 function usage ()
 {
-  echo "usage: plymouth-set-default-plugin { --reset | <plugin-name> [ --rebuild-initrd ] }"
+  echo "usage: plymouth-set-default-plugin { --list | --reset | <plugin-name> [ --rebuild-initrd ] }"
+}
+
+function list_plugins ()
+{
+        for plugin in ${LIBDIR}/plymouth/*.so; do
+                [ -f $plugin ] || continue;
+                [ -L $plugin ] && continue;
+
+                if $(nm -D $plugin | grep -q ply_boot_splash_plugin_get_interface); then
+                        echo "$(basename $plugin .so)"
+                fi
+        done
 }
 
 function get_default_plugin ()
@@ -31,10 +43,27 @@ function get_default_plugin ()
 
 DO_RESET=0
 DO_INITRD_REBUILD=0
+DO_LIST=0
 PLUGIN_NAME=""
 while [ $# -gt 0 ]; do
         case "$1" in
 
+        --list)
+                if [ -n "$PLUGIN_NAME" ]; then
+                        echo "You can only specify --list or a plugin name, not both" > /dev/stderr
+                        echo $(usage) > /dev/stderr
+                        exit 1
+                fi
+
+                if [ $DO_RESET -ne 0 ]; then
+                        echo "You can only specify --reset or --list, not both" > /dev/stderr
+                        echo $(usage) > /dev/stderr
+                        exit 1
+                fi
+
+                DO_LIST=1
+        ;;
+
         --rebuild-initrd)
                 DO_INITRD_REBUILD=1
         ;;
@@ -46,6 +75,12 @@ while [ $# -gt 0 ]; do
                         exit 1
                 fi
 
+                if [ $DO_LIST -ne 0 ]; then
+                        echo "You can only specify --reset or --list, not both" > /dev/stderr
+                        echo $(usage) > /dev/stderr
+                        exit 1
+                fi
+
                 DO_RESET=1
         ;;
 
@@ -62,12 +97,23 @@ while [ $# -gt 0 ]; do
                         exit 1
                 fi
 
+                if [ $DO_LIST -ne 0 ]; then
+                        echo "You can only specify --list or a plugin name, not both" > /dev/stderr
+                        echo $(usage) > /dev/stderr
+                        exit 1
+                fi
+
                 PLUGIN_NAME="$1"
         ;;
   esac
   shift
 done
 
+if [ $DO_LIST -ne 0 ]; then
+        list_plugins
+        exit $?
+fi
+
 if [ $DO_RESET -eq 0 ] && [ $DO_INITRD_REBUILD -eq 0 ] && [ -z $PLUGIN_NAME ]; then
         get_default_plugin
         exit $?