summarylogtreecommitdiffstats
path: root/minimega.install
blob: 5daf37dd48f19665133ac891131c3f3201263870 (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
post_install() {
  if [[ $(cat /proc/1/comm) == "systemd" ]]; then
    systemctl daemon-reload &> /dev/null
  fi

  if ! getent group minimega &> /dev/null ; then
      echo "Adding minimega group."
      groupadd --system minimega
  else
      echo "minimega group already exists."
  fi

  chgrp -R minimega /opt/minimega
  chgrp -R minimega /usr/share/doc/minimega
}

pre_remove() {
  if [[ $(cat /proc/1/comm) == "systemd" ]]; then
    echo "Stopping minimega and miniweb services..."

    for unit in miniweb minimega; do
      systemctl stop $unit 2>&1
    done
  fi
}

post_remove() {
  if [[ $(cat /proc/1/comm) == "systemd" ]]; then
    systemctl daemon-reload &> /dev/null
  fi
}