[asterisk-commits] pabelanger: branch pabelanger/non-root r278695 - in /team/pabelanger/non-root...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 22 14:16:51 CDT 2010


Author: pabelanger
Date: Thu Jul 22 14:16:47 2010
New Revision: 278695

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=278695
Log:
Check if DADHI exists before restarting.

New logic added to check if user / group exists, if not we now handle it. 

We now default to 750 (dir) and 640 (file) permissions.  TODO: Explore away to make
this dynamic.

Do not create ASTSBINDIR directory, otherwise we will nuke a running system.

Uncomment [files] section in asterisk.conf.  Since we are locking down asterisk, we might
as well use what we have.


Modified:
    team/pabelanger/non-root/Makefile
    team/pabelanger/non-root/build_tools/post_install
    team/pabelanger/non-root/build_tools/pre_install
    team/pabelanger/non-root/configs/asterisk.conf.sample
    team/pabelanger/non-root/configure
    team/pabelanger/non-root/configure.ac
    team/pabelanger/non-root/include/asterisk/autoconfig.h.in
    team/pabelanger/non-root/makeopts.in

Modified: team/pabelanger/non-root/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/Makefile?view=diff&rev=278695&r1=278694&r2=278695
==============================================================================
--- team/pabelanger/non-root/Makefile (original)
+++ team/pabelanger/non-root/Makefile Thu Jul 22 14:16:47 2010
@@ -508,16 +508,16 @@
 # improved a lot.  I'll put it here for now.
 
 	for x in static-http/*; do \
-		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
+		$(INSTALL) -m 640 $$x $(DESTDIR)$(ASTDATADIR)/static-http ; \
 	done
 	if [ -d doc/tex/asterisk ] ; then \
-		$(INSTALL) -d $(DESTDIR)$(ASTDATADIR)/static-http/docs ; \
+		$(INSTALL) -d -m 750 $(DESTDIR)$(ASTDATADIR)/static-http/docs ; \
 		for n in doc/tex/asterisk/* ; do \
-			$(INSTALL) -m 644 $$n $(DESTDIR)$(ASTDATADIR)/static-http/docs ; \
+			$(INSTALL) -m 640 $$n $(DESTDIR)$(ASTDATADIR)/static-http/docs ; \
 		done \
 	fi
 	for x in images/*.jpg; do \
-		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
+		$(INSTALL) -m 640 $$x $(DESTDIR)$(ASTDATADIR)/images ; \
 	done
 	$(MAKE) -C sounds install
 
@@ -569,62 +569,61 @@
 OLDHEADERS=$(filter-out $(NEWHEADERS),$(notdir $(wildcard $(DESTDIR)$(ASTHEADERDIR)/*.h)))
 
 installdirs:
-	$(INSTALL) -d $(DESTDIR)$(MODULES_DIR)
-	$(INSTALL) -d $(DESTDIR)$(ASTSBINDIR)
-	$(INSTALL) -d $(DESTDIR)$(ASTETCDIR)
-	$(INSTALL) -d $(DESTDIR)$(ASTVARRUNDIR)
-	$(INSTALL) -d $(DESTDIR)$(ASTSPOOLDIR)
-	$(INSTALL) -d $(DESTDIR)$(ASTSPOOLDIR)/voicemail
-	$(INSTALL) -d $(DESTDIR)$(ASTSPOOLDIR)/dictate
-	$(INSTALL) -d $(DESTDIR)$(ASTSPOOLDIR)/system
-	$(INSTALL) -d $(DESTDIR)$(ASTSPOOLDIR)/tmp
-	$(INSTALL) -d $(DESTDIR)$(ASTSPOOLDIR)/meetme
-	$(INSTALL) -d $(DESTDIR)$(ASTSPOOLDIR)/monitor
-	$(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)
-	$(INSTALL) -d $(DESTDIR)$(ASTHEADERDIR)/doxygen
-	$(INSTALL) -d $(DESTDIR)$(ASTLOGDIR)
-	$(INSTALL) -d $(DESTDIR)$(ASTLOGDIR)/cdr-csv
-	$(INSTALL) -d $(DESTDIR)$(ASTLOGDIR)/cdr-custom
-	$(INSTALL) -d $(DESTDIR)$(ASTLOGDIR)/cel-csv
-	$(INSTALL) -d $(DESTDIR)$(ASTLOGDIR)/cel-custom
-	$(INSTALL) -d $(DESTDIR)$(ASTDATADIR)
-	$(INSTALL) -d $(DESTDIR)$(ASTDATADIR)/documentation
-	$(INSTALL) -d $(DESTDIR)$(ASTDATADIR)/documentation/thirdparty
-	$(INSTALL) -d $(DESTDIR)$(ASTDATADIR)/keys
-	$(INSTALL) -d $(DESTDIR)$(ASTDATADIR)/firmware
-	$(INSTALL) -d $(DESTDIR)$(ASTDATADIR)/firmware/iax
-	$(INSTALL) -d $(DESTDIR)$(ASTMANDIR)/man8
-	$(INSTALL) -d $(DESTDIR)$(ASTDATADIR)/static-http
-	$(INSTALL) -d $(DESTDIR)$(ASTDATADIR)/images
-	$(INSTALL) -d $(DESTDIR)$(AGI_DIR)
+	$(INSTALL) -d -m 750 $(DESTDIR)$(MODULES_DIR)
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTETCDIR)
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTVARRUNDIR)
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTSPOOLDIR)
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTSPOOLDIR)/voicemail
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTSPOOLDIR)/dictate
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTSPOOLDIR)/system
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTSPOOLDIR)/tmp
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTSPOOLDIR)/meetme
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTSPOOLDIR)/monitor
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTHEADERDIR)
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTHEADERDIR)/doxygen
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTLOGDIR)
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTLOGDIR)/cdr-csv
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTLOGDIR)/cdr-custom
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTLOGDIR)/cel-csv
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTLOGDIR)/cel-custom
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTDATADIR)
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTDATADIR)/documentation
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTDATADIR)/documentation/thirdparty
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTDATADIR)/keys
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTDATADIR)/firmware
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTDATADIR)/firmware/iax
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTMANDIR)/man8
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTDATADIR)/static-http
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTDATADIR)/images
+	$(INSTALL) -d -m 750 $(DESTDIR)$(AGI_DIR)
 
 bininstall: _all installdirs $(SUBDIRS_INSTALL)
-	$(INSTALL) -m 755 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
+	$(INSTALL) -m 750 main/asterisk $(DESTDIR)$(ASTSBINDIR)/
 	$(LN) -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
-	$(INSTALL) -m 755 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
-	$(INSTALL) -m 755 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
+	$(INSTALL) -m 750 contrib/scripts/astgenkey $(DESTDIR)$(ASTSBINDIR)/
+	$(INSTALL) -m 750 contrib/scripts/autosupport $(DESTDIR)$(ASTSBINDIR)/
 	if [ ! -f $(DESTDIR)$(ASTSBINDIR)/safe_asterisk -a ! -f /sbin/launchd ]; then \
 		cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/scripts/safe.tmp ; \
-		$(INSTALL) -c -m 755 contrib/scripts/safe.tmp $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ; \
+		$(INSTALL) -c -m 750 contrib/scripts/safe.tmp $(DESTDIR)$(ASTSBINDIR)/safe_asterisk ; \
 		rm -f contrib/scripts/safe.tmp ; \
 	fi
-	$(INSTALL) -m 644 include/asterisk.h $(DESTDIR)$(includedir)
-	$(INSTALL) -m 644 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
-	$(INSTALL) -m 644 include/asterisk/doxygen/*.h $(DESTDIR)$(ASTHEADERDIR)/doxygen
+	$(INSTALL) -m 640 include/asterisk.h $(DESTDIR)$(includedir)
+	$(INSTALL) -m 640 include/asterisk/*.h $(DESTDIR)$(ASTHEADERDIR)
+	$(INSTALL) -m 640 include/asterisk/doxygen/*.h $(DESTDIR)$(ASTHEADERDIR)/doxygen
 	if [ -n "$(OLDHEADERS)" ]; then \
 		rm -f $(addprefix $(DESTDIR)$(ASTHEADERDIR)/,$(OLDHEADERS)) ;\
 	fi
 
-	$(INSTALL) -m 644 doc/core-*.xml $(DESTDIR)$(ASTDATADIR)/documentation
-	$(INSTALL) -m 644 doc/appdocsxml.dtd $(DESTDIR)$(ASTDATADIR)/documentation
-	$(INSTALL) -m 644 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
-	$(INSTALL) -m 644 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
-	$(INSTALL) -m 644 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
-	$(INSTALL) -m 644 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
-	$(INSTALL) -m 644 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
-	$(INSTALL) -m 644 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
+	$(INSTALL) -m 640 doc/core-*.xml $(DESTDIR)$(ASTDATADIR)/documentation
+	$(INSTALL) -m 640 doc/appdocsxml.dtd $(DESTDIR)$(ASTDATADIR)/documentation
+	$(INSTALL) -m 640 keys/iaxtel.pub $(DESTDIR)$(ASTDATADIR)/keys
+	$(INSTALL) -m 640 keys/freeworlddialup.pub $(DESTDIR)$(ASTDATADIR)/keys
+	$(INSTALL) -m 640 doc/asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
+	$(INSTALL) -m 640 contrib/scripts/astgenkey.8 $(DESTDIR)$(ASTMANDIR)/man8
+	$(INSTALL) -m 640 contrib/scripts/autosupport.8 $(DESTDIR)$(ASTMANDIR)/man8
+	$(INSTALL) -m 640 contrib/scripts/safe_asterisk.8 $(DESTDIR)$(ASTMANDIR)/man8
 	if [ -f contrib/firmware/iax/iaxy.bin ] ; then \
-		$(INSTALL) -m 644 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
+		$(INSTALL) -m 640 contrib/firmware/iax/iaxy.bin $(DESTDIR)$(ASTDATADIR)/firmware/iax/iaxy.bin; \
 	fi
 
 $(SUBDIRS_INSTALL):
@@ -699,7 +698,6 @@
 # XXX why *.adsi is installed first ?
 adsi:
 	@echo Installing adsi config files...
-	$(INSTALL) -d $(DESTDIR)$(ASTETCDIR)
 	@for x in configs/*.adsi; do \
 		dst="$(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x`" ; \
 		if [ -f $${dst} ] ; then \
@@ -707,7 +705,7 @@
 		else \
 			echo "Installing $$x" ; \
 		fi ; \
-		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
+		$(INSTALL) -m 640 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x` ; \
 	done
 
 samples: adsi
@@ -727,7 +725,7 @@
 			fi ;\
 		fi ; \
 		echo "Installing file $$x"; \
-		$(INSTALL) -m 644 $$x $${dst} ;\
+		$(INSTALL) -m 640 $$x $${dst} ;\
 	done
 	if [ "$(OVERWRITE)" = "y" ]; then \
 		echo "Updating asterisk.conf" ; \
@@ -742,24 +740,26 @@
 			-e 's|^astrundir.*$$|astrundir => $(ASTVARRUNDIR)|' \
 			-e 's|^astlogdir.*$$|astlogdir => $(ASTLOGDIR)|' \
 			$(DESTDIR)$(ASTCONFPATH) > $(DESTDIR)$(ASTCONFPATH).tmp ; \
-		$(INSTALL) -c -m 644 $(DESTDIR)$(ASTCONFPATH).tmp $(DESTDIR)$(ASTCONFPATH) ; \
+		$(INSTALL) -c -m 640 $(DESTDIR)$(ASTCONFPATH).tmp $(DESTDIR)$(ASTCONFPATH) ; \
 		rm -f $(DESTDIR)$(ASTCONFPATH).tmp ; \
 	fi ; \
 	if [ "$(AST_USER)" ] ; then \
 		sed -e 's|^;runuser = asterisk.*$$|runuser = $(AST_USER)|' \
-                        $(DESTDIR)$(ASTCONFPATH) > $(DESTDIR)$(ASTCONFPATH).tmp ; \
-                $(INSTALL) -c -m 644 $(DESTDIR)$(ASTCONFPATH).tmp $(DESTDIR)$(ASTCONFPATH) ; \
-                rm -f $(DESTDIR)$(ASTCONFPATH).tmp ; \
+			-e 's|^;astctlowner = asterisk.*$$|astctlowner = $(AST_USER)|' \
+			$(DESTDIR)$(ASTCONFPATH) > $(DESTDIR)$(ASTCONFPATH).tmp ; \
+		$(INSTALL) -c -m 640 $(DESTDIR)$(ASTCONFPATH).tmp $(DESTDIR)$(ASTCONFPATH) ; \
+		rm -f $(DESTDIR)$(ASTCONFPATH).tmp ; \
 	fi ; \
 	if [ "$(AST_GROUP)" ] ; then \
 		sed -e 's|^;rungroup = asterisk.*$$|rungroup = $(AST_GROUP)|' \
-                        $(DESTDIR)$(ASTCONFPATH) > $(DESTDIR)$(ASTCONFPATH).tmp ; \
-                $(INSTALL) -c -m 644 $(DESTDIR)$(ASTCONFPATH).tmp $(DESTDIR)$(ASTCONFPATH) ; \
-                rm -f $(DESTDIR)$(ASTCONFPATH).tmp ; \
+			-e 's|^;astctlgroup = asterisk.*$$|astctlgroup = $(AST_GROUP)|' \
+			$(DESTDIR)$(ASTCONFPATH) > $(DESTDIR)$(ASTCONFPATH).tmp ; \
+		$(INSTALL) -c -m 640 $(DESTDIR)$(ASTCONFPATH).tmp $(DESTDIR)$(ASTCONFPATH) ; \
+		rm -f $(DESTDIR)$(ASTCONFPATH).tmp ; \
 	fi ; \
-	$(INSTALL) -d $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/INBOX
 	build_tools/make_sample_voicemail $(DESTDIR)/$(ASTDATADIR) $(DESTDIR)/$(ASTSPOOLDIR)
-	$(INSTALL) -d $(DESTDIR)$(ASTDATADIR)/phoneprov
+	$(INSTALL) -d -m 750 $(DESTDIR)$(ASTDATADIR)/phoneprov
 	@for x in phoneprov/*; do \
 		dst="$(DESTDIR)$(ASTDATADIR)/$$x" ;	\
 		if [ -f $${dst} ]; then \
@@ -775,16 +775,16 @@
 			fi ;\
 		fi ; \
 		echo "Installing file $$x"; \
-		$(INSTALL) -m 644 $$x $${dst} ;\
+		$(INSTALL) -m 640 $$x $${dst} ;\
 	done
 
 webvmail:
 	@[ -d $(DESTDIR)$(HTTP_DOCSDIR)/ ] || ( printf "http docs directory not found.\nUpdate assignment of variable HTTP_DOCSDIR in Makefile!\n" && exit 1 )
 	@[ -d $(DESTDIR)$(HTTP_CGIDIR) ] || ( printf "cgi-bin directory not found.\nUpdate assignment of variable HTTP_CGIDIR in Makefile!\n" && exit 1 )
-	$(INSTALL) -m 4755 contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
-	$(INSTALL) -d $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
+	$(INSTALL) -m 4750 contrib/scripts/vmail.cgi $(DESTDIR)$(HTTP_CGIDIR)/vmail.cgi
+	$(INSTALL) -d -m 750 $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk
 	for x in images/*.gif; do \
-		$(INSTALL) -m 644 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
+		$(INSTALL) -m 640 $$x $(DESTDIR)$(HTTP_DOCSDIR)/_asterisk/; \
 	done
 	@echo " +--------- Asterisk Web Voicemail ----------+"  
 	@echo " +                                           +"
@@ -813,64 +813,64 @@
 		$(INSTALL) -d $(ASTETCDIR)/../logrotate.d ; \
 	fi
 	sed 's#__LOGDIR__#$(ASTLOGDIR)#g' < contrib/scripts/asterisk.logrotate | sed 's#__SBINDIR__#$(ASTSBINDIR)#g' > contrib/scripts/asterisk.logrotate.tmp
-	$(INSTALL) -m 0644 contrib/scripts/asterisk.logrotate.tmp $(ASTETCDIR)/../logrotate.d/asterisk
+	$(INSTALL) -m 0640 contrib/scripts/asterisk.logrotate.tmp $(ASTETCDIR)/../logrotate.d/asterisk
 	rm -f contrib/scripts/asterisk.logrotate.tmp
 
 config:
 	@if [ "${OSARCH}" = "linux-gnu" ]; then \
 		if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then \
 			cat contrib/init.d/rc.redhat.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
-			$(INSTALL) -c -m 755 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/rc.d/init.d/asterisk ; \
+			$(INSTALL) -c -m 750 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/rc.d/init.d/asterisk ; \
 			rm -f contrib/init.d/rc.asterisk.tmp ; \
 			if [ ! -f $(DESTDIR)/etc/sysconfig/asterisk ] ; then \
-				$(INSTALL) -c -m 644 contrib/init.d/etc_default_asterisk $(DESTDIR)/etc/sysconfig/asterisk ; \
+				$(INSTALL) -c -m 640 contrib/init.d/etc_default_asterisk $(DESTDIR)/etc/sysconfig/asterisk ; \
 			fi ; \
 			if [ -z "$(DESTDIR)" ] ; then \
 				/sbin/chkconfig --add asterisk ; \
 			fi ; \
 		elif [ -f /etc/debian_version ] ; then \
 			cat contrib/init.d/rc.debian.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
-			$(INSTALL) -c -m 755 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/init.d/asterisk ; \
+			$(INSTALL) -c -m 750 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/init.d/asterisk ; \
 			rm -f contrib/init.d/rc.asterisk.tmp ; \
 			if [ ! -f $(DESTDIR)/etc/default/asterisk ] ; then \
-				$(INSTALL) -c -m 644 contrib/init.d/etc_default_asterisk $(DESTDIR)/etc/default/asterisk ; \
+				$(INSTALL) -c -m 640 contrib/init.d/etc_default_asterisk $(DESTDIR)/etc/default/asterisk ; \
 			fi ; \
 			if [ -z "$(DESTDIR)" ] ; then \
 				/usr/sbin/update-rc.d asterisk defaults 50 91 ; \
 			fi ; \
 		elif [ -f /etc/gentoo-release ] ; then \
 			cat contrib/init.d/rc.gentoo.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
-			$(INSTALL) -c -m 755 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/init.d/asterisk ; \
+			$(INSTALL) -c -m 750 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/init.d/asterisk ; \
 			rm -f contrib/init.d/rc.asterisk.tmp ; \
 			if [ -z "$(DESTDIR)" ] ; then \
 				/sbin/rc-update add asterisk default ; \
 			fi ; \
 		elif [ -f /etc/mandrake-release -o -f /etc/mandriva-release ] ; then \
 			cat contrib/init.d/rc.mandriva.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
-			$(INSTALL) -c -m 755 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/rc.d/init.d/asterisk ; \
+			$(INSTALL) -c -m 750 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/rc.d/init.d/asterisk ; \
 			rm -f contrib/init.d/rc.asterisk.tmp ; \
 			if [ ! -f /etc/sysconfig/asterisk ] ; then \
-				$(INSTALL) -c -m 644 contrib/init.d/etc_default_asterisk $(DESTDIR)/etc/sysconfig/asterisk ; \
+				$(INSTALL) -c -m 640 contrib/init.d/etc_default_asterisk $(DESTDIR)/etc/sysconfig/asterisk ; \
 			fi ; \
 			if [ -z "$(DESTDIR)" ] ; then \
 				/sbin/chkconfig --add asterisk ; \
 			fi ; \
 		elif [ -f /etc/SuSE-release -o -f /etc/novell-release ] ; then \
 			cat contrib/init.d/rc.suse.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
-			$(INSTALL) -c -m 755 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/init.d/asterisk ;\
+			$(INSTALL) -c -m 750 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/init.d/asterisk ;\
 			rm -f contrib/init.d/rc.asterisk.tmp ; \
 			if [ ! -f /etc/sysconfig/asterisk ] ; then \
-				$(INSTALL) -c -m 644 contrib/init.d/etc_default_asterisk $(DESTDIR)/etc/sysconfig/asterisk ; \
+				$(INSTALL) -c -m 640 contrib/init.d/etc_default_asterisk $(DESTDIR)/etc/sysconfig/asterisk ; \
 			fi ; \
 			if [ -z "$(DESTDIR)" ] ; then \
 				/sbin/chkconfig --add asterisk ; \
 			fi ; \
 		elif [ -f /etc/arch-release -o -f /etc/arch-release ] ; then \
 			cat contrib/init.d/rc.archlinux.asterisk | sed 's|__ASTERISK_ETC_DIR__|$(ASTETCDIR)|;s|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;' > contrib/init.d/rc.asterisk.tmp ; \
-			$(INSTALL) -c -m 755 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/rc.d/asterisk ; \
+			$(INSTALL) -c -m 750 contrib/init.d/rc.asterisk.tmp $(DESTDIR)/etc/rc.d/asterisk ; \
 			rm -f contrib/init.d/rc.asterisk.tmp ; \
 		elif [ -d $(DESTDIR)/Library/LaunchDaemons -a ! -f $(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist ] ; then \
-			$(INSTALL) -c -m 644 contrib/init.d/org.asterisk.asterisk.plist $(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist; \
+			$(INSTALL) -c -m 640 contrib/init.d/org.asterisk.asterisk.plist $(DESTDIR)/Library/LaunchDaemons/org.asterisk.asterisk.plist; \
 		elif [ -f /etc/slackware-version ]; then \
 			echo "Slackware is not currently supported, although an init script does exist for it."; \
 		else \

Modified: team/pabelanger/non-root/build_tools/post_install
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/build_tools/post_install?view=diff&rev=278695&r1=278694&r2=278695
==============================================================================
--- team/pabelanger/non-root/build_tools/post_install (original)
+++ team/pabelanger/non-root/build_tools/post_install Thu Jul 22 14:16:47 2010
@@ -8,14 +8,16 @@
 
 OS=`build_tools/checkOS`
 
-handle_ubuntu() {
-	udevadm control --reload-rules
-	/etc/init.d/dahdi restart
+handle_debian() {
+	if [ -f /etc/init.d/dahdi ] ; then
+		udevadm control --reload-rules
+		/etc/init.d/dahdi restart
+	fi
 }
 
 case "$OS" in
 	Ubuntu)
-	handle_ubuntu
+	handle_debian
 	;;
 
 	*)

Modified: team/pabelanger/non-root/build_tools/pre_install
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/build_tools/pre_install?view=diff&rev=278695&r1=278694&r2=278695
==============================================================================
--- team/pabelanger/non-root/build_tools/pre_install (original)
+++ team/pabelanger/non-root/build_tools/pre_install Thu Jul 22 14:16:47 2010
@@ -12,15 +12,23 @@
 
 OS=`build_tools/checkOS`
 
-handle_ubuntu() {
-	echo 'Adding system user for Asterisk'
-	adduser --system --group --home /var/lib/asterisk \
-		--disabled-login --gecos "Asterisk PBX daemon" $AST_USER
+handle_debian() {
+	# Check if group exists
+	if [ "x$AST_GROUP_EXIST" != "xyes" ] ; then
+		echo 'Adding system group for Asterisk'
+		addgroup --system $AST_GROUP
+	fi
+
+	if [ "x$AST_USER_EXIST" != "xyes" ] ; then
+		echo 'Adding system user for Asterisk'
+		adduser --system --ingroup $AST_GROUP --home $ASTVARLIBDIR \
+			--disabled-login --gecos "Asterisk PBX daemon" $AST_USER
+	fi
 }
 
 case "$OS" in
 	Ubuntu)
-	handle_ubuntu
+	handle_debian
 	;;
 
 	*)

Modified: team/pabelanger/non-root/configs/asterisk.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/configs/asterisk.conf.sample?view=diff&rev=278695&r1=278694&r2=278695
==============================================================================
--- team/pabelanger/non-root/configs/asterisk.conf.sample (original)
+++ team/pabelanger/non-root/configs/asterisk.conf.sample Thu Jul 22 14:16:47 2010
@@ -71,10 +71,10 @@
 				; lock.
 
 ; Changing the following lines may compromise your security.
-;[files]
-;astctlpermissions = 0660
-;astctlowner = root
-;astctlgroup = apache
+[files]
+astctlpermissions = 0640
+;astctlowner = asterisk
+;astctlgroup = asterisk 
 ;astctl = asterisk.ctl
 
 [compat]

Modified: team/pabelanger/non-root/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/configure.ac?view=diff&rev=278695&r1=278694&r2=278695
==============================================================================
--- team/pabelanger/non-root/configure.ac (original)
+++ team/pabelanger/non-root/configure.ac Thu Jul 22 14:16:47 2010
@@ -524,8 +524,11 @@
 [  --with-group=gid	name of the Asterisk group (default=asterisk)],
 ast_group="${withval}", ast_group="asterisk")
 
+
 AC_DEFINE_UNQUOTED([AST_USER],"$ast_user",[name of the Asterisk user])
+AC_DEFINE_UNQUOTED([AST_USER_EXIST],"$ast_user_exist",[Does Asterisk user exist])
 AC_DEFINE_UNQUOTED([AST_GROUP],"$ast_group",[name of the Asterisk group])
+AC_DEFINE_UNQUOTED([AST_GROUP_EXIST],"$ast_group_exist",[Does Asterisk group exist])
 
 AC_ARG_ENABLE([root],
 	[AS_HELP_STRING([--enable-root],
@@ -543,33 +546,41 @@
 	dnl parse /etc/passwd
 	AC_MSG_CHECKING([for ${ast_user} user])
 	if test "x$GETENT" != "x:" ; then
-		astuser=`getent passwd | grep -c ^${ast_user}:`
+		ast_user_exist=`getent passwd | grep -c ^${ast_user}:`
 	else
-		astuser=`cat /etc/passwd | grep -c ^${ast_user}:`
+		ast_user_exist=`cat /etc/passwd | grep -c ^${ast_user}:`
 	fi
 
-	if test "${astuser}" -eq 1 ; then
-		AC_MSG_RESULT(yes)
+	if test "${ast_user_exist}" -eq 1 ; then
+		ast_user_exist="yes"
 	else
-		AC_MSG_RESULT(no)
+		ast_user_exist="no"
 	fi
+
+	AC_MSG_RESULT(${ast_user_exist})
 	AST_USER="${ast_user}"
+	AST_USER_EXIST="${ast_user_exist}"
 	AC_SUBST([AST_USER])
+	AC_SUBST([AST_USER_EXIST])
 
 	AC_MSG_CHECKING([for ${ast_group} group])
 	if test "x$GETENT" != "x:" ; then
-		astgroup=`getent group | grep -c ^${ast_group}:`
+		ast_group_exist=`getent group | grep -c ^${ast_group}:`
 	else
-		astgroup=`cat /etc/group | grep -c ^${ast_group}:`
+		ast_group_exist=`cat /etc/group | grep -c ^${ast_group}:`
 	fi
 
-	if test "${astgroup}" -eq 1 ; then
-		AC_MSG_RESULT(yes)
+	if test "${ast_group_exist}" -eq 1 ; then
+		ast_group_exist="yes"
 	else
-		AC_MSG_RESULT(no)
+		ast_group_exist="no"
 	fi
+
+	AC_MSG_RESULT(${ast_group_exist})
 	AST_GROUP="${ast_group}"
+	AST_GROUP_EXIST="${ast_group_exist}"
 	AC_SUBST([AST_GROUP])
+	AC_SUBST([AST_GROUP_EXIST])
 fi
 AST_ENABLE_ROOT="${enable_root}"
 AC_SUBST([AST_ENABLE_ROOT])

Modified: team/pabelanger/non-root/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/include/asterisk/autoconfig.h.in?view=diff&rev=278695&r1=278694&r2=278695
==============================================================================
--- team/pabelanger/non-root/include/asterisk/autoconfig.h.in (original)
+++ team/pabelanger/non-root/include/asterisk/autoconfig.h.in Thu Jul 22 14:16:47 2010
@@ -13,11 +13,17 @@
 /* name of the Asterisk group */
 #undef AST_GROUP
 
