summarylogtreecommitdiffstats
path: root/motioneye.install
blob: 250e01ac29a880f726708da52a494b00abe4966c (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
32
33
34
35
36
37
38
39
40
username="motion"
groupname="motion"

_setup_user_and_group() {
  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 "/etc/motioneye" 1>/dev/null
}

post_install() {
  echo "If motion.service is installed, stop and disable it to ensure proper functionality."
  echo "Execute 'systemctl disable --now motion' in a terminal."
  echo "Then, reload the system daemon with 'systemctl daemon-reload'."
  echo "Finally, enable and start motioneye with 'systemctl enable --now motioneye'."

  cat <<INFO

  The default login credentials for the web interface are:

     username: admin
     password:                               (no password)

INFO
  _setup_user_and_group
}

post_upgrade() {
  echo "To restart the motioneye service and apply the changes, run: 'systemctl restart motioneye'"
  _setup_user_and_group
}

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
}