diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2015-06-15 13:28:09 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2015-06-15 13:35:57 +0200 |
commit | 9444ffc93a3335ee3f63df36512f5b278dd7596c (patch) | |
tree | de68ed6d8d41b81845b2838b9538591fe22d9ded /desktop/scripts/unopkg.sh | |
parent | 4ea281a3ccb5bd21e1808d8cb127a91a1bb72691 (diff) |
Remove bash-ism, allow also --bundled option for root
Change-Id: I34511c7947ff78654a34a3d2bd21754b6d004420
Diffstat (limited to 'desktop/scripts/unopkg.sh')
-rwxr-xr-x | desktop/scripts/unopkg.sh | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/desktop/scripts/unopkg.sh b/desktop/scripts/unopkg.sh index 6deb032bb12a..ca1e3bc7f444 100755 --- a/desktop/scripts/unopkg.sh +++ b/desktop/scripts/unopkg.sh @@ -49,28 +49,31 @@ AIX) ;; esac -HELP_MODE=0 -SHARED_MODE=0 -#collect all bootstrap variables specified on the command line -#so that they can be passed as arguments to javaldx later on +help_mode=0 +isnotuser=0 for arg in $@ do case "$arg" in + #collect all bootstrap variables specified on the command line + #so that they can be passed as arguments to javaldx later on -env:*) BOOTSTRAPVARS=$BOOTSTRAPVARS" ""$arg";; + + # make sure shared extensions will be readable by all users --shared) umask 0022 - SHARED_MODE=1 + isnotuser=1 ;; - # make sure shared extensions will be readable by all users - -h|--help) HELP_MODE=1;; + + --bundled) isnotuser=1;; + -h|--help) help_mode=1;; esac done -# we don't really want root to run unopkg without --shared option -if [ "$EUID" -eq 0 ]; then - # but we might at least let him read help - if [ $SHARED_MODE -eq 0 ] && [ $HELP_MODE -eq 0 ]; then - echo "Cannot run '${0} $*' as root (did you forget --shared option?)" +# we don't really want root to run unopkg without --shared or --bundled option +# but we might at least let him read help +if [ "$(id -u)" -eq "0" ]; then + if [ $isnotuser -eq 0 ] && [ $help_mode -eq 0 ]; then + echo "Cannot run '${0} $*' as root without --shared or --bundled option." exit 1 fi fi |