gsu: Allow help/man/prefs command even on invalid configs.
authorAndre Noll <maan@systemlinux.org>
Fri, 21 Aug 2009 15:20:39 +0000 (17:20 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 29 Aug 2014 19:36:07 +0000 (21:36 +0200)
These generic subcommands do not need the config file. It's pointless
to refuse to print the help e.g. if a required config variable is unset.

Also, use the name of the executable as the default value for gsu_name.

funcs/gsu

index 129757ace42a3cdeaa0b72cc582f97a3eb3d289c..9ee2d72442d4b0694f4c151559c2b383cdf860e0 100644 (file)
--- a/funcs/gsu
+++ b/funcs/gsu
@@ -345,12 +345,15 @@ gsu()
        local i
 
        _gsu_self="$(basename $0)"
+       gsu_name="${gsu_name:=$_gsu_self}"
        gsu_config_var_prefix="${gsu_config_var_prefix:=$gsu_name}"
        _gsu_init_errors
        _gsu_check_options
        if [[ "$ret" -lt 0 ]]; then
-               gsu_err_msg
-               exit 1
+               if [[ "$1" != "help" && "$1" != "man" && "$1" != "prefs" ]]; then
+                       gsu_err_msg
+                       exit 1
+               fi
        fi
        _gsu_available_commands
        gsu_cmds="$result"