postinst is in mpd 0.16.5-1ubuntu4.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #!/bin/sh -e
umask 0022
ACTION="$1"
VERSION="$2"
MPDCONF="/etc/mpd.conf"
PIDFILE=$(sed -n 's/^[[:space:]]*pid_file[[:space:]]*"\?\([^"]*\)\"\?/\1/p' $MPDCONF)
if [ "$ACTION" != "configure" ]; then
echo "action: $ACTION not supported"
exit 0
fi
do_mpd_adduser () {
if ! getent passwd mpd >/dev/null; then
adduser --quiet --ingroup audio --system --no-create-home \
--home /var/lib/mpd mpd
fi
}
do_mpd_perms () {
for i in /var/log/mpd /var/lib/mpd /var/lib/mpd/playlists /var/run/mpd; do
if ! dpkg-statoverride --list --quiet "$i" >/dev/null; then
dpkg-statoverride --force --quiet --update \
--add mpd audio 0755 "$i"
fi
done
}
do_mpd_conf () {
if ! dpkg-statoverride --list --quiet "$MPDCONF" >/dev/null; then
dpkg-statoverride --force --quiet --update \
--add mpd audio 0640 "$MPDCONF"
fi
}
do_mpd_init () {
if [ -x /etc/init.d/mpd ]; then
# Start after ALSA/icecast/etc and stop before them
update-rc.d mpd defaults 30 14 >/dev/null
# check for a deprecated option
if [ -f /etc/mpd.conf ] && grep -q '^\s*error_file\s*=' /etc/mpd.conf
then
echo "Your configuration file contains the deprecated option error_file"
echo "mpd won't start until you migrated your configuration"
else
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d mpd "$@"
else
/etc/init.d/mpd "$@"
fi
fi
fi
}
do_mpd_restart () {
if [ -e "$PIDFILE" ]; then
do_mpd_init restart
else
do_mpd_init start
fi
}
do_mpd_adduser
do_mpd_perms
do_mpd_conf
do_mpd_restart
|