aboutsummarylogtreecommitdiffstats
path: root/dominions-server.install
blob: 272f58ee4d4665a58a5aca16b238ca0e77856f2e (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 dominions.conf
  fi

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

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

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

  cat <<EOF

Post-install tasks:

Install Dominions 5 for the server user using SteamCMD:

  dominions install

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

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

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

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

  userdel dominions &> /dev/null

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

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