#! /bin/sh # postinst script for icecast2 set -e . /usr/share/debconf/confmodule case "$1" in configure|reconfigure) ;; abort-upgrade|abort-remove|abort-deconfigure) exit 0 ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac getent group icecast >/dev/null 2>&1 || \ addgroup --system --quiet icecast id icecast2 >/dev/null 2>&1 || \ adduser --system --quiet --disabled-password --disabled-login \ --home /usr/share/icecast2 --no-create-home --ingroup icecast icecast2 # set passwords db_get icecast2/icecast-setup if test "$RET" = "true"; then if [ -f /etc/default/icecast2 -a -f /etc/icecast2/icecast.xml ]; then echo "Configuring icecast2.." >&2 db_get icecast2/sourcepassword ICESOURCE=$RET db_get icecast2/relaypassword ICERELAY=$RET db_get icecast2/adminpassword ICEADMIN=$RET db_get icecast2/hostname ICEHOST=$RET sed -i -e "s|[^<]*|$ICESOURCE|" \ -e "s|[^<]*|$ICERELAY|" \ -e "s|[^<]*|$ICEADMIN|" \ -e "s|[^<]*|$ICEHOST|" \ /etc/icecast2/icecast.xml 2>/dev/null 1>&2 || true echo "Done Configuring icecast2.." >&2 fi fi # Tell debconf we're done, so it doesn't get confused when we start the daemon. db_stop chgrp icecast /etc/icecast2/icecast.xml chown icecast2:adm /var/log/icecast2 # Tightened permissions for the config file chmod g+r,o-rwx /etc/icecast2/icecast.xml # Automatically added by dh_installinit/13.29 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if [ -z "$DPKG_ROOT" ] && [ -x "/etc/init.d/icecast2" ]; then update-rc.d icecast2 defaults-disabled >/dev/null if [ -n "$2" ]; then _dh_action=restart else _dh_action=start fi invoke-rc.d --skip-systemd-native icecast2 $_dh_action || exit 1 fi fi # End automatically added section # Automatically added by dh_installsystemd/13.29 if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then if deb-systemd-helper debian-installed 'icecast2.service'; then # The following line should be removed in trixie or trixie+1 deb-systemd-helper unmask 'icecast2.service' >/dev/null || true if deb-systemd-helper --quiet was-enabled 'icecast2.service'; then # Create new symlinks, if any. deb-systemd-helper enable 'icecast2.service' >/dev/null || true fi fi # 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 'icecast2.service' >/dev/null || true fi # End automatically added section # Automatically added by dh_installsystemd/13.29 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 'icecast2.service' >/dev/null || true fi fi # End automatically added section exit 0