Browse Source

Check multiple sudo-related groups

master
Pekka Helenius 4 years ago
parent
commit
2dcc4179f7
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      updatewine.sh

+ 15
- 1
updatewine.sh View File

@ -84,6 +84,11 @@ COMMANDS=(
wget
)
SUDO_GROUPS=(
sudo
wheel
)
function checkCommands() {
if [[ $(which --help 2>/dev/null) ]] && [[ $(echo --help 2>/dev/null) ]]; then
@ -119,11 +124,20 @@ if [[ $(uname -a | grep -c x86_64) -eq 0 ]]; then
exit 1
fi
if [[ $(groups | grep -c sudo) -eq 0 ]]; then
for i in ${SUDO_GROUPS[@]}; do
if [[ $(groups | grep -c ${i}) -ne 0 ]]; then
break
sudogrp=true
fi
done
if [[ ! $sudogrp ]]; then
echo "You must belong to sudo group."
exit 1
fi
unset sudogrp
if [[ $UID -eq 0 ]]; then
echo "Run as a regular user."
exit 1


Loading…
Cancel
Save