+/* Does Asterisk group exist */
+#undef AST_GROUP_EXIST
+
 /* Define to 1 if internal poll should be used. */
 #undef AST_POLL_COMPAT
 
 /* name of the Asterisk user */
 #undef AST_USER
+
+/* Does Asterisk user exist */
+#undef AST_USER_EXIST
 
 /* Define to 1 if your system's implementation of mutexes supports comparison
    of a mutex to its initializer. */

Modified: team/pabelanger/non-root/makeopts.in
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/makeopts.in?view=diff&rev=278695&r1=278694&r2=278695
==============================================================================
--- team/pabelanger/non-root/makeopts.in (original)
+++ team/pabelanger/non-root/makeopts.in Thu Jul 22 14:16:47 2010
@@ -85,7 +85,9 @@
 AST_FORTIFY_SOURCE=@AST_FORTIFY_SOURCE@
 
 AST_USER=@AST_USER@
+AST_USER_EXIST=@AST_USER_EXIST@
 AST_GROUP=@AST_GROUP@
+AST_GROUP_EXIST=@AST_GROUP_EXIST@
 AST_ENABLE_ROOT=@AST_ENABLE_ROOT@
 
 ALSA_INCLUDE=@ALSA_INCLUDE@




More information about the asterisk-commits mailing list