summaryrefslogtreecommitdiff
path: root/portland/xdg-utils/scripts/xdg-desktop-menu.in
diff options
context:
space:
mode:
Diffstat (limited to 'portland/xdg-utils/scripts/xdg-desktop-menu.in')
-rw-r--r--portland/xdg-utils/scripts/xdg-desktop-menu.in33
1 files changed, 24 insertions, 9 deletions
diff --git a/portland/xdg-utils/scripts/xdg-desktop-menu.in b/portland/xdg-utils/scripts/xdg-desktop-menu.in
index e22b854..01ba59b 100644
--- a/portland/xdg-utils/scripts/xdg-desktop-menu.in
+++ b/portland/xdg-utils/scripts/xdg-desktop-menu.in
@@ -78,12 +78,24 @@ while [ $# -gt 0 ] ; do
update=no
;;
- --user)
- mode=user
- ;;
-
- --system)
- mode=system
+ --mode)
+ if [ -z "$1" ] ; then
+ exit_failure_syntax "mode argument missing for --mode"
+ fi
+ case "$1" in
+ user)
+ mode=user
+ ;;
+
+ system)
+ mode=system
+ ;;
+
+ *)
+ exit_failure_syntax "unknown mode '$1'"
+ ;;
+ esac
+ shift
;;
--vendor)
@@ -116,7 +128,11 @@ if [ -z "$action" ] ; then
fi
if [ -z "$mode" ] ; then
- exit_failure_syntax "expected --user or --system option"
+ if [ `whoami` = "root" ] ; then
+ mode=system
+ else
+ mode=user
+ fi
fi
if [ x"$action" = x"forceupdate" ] ; then
@@ -206,8 +222,7 @@ else
gnome_dir="$gnome_global_dir"
my_umask=022
if [ -z "${xdg_dir}${kde_dir}${gnome_dir}" ] ; then
- [ `whoami` = "root" ] || rootmsg="Try as root or use --user."
- exit_failure_operation_impossible "No writable system menu directory found. $rootmsg"
+ exit_failure_operation_impossible "No writable system menu directory found."
fi
fi