postinst is in mpdscribble 0.22-5.
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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #! /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/mpdscribble/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_systemd_enable
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask mpdscribble.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled mpdscribble.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable mpdscribble.service >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state mpdscribble.service >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/mpdscribble" ]; then
update-rc.d mpdscribble defaults >/dev/null
fi
if [ -x "/etc/init.d/mpdscribble" ] || [ -e "/etc/init/mpdscribble.conf" ]; then
invoke-rc.d mpdscribble start || exit $?
fi
# End automatically added section
exit 0
|