postinst is in mpdscribble 0.22-1.
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #! /bin/sh
set -e
case "$1" in
configure)
# add group
if ! getent group mpdscribble >/dev/null ; then
addgroup --quiet --system mpdscribble
fi
# add user
if ! getent passwd mpdscribble >/dev/null ; then
adduser --quiet --ingroup mpdscribble --no-create-home --system --home /var/cache/mpdscribble mpdscribble
fi
# Source debconf library.
. /usr/share/debconf/confmodule
tempfile=`mktemp -t mpdscribble.default.XXXXXXXXXX`
db_get mpdscribble/systemwide
SYSTEMWIDE="$RET"
if [ "$SYSTEMWIDE" != "true" ]; then
sed 's/^MPD_SYSTEMWIDE=.*/MPD_SYSTEMWIDE=0/' < /usr/share/mpdscribble/mpdscribble-default > $tempfile
else
sed 's/^MPD_SYSTEMWIDE=.*/MPD_SYSTEMWIDE=1/' < /usr/share/mpdscribble/mpdscribble-default > $tempfile
fi
ucf --debconf-ok --three-way $tempfile /etc/default/mpdscribble
ucfr mpdscribble /etc/default/mpdscribble
rm -f $tempfile
tempfile=`mktemp -t mpdscribble.conf.XXXXXXXXXX`
cat /usr/share/doc/mpdscribble/examples/mpdscribble.conf > $tempfile
if [ "$SYSTEMWIDE" = "true" ]; then
db_get mpdscribble/user
sed -i "s/^username[ \t]*=.*/username = $RET/" $tempfile
db_get mpdscribble/password
sed -i "s/^password[ \t]*=.*/password = `echo -n $RET | md5sum | awk '{print $1}'`/" $tempfile
fi
db_go
ucf --debconf-ok --three-way $tempfile /etc/mpdscribble.conf
ucfr mpdscribble /etc/mpdscribble.conf
rm -f $tempfile
# update permissions
chown -R mpdscribble:mpdscribble /var/cache/mpdscribble
chgrp mpdscribble /etc/mpdscribble.conf
chmod 0640 /etc/mpdscribble.conf
chgrp mpdscribble /etc/default/mpdscribble
chmod 0644 /etc/default/mpdscribble
if ! dpkg-statoverride --list --quiet /var/cache/mpdscribble >/dev/null ; then
dpkg-statoverride --force --quiet --update --add mpdscribble mpdscribble 0700 /var/cache/mpdscribble
fi
if ! dpkg-statoverride --list --quiet /etc/mpdscribble.conf >/dev/null ; then
dpkg-statoverride --force --quiet --update --add root mpdscribble 0640 /etc/mpdscribble.conf
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_installinit
if [ -x "/etc/init.d/mpdscribble" ]; then
update-rc.d mpdscribble start 31 2 3 4 5 . stop 14 0 1 6 . >/dev/null
invoke-rc.d mpdscribble start || exit $?
fi
# End automatically added section
exit 0
|