summarylogtreecommitdiffstats
path: root/motioneye.install
blob: 3e7075f8abeda43e1d79b1106ea15508cccc977d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
username="motioneye"
groupname="motioneye"

post_install() {
  post_upgrade
}

post_upgrade() {
  getent group $groupname &>/dev/null || groupadd -r $groupname 1>/dev/null
  getent passwd $username &>/dev/null || useradd -r -g $groupname -s "/bin/bash" $username 1>/dev/null
 
  chown -R $username:$groupname "/opt/motioneye" 1>/dev/null
}

post_remove() {
  if getent passwd $username >/dev/null; then
    userdel $username >/dev/null
  fi
  if getent group $groupname >/dev/null; then
    groupdel $groupname >/dev/null
  fi
}