postinst is in icecast2 2.3.2-9ubuntu1.
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 | #! /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
# Move configuration file to current location, if an old one exists
# and the init.d script configuration file was updated
if [ -f /etc/icecast.xml ] && grep -q /etc/icecast2/ /etc/default/icecast2; then
echo "It seems you have an old configuration lying around at"
echo "/etc/icecast.xml. You will need to manually merge with"
echo "the current configuration at /etc/icecast2/icecast.xml."
echo
echo "See /usr/share/doc/icecast2/examples for new configuration options."
fi
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
cat << _EOF_ \
| ed /etc/default/icecast2 2>/dev/null 1>&2 || true
%s/^.*ENABLE=.*$/ENABLE=true/
wq
_EOF_
db_get icecast2/sourcepassword
ICESOURCE=$RET
db_get icecast2/relaypassword
ICERELAY=$RET
db_get icecast2/adminpassword
ICEADMIN=$RET
db_get icecast2/hostname
ICEHOST=$RET
cat << _EOF_ \
| ed /etc/icecast2/icecast.xml 2>/dev/null 1>&2 || true
%s/<source-password>[^<]*<\/source-password>/<source-password>$ICESOURCE<\/source-password>/
%s/<relay-password>[^<]*<\/relay-password>/<relay-password>$ICERELAY<\/relay-password>/
%s/<admin-password>[^<]*<\/admin-password>/<admin-password>$ICEADMIN<\/admin-password>/
%s/<hostname>[^<]*<\/hostname>/<hostname>$ICEHOST<\/hostname>/
wq
_EOF_
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
chown -R icecast2: /var/log/icecast2 /etc/icecast2
# Set all file readable by default
chmod -R ug=rw,o=r,ugo+X /etc/icecast2
# Tightened permissions for the config file
chmod -R ug=rw,o=,ug+X /etc/icecast2/icecast.xml
# avoid to fail on invoke-rc.d icecast2 start when upgrading see Bug#605507
sleep 3
# Automatically added by dh_installinit
if [ -x "/etc/init.d/icecast2" ]; then
if [ ! -e "/etc/init/icecast2.conf" ]; then
update-rc.d icecast2 defaults >/dev/null
fi
invoke-rc.d icecast2 start || exit $?
fi
# End automatically added section
exit 0
|