#! /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 mpdscribble:mpdscribble /var/cache/mpdscribble ls /var/cache/mpdscribble/* > /dev/null 2>&1 && chown 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-all --quiet --update --add mpdscribble mpdscribble 0700 /var/cache/mpdscribble fi if ! dpkg-statoverride --list --quiet /etc/mpdscribble.conf >/dev/null ; then dpkg-statoverride --force-all --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_installsystemduser/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "${DPKG_ROOT:-}" ] ; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper --user unmask 'mpdscribble.service' >/dev/null || true # was-enabled defaults to true, so new installations run enable. if deb-systemd-helper --quiet --user 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 --user 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 --user update-state 'mpdscribble.service' >/dev/null || true fi fi fi # End automatically added section # Automatically added by dh_installinit/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "${DPKG_ROOT:-}" ] && [ -x "/etc/init.d/mpdscribble" ]; then update-rc.d mpdscribble defaults >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native mpdscribble $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then # The following line should be removed in trixie or trixie+1 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 fi # End automatically added section # Automatically added by dh_installsystemd/13.14.1 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -d /run/systemd/system ]; then systemctl --system daemon-reload >/dev/null || true if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi deb-systemd-invoke $_dh_action 'mpdscribble.service' >/dev/null || true fi fi # End automatically added section exit 0