summarylogtreecommitdiffstats
path: root/sonarr.install
blob: 4770ea35de424fdce1b26b21f0bcb46b01b17973 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
USER="sonarr"
GROUP="sonarr"
DATA_DIR="/var/lib/sonarr"
BIN_DIR="/opt/sonarr"

post_install() {
  groupadd ${GROUP} &> /dev/null
  useradd -g ${GROUP} -d ${DATA_DIR} -s /bin/false ${USER} &> /dev/null
  chown -R ${USER}:${GROUP} ${DATA_DIR}
  chown -R ${USER}:${GROUP} ${BIN_DIR}
}

post_upgrade() {
  usermod -g ${GROUP} -d ${DATA_DIR} -s /bin/false ${USER} &> /dev/null
  chown -R ${USER}:${GROUP} ${DATA_DIR}
  chown -R ${USER}:${GROUP} ${BIN_DIR}
}

post_remove() {
  userdel ${USER} &> /dev/null
  groupdel ${GROUP} &> /dev/null || /bin/true
}