[Pkg-voip-commits] r4162 - asterisk/trunk/debian

paravoid at alioth.debian.org paravoid at alioth.debian.org
Mon Aug 20 04:04:32 UTC 2007


Author: paravoid
Date: 2007-08-20 04:04:32 +0000 (Mon, 20 Aug 2007)
New Revision: 4162

Added:
   asterisk/trunk/debian/asterisk-config.lintian-overrides
   asterisk/trunk/debian/asterisk.postinst
Log:
svn add forgotten files for r4157 (overhaul of postinst) -- oops

Added: asterisk/trunk/debian/asterisk-config.lintian-overrides
===================================================================
--- asterisk/trunk/debian/asterisk-config.lintian-overrides	                        (rev 0)
+++ asterisk/trunk/debian/asterisk-config.lintian-overrides	2007-08-20 04:04:32 UTC (rev 4162)
@@ -0,0 +1 @@
+asterisk-config: non-standard-file-perm

Added: asterisk/trunk/debian/asterisk.postinst
===================================================================
--- asterisk/trunk/debian/asterisk.postinst	                        (rev 0)
+++ asterisk/trunk/debian/asterisk.postinst	2007-08-20 04:04:32 UTC (rev 4162)
@@ -0,0 +1,86 @@
+#! /bin/sh
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+
+case "$1" in
+    configure)
+    	# add asterisk user and add it to dialout and audio groups
+	if ! getent passwd asterisk > /dev/null ; then
+		echo 'Adding system user for Asterisk' 1>&2
+		adduser --system --group --quiet \
+			--home /var/lib/asterisk \
+			--no-create-home --disabled-login \
+			--gecos "Asterisk PBX daemon" \
+			asterisk
+	fi 
+
+	for group in dialout audio; do
+		if groups asterisk | grep -w -q -v $group; then
+			adduser asterisk $group
+		fi
+	done
+
+	# chown asterisk on all $dirs and their subdirectories
+	# do not harm the files, they should be empty on new installations
+	# and we don't want to mess-up anything on old installations
+	find /var/log/asterisk /var/lib/asterisk -type d | while read dir; do
+		# honor dpkg-statoverride
+		if ! dpkg-statoverride --list "$dir" > /dev/null ; then
+			chown asterisk: $dir
+		fi
+	done 
+
+	# spool holds some sensitive information (e.g. monitor, voicemail etc.)
+	find /var/spool/asterisk -type d | while read dir; do
+		if ! dpkg-statoverride --list "$dir" > /dev/null ; then
+			chown asterisk: $dir
+			chmod 750 $dir
+		fi
+	done
+
+	### this is done here in case asterisk-config was installed/upgraded first
+
+	set +e # ignore errors temporarily
+
+	# find the name of the package providing config; either asterisk-config
+	# or a package providing asterisk-config-custom
+	ASTERISK_CONFIG=`dpkg-query -W -f='${Package}\t${Provides}\n' | \
+			 sed -nr 's/(.*)\tasterisk-config-custom|(asterisk-config)(\t.*)?/\1\2/p'`
+
+	# find conffiles under /etc/asterisk belonging to asterisk-config
+	# and chown them to user asterisk.
+	dpkg-query -W -f='${Conffiles}\n' $ASTERISK_CONFIG 2>/dev/null | \
+	  sed -nr -e 's; (/etc/asterisk/.*) [0-9a-f]*;\1;p' | \
+	while read conffile; do
+		chown asterisk: ${conffile} 2>/dev/null
+	done
+
+	set -e
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+




More information about the Pkg-voip-commits mailing list