summarylogtreecommitdiffstats
path: root/albion-online
blob: ab727cee7b123266ea32b82e9c0d5b08fd4c7d92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

declare no_group="Please run the next command in your terminal to give user "\
"${USER} permissions to update Albion game data:\n"\
"\nsudo usermod -a -G albion ${USER}"
declare no_sudo="Don't run this game as root(sudo)!! it could be a security risk!"

if [[ "$USER" == "root" ]]; then
    echo -e "${no_sudo}"
    exit 1
fi

if which newgrp; then :
else
    echo "A core package \"util-linux\" is required"
    exit 2
fi

if (( $( id -nG "$USER" | grep -c '\balbion\b' ) )) # Does the user have the permissions to run as group albion?
then
    newgrp albion <<< /opt/albion-online-launcher-bin/Albion-Online
else
    if zenity \
           --info \
           --text="$no_group"; then :
    else
        ## Zenity is not installed
        echo -e "${no_group}"
    fi
    exit 4
fi