summarylogtreecommitdiffstats
path: root/adguardhome-bin.install
blob: 092fede6ddf7686d25fb3fc8884a67e42f35cfa0 (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
post_install() {
  getent group adguardhome > /dev/null || groupadd -g 555 adguardhome
  if ! getent passwd adguardhome > /dev/null; then
    useradd -c 'adguardhome user' -u 555 -g adguardhome \
      -d /var/lib/adguardhome -s /usr/bin/nologin adguardhome
    passwd -l adguardhome > /dev/null
    [[ ! -d /var/lib/adguardhome/ ]] &&
      mkdir /var/lib/adguardhome/ &&
      chown -R adguardhome:adguardhome /var/lib/adguardhome/
  fi

  post_upgrade
}

post_upgrade() {
  setcap CAP_NET_BIND_SERVICE=+eip /var/lib/adguardhome/AdGuardHome
}

post_remove() {
  echo "==> Optionally delete the adguardhome user and its home directory"
  echo "==>   if you are certain no processes are running under it."
  echo "==>   userdel adguardhome"
  echo "==>   groupdel adguardhome"
  echo "==>   rm -rf /var/lib/adguardhome"
}

# vim:set ts=2 sw=2 et: