aboutsummaryrefslogtreecommitdiff
path: root/naemon/naemon.install
blob: c32c8484e1d247e04ae5ecdc23bc25031e5c6338 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
post_install() {
  getent group naemon &> /dev/null || groupadd -r naemon -g 44
  getent passwd naemon &> /dev/null || useradd -r -u 44 -g naemon \
    -d /var/lib/naemon -s /usr/bin/false -c "Naemon" naemon

  chown naemon:naemon /var/lib/naemon
  chown -R naemon:naemon /etc/naemon
  /usr/bin/systemd-tmpfiles --create naemon.conf
}

pre_remove() {
  if [[ -f /run/naemon/naemon.pid ]]; then
    systemctl stop naemon
  fi
  /usr/bin/systemd-tmpfiles --remove naemon.conf

  userdel naemon &> /dev/null
  groupdel naemon &> /dev/null

  rm -rf /var/lib/naemon
}