summarylogtreecommitdiffstats
path: root/dom4-server.install
blob: 1c2081d950213bed8085d54764786760cf702335 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
post_install() {
  post_upgrade

  systemctl daemon-reload
}

post_upgrade() {
  if hash systemd-sysusers &> /dev/null; then
    systemd-sysusers dom4.conf
  fi

  if hash systemd-tmpfiles &> /dev/null; then
    systemd-tmpfiles --create dom4.conf
  fi

  mkdir -p /opt/dom4
  mkdir -p /usr/share/dom4/config
  mkdir -p /usr/share/dom4/maps
  mkdir -p /var/log/dom4

  chown dom4:dom4 /usr/bin/dom4-server
  chown -R dom4:dom4 /usr/share/dom4
  chown -R dom4:dom4 /opt/dom4
  chown -R dom4:dom4 /var/log/dom4

  cat <<EOF

Post-install tasks:

Install Dominions 4 for the server user using SteamCMD:

  dom4 install

You will need your login information and a valid Dominions 4 CD key. SteamCMD may ask you to validate via Steam Guard.

To begin setting up hosting, run 'dom4' without arguments for more information.
EOF
}

post_remove() {
  if systemctl is-active dom4-server &> /dev/null; then
    systemctl stop dom4-server &> /dev/null
  fi

  systemctl daemon-reload &> /dev/null
  systemctl reset-failed &> /dev/null

  userdel dom4 &> /dev/null

  if [[ -s /usr/share/dom4/current ]]; then
    rm /usr/share/dom4/current &> /dev/null
  fi

  rm -rf /run/dom4 &> /dev/null
}