summaryrefslogtreecommitdiffstats
path: root/abs/extra/mpd/mpd.install
blob: 885505a075fc4b7026733dd84ec36be1bbc7e302 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
post_install() {
  post_upgrade
  echo "==> Create a configuration file /etc/mpd.conf before using MPD (example: /usr/share/mpd/mpd.conf.example)"
}

post_upgrade() {
  getent group "mpd" &>/dev/null || groupadd -r -g 45 mpd 1>/dev/null
  getent passwd "mpd" &>/dev/null || useradd -r -u 45 -g mpd -d "/var/lib/mpd" -s "/bin/true" -G "audio" mpd 1>/dev/null
  for dir in /var/{lib,log}/mpd; do
    chown -R mpd:mpd "$dir" 1>/dev/null
  done
}

post_remove() {
  getent passwd "mpd" &>/dev/null && userdel mpd 1>/dev/null
  getent group "mpd" &>/dev/null && groupdel mpd 1>/dev/null
  [ -f etc/mpd.conf ] && mv etc/mpd.conf etc/mpd.conf.pacsave 1>/dev/null
}