Bug#623256: icecast2: added config/templates/postinst configuration

Robin Gareus robin at gareus.org
Mon Apr 18 18:09:26 UTC 2011


Package: icecast2
Version: 2.3.2-6
Severity: wishlist
Tags: patch


I've added config-templates and postinst configuration (passwords, 
hostname, enable-service) to icecast2.

Attached patch applies to revision baf67ba (currently HEAD) on
  http://git.debian.org/?p=pkg-multimedia/icecast2.git


-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (400, 'unstable'), (300, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.33.7.2-rt30 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages icecast2 depends on:
ii  adduser                   3.112+nmu2     add and remove users and groups
ii  debconf [debconf-2.0]     1.5.36         Debian configuration management sy
ii  libc6                     2.11.2-7       Embedded GNU C Library: Shared lib
ii  libcurl3-gnutls           7.21.0-1       Multi-protocol file transfer libra
ii  libkate1                  0.3.8-1        Kate is a codec for karaoke and te
ii  libogg0                   1.2.0~dfsg-1   Ogg bitstream library
ii  liboggkate1               0.3.8-1        Kate is a codec for karaoke and te
ii  libspeex1                 1.2~rc1-1      The Speex codec runtime library
ii  libssl0.9.8               0.9.8o-4       SSL shared libraries
ii  libtheora0                1.1.1+dfsg.1-3 The Theora Video Compression Codec
ii  libvorbis0a               1.3.1-1        The Vorbis General Audio Compressi
ii  libxml2                   2.7.8.dfsg-2   GNOME XML library
ii  libxslt1.1                1.1.26-6       XSLT 1.0 processing library - runt

icecast2 recommends no packages.

Versions of packages icecast2 suggests:
ii  ices2                         2.0.1-8    Ogg Vorbis streaming source for Ic

-- Configuration Files:
/etc/default/icecast2 changed [not included]
/etc/icecast2/icecast.xml [Errno 13] Permission denied: u'/etc/icecast2/icecast.xml'

-- no debconf information

*** /tmp/0001-added-configuration-template-postinst-setup.patch
>From 58b10173268e252f87a7e021d61a0e43ba3d13aa Mon Sep 17 00:00:00 2001
From: Robin Gareus <robin at gareus.org>
Date: Mon, 18 Apr 2011 19:22:15 +0200
Subject: [PATCH] added configuration template&postinst setup.

---
 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
-------------- next part --------------
>From 58b10173268e252f87a7e021d61a0e43ba3d13aa Mon Sep 17 00:00:00 2001
From: Robin Gareus <robin at gareus.org>
Date: Mon, 18 Apr 2011 19:22:15 +0200
Subject: [PATCH] added configuration template&postinst setup.

---
 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

-------------- next part --------------
>From 58b10173268e252f87a7e021d61a0e43ba3d13aa Mon Sep 17 00:00:00 2001
From: Robin Gareus <robin at gareus.org>
Date: Mon, 18 Apr 2011 19:22:15 +0200
Subject: [PATCH] added configuration template&postinst setup.

---
 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



More information about the pkg-multimedia-maintainers mailing list