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

paravoid at alioth.debian.org paravoid at alioth.debian.org
Mon Aug 20 03:40:25 UTC 2007


Author: paravoid
Date: 2007-08-20 03:40:24 +0000 (Mon, 20 Aug 2007)
New Revision: 4157

Modified:
   asterisk/trunk/debian/asterisk-config.postinst
   asterisk/trunk/debian/asterisk.dirs
   asterisk/trunk/debian/asterisk.install
   asterisk/trunk/debian/asterisk_fix
   asterisk/trunk/debian/changelog
   asterisk/trunk/debian/control
   asterisk/trunk/debian/rules
Log:
* Major overhaul of the postinst scripts, completely replacing asterisk_fix.
  - Create Asterisk's directories on asterisk.dirs to track them using dpkg.
  - Add asterisk.postinst which calls adduser, chown, chmod. Improve error
    handling.
  - Don't do unnecessary stuff on asterisk-config postinst.
    (Closes: #431506)
  - chmod /etc/asterisk on build-time to allow the user to modify the
    permissions; this required a lintian override.
  - Honor dpkg-statoverride on all the chowned/chmoded directories.
  - Handle asterisk-config -> asterisk installation order properly
    (Closes: #408708)
  - Don't depend on adduser from asterisk-config.

Modified: asterisk/trunk/debian/asterisk-config.postinst
===================================================================
--- asterisk/trunk/debian/asterisk-config.postinst	2007-08-20 01:48:18 UTC (rev 4156)
+++ asterisk/trunk/debian/asterisk-config.postinst	2007-08-20 03:40:24 UTC (rev 4157)
@@ -13,9 +13,17 @@
 
 case "$1" in
     configure)
-	if [ -x /usr/share/asterisk/bin/asterisk_fix ]; then
-		/usr/share/asterisk/bin/asterisk_fix
-	fi
+	set +e # ignore errors temporarily
+
+	# 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)

Modified: asterisk/trunk/debian/asterisk.dirs
===================================================================
--- asterisk/trunk/debian/asterisk.dirs	2007-08-20 01:48:18 UTC (rev 4156)
+++ asterisk/trunk/debian/asterisk.dirs	2007-08-20 03:40:24 UTC (rev 4157)
@@ -1 +1,19 @@
+etc/asterisk
+
+usr/share/asterisk
+var/log/asterisk
+var/spool/asterisk
+var/lib/asterisk
+var/run/asterisk
+
 usr/share/asterisk/static-http
+
+var/log/asterisk/cdr-csv
+var/log/asterisk/cdr-custom
+var/spool/asterisk/dictate
+var/spool/asterisk/meetme
+var/spool/asterisk/monitor
+var/spool/asterisk/monitor
+var/spool/asterisk/system
+var/spool/asterisk/tmp
+var/spool/asterisk/voicemail

Modified: asterisk/trunk/debian/asterisk.install
===================================================================
--- asterisk/trunk/debian/asterisk.install	2007-08-20 01:48:18 UTC (rev 4156)
+++ asterisk/trunk/debian/asterisk.install	2007-08-20 03:40:24 UTC (rev 4157)
@@ -2,4 +2,3 @@
 usr/sbin
 usr/share/asterisk/firmware
 usr/share/asterisk/keys
-../asterisk_fix usr/share/asterisk/bin

Modified: asterisk/trunk/debian/asterisk_fix
===================================================================
--- asterisk/trunk/debian/asterisk_fix	2007-08-20 01:48:18 UTC (rev 4156)
+++ asterisk/trunk/debian/asterisk_fix	2007-08-20 03:40:24 UTC (rev 4157)
@@ -1,83 +0,0 @@
-#! /bin/sh
-
-if getent passwd asterisk >/dev/null ;then
-	# Some halfbaked Sarge versions needed their home dir fixed:
-        if [ "`getent passwd asterisk|awk -F: '{print $6}'`" = \
-		"/var/run/asterisk" ];then
-		usermod -d /var/lib/asterisk asterisk
-        fi
-else
-	adduser_extra_opts=""
-	# Cosmetic noise reduction
-	if [ -d "/var/lib/asterisk" ]; then
-    		adduser_extra_opts="--no-create-home"
-	fi
-	adduser --system --group --home /var/lib/asterisk \
-	    $adduser_extra_opts \
-        	--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
-
-# Make sure all (possibly) used dirs exist and is owned by asterisk
-
-# /var/run/asterisk is not yet handled by init.d :-(
-# (/var/run/asterisk is handled in sysV script /etc/init.d/asterisk)
-
-dirs="
-        /var/log/asterisk
-        /var/spool/asterisk
-        /var/lib/asterisk
-	/var/run/asterisk
-        /etc/asterisk
-"
-
-subdirs="
-        /var/log/asterisk/cdr-csv
-        /var/log/asterisk/cdr-custom
-        /var/spool/asterisk/dictate
-        /var/spool/asterisk/meetme
-        /var/spool/asterisk/monitor
-        /var/spool/asterisk/monitor
-        /var/spool/asterisk/system
-        /var/spool/asterisk/tmp
-        /var/spool/asterisk/voicemail
-"
-
-for dir in $subdirs $dirs; do
-        mkdir -p "$dir"
-done
-
-for dir in $dirs; do
-        chown -R asterisk: "$dir"
-done
-
-
-###################################
-# this part should be reviewed, but it's basically trial and error
-# code i wrote to make freepbx work. better solutions are welcomed.
-
-# files need to be RW by the group
-# dirs need to a+rx
-chmod -R 0660 /etc/asterisk/
-find /etc/asterisk/ -type d -print0 | xargs -0 chmod ug+rx
-
-#chmod g+s /etc/asterisk/
-
-# this is needed because othewise sqlite cannot write to the DB
-#chmod -R 0660 /var/lib/asterisk/
-
-####################################
-# If asterisk in running, reload it
-# otherwise start it
-if [ -f "/etc/init.d/asterisk" ];then
-	if [ -f /var/run/asterisk/asterisk.pid ];then
-	    invoke-rc.d asterisk reload || exit $?
-	else
-	    invoke-rc.d asterisk restart || exit $?
-	fi
-fi

Modified: asterisk/trunk/debian/changelog
===================================================================
--- asterisk/trunk/debian/changelog	2007-08-20 01:48:18 UTC (rev 4156)
+++ asterisk/trunk/debian/changelog	2007-08-20 03:40:24 UTC (rev 4157)
@@ -27,8 +27,20 @@
   * Use libpri-bristuffed.so.1 and its respective header
     (use-libpri-bristuffed).
   * Ship xagi-test.c (from bristuff) to examples.
+  * Major overhaul of the postinst scripts, completely replacing asterisk_fix.
+    - Create Asterisk's directories on asterisk.dirs to track them using dpkg.
+    - Add asterisk.postinst which calls adduser, chown, chmod. Improve error
+      handling.
+    - Don't do unnecessary stuff on asterisk-config postinst.
+      (Closes: #431506)
+    - chmod /etc/asterisk on build-time to allow the user to modify the
+      permissions; this required a lintian override.
+    - Honor dpkg-statoverride on all the chowned/chmoded directories.
+    - Handle asterisk-config -> asterisk installation order properly
+      (Closes: #408708)
+    - Don't depend on adduser from asterisk-config.
 
- -- Faidon Liambotis <paravoid at debian.org>  Mon, 20 Aug 2007 04:35:21 +0300
+ -- Faidon Liambotis <paravoid at debian.org>  Mon, 20 Aug 2007 06:39:58 +0300
 
 asterisk (1:1.4.10~dfsg-1) unstable; urgency=low
 

Modified: asterisk/trunk/debian/control
===================================================================
--- asterisk/trunk/debian/control	2007-08-20 01:48:18 UTC (rev 4156)
+++ asterisk/trunk/debian/control	2007-08-20 03:40:24 UTC (rev 4157)
@@ -109,7 +109,6 @@
 
 Package: asterisk-config
 Recommends: asterisk
-Depends: adduser (>= 3.63)
 Conflicts: asterisk-config-custom
 Architecture: all
 Section: comm

Modified: asterisk/trunk/debian/rules
===================================================================
--- asterisk/trunk/debian/rules	2007-08-20 01:48:18 UTC (rev 4156)
+++ asterisk/trunk/debian/rules	2007-08-20 03:40:24 UTC (rev 4157)
@@ -141,8 +141,6 @@
 
 	dh_install -s --sourcedir=debian/tmp
 
-	chmod +x $(CURDIR)/debian/asterisk/usr/share/asterisk/bin/asterisk_fix
-
 	$(RM) -f $(CURDIR)/debian/asterisk/usr/sbin/{stereorize,streamplayer}
 	touch $@
 
@@ -157,6 +155,9 @@
 
 	dh_install -i --sourcedir=debian/tmp
 
+	install -m 0644 -D $(CURDIR)/debian/asterisk-config.lintian-overrides \
+		$(CURDIR)/debian/asterisk-config/usr/share/lintian/overrides/asterisk-config
+	
 	chmod +x $(CURDIR)/debian/asterisk-web-vmail/usr/lib/cgi-bin/asterisk/vmail.cgi
 	
 	
@@ -172,6 +173,9 @@
 	dh_link -i 
 	dh_compress -i
 	dh_fixperms -i
+	# should follow dh_fixperms; asterisk configurations may contain
+	# sensitive information, such as passwords
+	chmod o-rwx $(CURDIR)/debian/asterisk-config/etc/asterisk/*
 	dh_installdeb -i
 	dh_gencontrol -i
 	dh_md5sums -i




More information about the Pkg-voip-commits mailing list