| 1 |
#! /bin/sh |
| 2 |
# postinst script for icecast2 |
| 3 |
|
| 4 |
set -e |
| 5 |
|
| 6 |
. /usr/share/debconf/confmodule |
| 7 |
|
| 8 |
case "$1" in |
| 9 |
configure|reconfigure) |
| 10 |
|
| 11 |
# set passwords |
| 12 |
db_get icecast2/icecast-setup |
| 13 |
if test "$RET" = "true"; then |
| 14 |
if [ -f /etc/default/icecast2 -a -f /etc/icecast2/icecast.xml ]; then |
| 15 |
echo "Configuring icecast2.." >&2 |
| 16 |
db_get icecast2/sourcepassword |
| 17 |
ICESOURCE=$RET |
| 18 |
db_get icecast2/relaypassword |
| 19 |
ICERELAY=$RET |
| 20 |
db_get icecast2/adminpassword |
| 21 |
ICEADMIN=$RET |
| 22 |
db_get icecast2/hostname |
| 23 |
ICEHOST=$RET |
| 24 |
sed -i -e "s|<source-password>[^<]*</source-password>|<source-password>$ICESOURCE</source-password>|" \ |
| 25 |
-e "s|<relay-password>[^<]*</relay-password>|<relay-password>$ICERELAY</relay-password>|" \ |
| 26 |
-e "s|<admin-password>[^<]*</admin-password>|<admin-password>$ICEADMIN</admin-password>|" \ |
| 27 |
-e "s|<hostname>[^<]*</hostname>|<hostname>$ICEHOST</hostname>|" \ |
| 28 |
/etc/icecast2/icecast.xml 2>/dev/null 1>&2 || true |
| 29 |
echo "Done Configuring icecast2.." >&2 |
| 30 |
fi |
| 31 |
fi |
| 32 |
|
| 33 |
;; |
| 34 |
|
| 35 |
abort-upgrade|abort-remove|abort-deconfigure) |
| 36 |
exit 0 |
| 37 |
;; |
| 38 |
|
| 39 |
*) |
| 40 |
echo "postinst called with unknown argument \`$1'" >&2 |
| 41 |
exit 1 |
| 42 |
;; |
| 43 |
esac |
| 44 |
|
| 45 |
# Tell debconf we're done, so it doesn't get confused when we start the daemon. |
| 46 |
db_stop |
| 47 |
|
| 48 |
#DEBHELPER# |
| 49 |
|
| 50 |
exit 0 |