[asterisk-commits] pabelanger: branch pabelanger/non-root r276727 - /team/pabelanger/non-root/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 15 10:32:59 CDT 2010


Author: pabelanger
Date: Thu Jul 15 10:32:55 2010
New Revision: 276727

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=276727
Log:
Rework checking for asterisk user and group again.  Try getent first, then fallback
to /etc/passwd and /etc/group


Modified:
    team/pabelanger/non-root/Makefile
    team/pabelanger/non-root/Makefile.moddir_rules
    team/pabelanger/non-root/configure
    team/pabelanger/non-root/configure.ac

Modified: team/pabelanger/non-root/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/Makefile?view=diff&rev=276727&r1=276726&r2=276727
==============================================================================
--- team/pabelanger/non-root/Makefile (original)
+++ team/pabelanger/non-root/Makefile Thu Jul 15 10:32:55 2010
@@ -124,11 +124,11 @@
 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
 DEBUG=-g3
 
-ifneq ($AST_USER,)
+ifneq ($(AST_USER),)
   INSTALL+= -o $(AST_USER)
 endif
 
-ifneq ($AST_GROUP,)
+ifneq ($(AST_GROUP),)
   INSTALL+= -g $(AST_GROUP)
 endif
 

Modified: team/pabelanger/non-root/Makefile.moddir_rules
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/Makefile.moddir_rules?view=diff&rev=276727&r1=276726&r2=276727
==============================================================================
--- team/pabelanger/non-root/Makefile.moddir_rules (original)
+++ team/pabelanger/non-root/Makefile.moddir_rules Thu Jul 15 10:32:55 2010
@@ -28,11 +28,11 @@
 
 include $(ASTTOPDIR)/Makefile.rules
 
-ifneq ($AST_USER,)
+ifneq ($(AST_USER),)
   INSTALL+= -o $(AST_USER)
 endif
 
-ifneq ($AST_GROUP,)
+ifneq ($(AST_GROUP),)
   INSTALL+= -g $(AST_GROUP)
 endif
 

Modified: team/pabelanger/non-root/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/configure.ac?view=diff&rev=276727&r1=276726&r2=276727
==============================================================================
--- team/pabelanger/non-root/configure.ac (original)
+++ team/pabelanger/non-root/configure.ac Thu Jul 15 10:32:55 2010
@@ -203,6 +203,7 @@
 AC_PATH_PROG([CATDVI], [catdvi], :)
 AC_PATH_PROG([KPATHSEA], [kpsewhich], :)
 AC_PATH_PROG([XMLSTARLET], [xmlstarlet], :)
+AC_PATH_PROG([GETENT], [getent], :)
 if test "${WGET}" != ":" ; then
   DOWNLOAD=${WGET}
 else if test "${CURL}" != ":" ; then
@@ -510,37 +511,41 @@
 if test "${enable_root}" = "no" ; then
 	dnl parse /etc/passwd
 	AC_MSG_CHECKING([for ${ast_user} user])
-	if test -r /etc/passwd ; then
-		astuser=`cat /etc/passwd | grep -c ${ast_user}`
+	if test "x$GETENT" != "x:" ; then
+		astuser=`getent passwd | grep -c ^${ast_user}:`
+	else
+		astuser=`cat /etc/passwd | grep -c ^${ast_user}:`
 	fi
 
-	if test "${astuser}" -eq 0 ; then
-		AC_MSG_RESULT(no)
-		AC_MSG_NOTICE(*** Unable to install Asterisk using ${ast_user} user permission; confirm the user exists.)
-		AC_MSG_NOTICE(*** Please run the 'configure' script with the '--enable-root' parameter option)
-		AC_MSG_NOTICE(*** or create the appropiate user.)
-		exit 1
-	else
+	if test "${astuser}" -eq 1 ; then
 		AC_MSG_RESULT(yes)
 		AST_USER="${ast_user}"
 		AC_SUBST([AST_USER])
+	else
+		AC_MSG_RESULT(no)
+		AC_MSG_NOTICE(*** Unable to install Asterisk using ${ast_user} user permission; confirm the user exists.)
+		AC_MSG_NOTICE(*** Please run the 'configure' script with the '--enable-root' parameter option or create)
+		AC_MSG_NOTICE(*** the appropiate user.)
+		exit 1
 	fi
 
 	AC_MSG_CHECKING([for ${ast_group} group])
-	if test -r /etc/passwd ; then
-		astgroup=`cat /etc/group | grep -c ${ast_group}`
+	if test "x$GETENT" != "x:" ; then
+		astgroup=`getent group | grep -c ^${ast_group}:`
+	else
+		astgroup=`cat /etc/group | grep -c ^${ast_group}:`
 	fi
 
-	if test "${astgroup}" -eq 0 ; then
-		AC_MSG_RESULT(no)
-		AC_MSG_NOTICE(*** Unable to install Asterisk using ${ast_group} group permission; confirm the group exists.)
-		AC_MSG_NOTICE(*** Please run the 'configure' script with the '--enable-root' parameter option)
-		AC_MSG_NOTICE(*** or create the appropiate group.)
-		exit 1
-	else
+	if test "${astgroup}" -eq 1 ; then
 		AC_MSG_RESULT(yes)
 		AST_GROUP="${ast_group}"
 		AC_SUBST([AST_GROUP])
+	else
+		AC_MSG_RESULT(no)
+		AC_MSG_NOTICE(*** Unable to install Asterisk using ${ast_group} group permission; confirm the group exists.)
+		AC_MSG_NOTICE(*** Please run the 'configure' script with the '--enable-root' parameter option or create)
+		AC_MSG_NOTICE(*** the appropiate group.)
+		exit 1
 	fi
 fi
 
@@ -1545,7 +1550,7 @@
 
 AC_ARG_ENABLE([xmldoc],
 	[AS_HELP_STRING([--disable-xmldoc],
-		[Explicitly disable XML documentation])],
+		[Explicity disable XML documentation])],
 	[case "${enableval}" in
 		y|ye|yes) disable_xmldoc=no ;;
 		n|no)  disable_xmldoc=yes ;;




More information about the asterisk-commits mailing list