summaryrefslogtreecommitdiff
path: root/community/stunnel/stunnel.install
blob: d9998e4da5d000ec1b97904d2c160a864dd6219a (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() {
  # add stunnel group
  if ! getent group stunnel >/dev/null 2>&1; then
    groupadd -g 16 stunnel
  fi

  # add stunnel user
  if ! getent passwd stunnel >/dev/null 2>&1; then
    useradd -u 16 -g stunnel -d /var/run/stunnel -s /bin/false stunnel
  fi

  # create chroot dir if necessary.
  if [ ! -d /var/run/stunnel ]; then
    install -dm770 -o stunnel -g stunnel /var/run/stunnel
  fi
}

post_upgrade() {
  post_install "$@"
}

pre_remove() {
  # remove users & groups
  if getent passwd stunnel >/dev/null 2>&1; then
    userdel stunnel
  fi

  if getent group stunnel >/dev/null 2>&1; then
    groupdel stunnel
  fi
}