[PATCH] added configuration template&postinst setup.

Robin Gareus robin at gareus.org
Mon Apr 18 17:22:15 UTC 2011


---
 debian/config            |   25 +++++++++++++++++++++++++
 debian/icecast2.postinst |   35 ++++++++++++++++++++++++++++++++++-
 debian/templates         |   37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+), 1 deletions(-)
 create mode 100644 debian/config
 create mode 100644 debian/templates

diff --git a/debian/config b/debian/config
new file mode 100644
index 0000000..742ddf3
--- /dev/null
+++ b/debian/config
@@ -0,0 +1,25 @@
+#!/bin/bash
+# Debconf config script for icecast2
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+db_input high icecast2/icecast-setup || true
+db_go ||true
+
+db_get icecast2/icecast-setup
+if [ "$RET" = "true" ]; then
+	db_input high icecast2/hostname || true
+	db_go ||true
+	db_input high icecast2/sourcepassword || true
+	db_go ||true
+	db_input high icecast2/relaypassword|| true
+	db_go ||true
+	db_input high icecast2/adminpassword || true
+	db_go ||true
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/icecast2.postinst b/debian/icecast2.postinst
index ca9a341..eb12a54 100644
--- a/debian/icecast2.postinst
+++ b/debian/icecast2.postinst
@@ -3,8 +3,10 @@
 
 set -e
 
+. /usr/share/debconf/confmodule
+
 case "$1" in
-    configure)
+    configure|reconfigure)
 
     ;;
 
@@ -34,6 +36,37 @@ 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
+
 chown -R icecast2: /var/log/icecast2 /etc/icecast2
 # Set all file readable by default
 chmod -R ug=rw,o=r,ugo+X /etc/icecast2
diff --git a/debian/templates b/debian/templates
new file mode 100644
index 0000000..64e00e7
--- /dev/null
+++ b/debian/templates
@@ -0,0 +1,37 @@
+Template: icecast2/icecast-setup
+Type: boolean
+Default: false
+Description: Setup Icecast2 - Enable Live HTTP Streaming?
+ This option allows enable icecast2 on this server
+ and configure passwords for icecast-server.
+ .
+ If you have already manually tweaked icecast2 configuration
+ it may not work as expected.
+
+Template: icecast2/hostname
+Type: string
+Default: localhost
+Description: Icecast2 Hostname:
+ Specify a fully qualified domain name.
+ Icecast2 uses this as prefix to all streams.
+
+Template: icecast2/sourcepassword
+Type: string
+Default: hackme
+Description: Icecast2 Source Password:
+ Specify a password to send A/V sources to icecast
+
+Template: icecast2/relaypassword
+Type: string
+Default: hackme
+Description: Icecast2 Relay Password:
+ Specify the default password for stream relay access.
+
+Template: icecast2/adminpassword
+Type: string
+Default: hackme
+Description: Icecast2 Admin Password:
+ Specify the admin password. 
+ You can access icecast2's admin interface via
+ http://localhost:8000/ - and both monitor connection as
+ well as block users.
-- 
1.7.2.3


--------------040501070000040901070801--



More information about the pkg-multimedia-maintainers mailing list