From b295846642eed72392c2dd6fad524c455b7d28b4 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 19 Nov 2008 14:18:48 -0500 Subject: [PATCH] Add --list to plymouth-set-default-plugin 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 | 48 +++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/scripts/plymouth-set-default-plugin.in b/scripts/plymouth-set-default-plugin.in index 6d43a9d5..427803bb 100755 --- a/scripts/plymouth-set-default-plugin.in +++ b/scripts/plymouth-set-default-plugin.in @@ -16,7 +16,19 @@ fi function usage () { - echo "usage: plymouth-set-default-plugin { --reset | [ --rebuild-initrd ] }" + echo "usage: plymouth-set-default-plugin { --list | --reset | [ --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 $? -- 2.47.3