summarylogtreecommitdiffstats
path: root/terraria-server.install
blob: 7f7323d7b30b031f13f5c95fe2a365a853f501e9 (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
post_install() {
    if ! getent group terraria &>/dev/null; then
      groupadd -r -g 697 terraria >/dev/null
    fi

    if ! getent passwd terraria &>/dev/null; then
        useradd -r -u 697 -g terraria -d /opt/terraria-server/ \
            -s /bin/bash terraria >/dev/null
    fi
}

post_upgrade() {
    if getent passwd terraria && [[ $(id -u terraria) == 197 ]]; then
        userdel terraria
    fi
    if getent group terraria && [[ $(id -g terraria) == 197 ]]; then
        groupdel terraria
    fi
    post_install
}

post_remove() {
    if getent passwd terraria &>/dev/null; then
        userdel terraria >/dev/null
    fi

    if getent group terraria &>/dev/null; then
      groupdel terraria >/dev/null
    fi
}