[SCM] crtmpserver/master: Add postrm script for crtmpserver-apps.

jet-guest at users.alioth.debian.org jet-guest at users.alioth.debian.org
Sat Apr 14 19:45:40 UTC 2012


The following commit has been merged in the master branch:
commit fcacbed93b79609d8fd607f3e39b06c1bc5b7dc3
Author: Andriy Beregovenko <jet at jet.kiev.ua>
Date:   Sat Apr 14 22:33:43 2012 +0300

    Add postrm script for crtmpserver-apps.
    
    Add postrm script for package crtmpserver-apps to handle remove and
    purge action in proper way.

diff --git a/debian/crtmpserver-apps.postrm b/debian/crtmpserver-apps.postrm
new file mode 100644
index 0000000..361ccea
--- /dev/null
+++ b/debian/crtmpserver-apps.postrm
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+set -e
+
+APPLICATIONS="admin applestreamingclient appselector flvplayback proxypublish samplefactory stresstest vptests"
+
+compare() {
+	[ $# != 2 ] && exit 1
+	A=$(md5sum $1 | cut -d' ' -f1)
+	B=$(md5sum $2 | cut -d' ' -f1)
+	[ "$A" = "$B" ] && return 0 || return 1
+}
+
+do_remove() {
+	for app in $APPLICATIONS; do
+		if [ -f "/etc/crtmpserver/applications/$app.lua" ]; then
+			compare "/etc/crtmpserver/applications/$app.lua" \
+				"/usr/share/doc/crtmpserver-apps/examples/$app.lua" \
+				&& rm "/etc/crtmpserver/applications/$app.lua"
+		fi
+	done
+	rmdir /etc/crtmpserver/applications
+
+	if [ -f "/etc/crtmpserver/conf.d/users.lua" ]; then
+		compare "/etc/crtmpserver/conf.d/users.lua" \
+			"/usr/share/doc/crtmpserver-apps/examples/users.lua" \
+			&& rm /etc/crtmpserver/conf.d/users.lua
+	fi
+	rmdir /etc/crtmpserver/conf.d
+
+	if [ -f /etc/crtmpserver/enabled_applications.conf ]; then
+		compare "/etc/crtmpserver/enabled_applications.conf" \
+			"/usr/share/doc/crtmpserver-apps/examples/enabled_applications.conf" \
+			&& rm /etc/crtmpserver/enabled_applications.conf
+	fi
+	rmdir /etc/crtmpserver
+}
+
+do_purge() {
+	rm -r /etc/crtmpserver || exit 1
+}
+
+
+case "$1" in
+	remove)
+		do_remove
+		;;
+	purge)
+		do_remove
+		do_purge
+		;;
+	*)
+		exit 0
+		;;
+esac
+
+
+#DEBHELPER#
+

-- 
crtmpserver packaging



More information about the pkg-multimedia-commits mailing list