[svn-commits] pabelanger: branch pabelanger/non-root r276868 - in /team/pabelanger/non-root...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 15 21:09:21 CDT 2010


Author: pabelanger
Date: Thu Jul 15 21:09:09 2010
New Revision: 276868

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=276868
Log:
A new approach for unprivileged installation.  Asterisk will now create a system
level user.  This will require much more testing to support the various OS's.
Also created 2 new scripts, pre_install and post_install.  pre_install will
be used to create the system level asterisk daemon and post_install will
be used to restart DAHDI.


Added:
    team/pabelanger/non-root/build_tools/checkOS   (with props)
    team/pabelanger/non-root/build_tools/post_install   (with props)
    team/pabelanger/non-root/build_tools/pre_install   (with props)
Modified:
    team/pabelanger/non-root/Makefile
    team/pabelanger/non-root/configure
    team/pabelanger/non-root/configure.ac
    team/pabelanger/non-root/contrib/init.d/etc_default_asterisk
    team/pabelanger/non-root/include/asterisk/autoconfig.h.in
    team/pabelanger/non-root/makeopts.in
    team/pabelanger/non-root/sounds/Makefile

Modified: team/pabelanger/non-root/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/Makefile?view=diff&rev=276868&r1=276867&r2=276868
==============================================================================
--- team/pabelanger/non-root/Makefile (original)
+++ team/pabelanger/non-root/Makefile Thu Jul 15 21:09:09 2010
@@ -88,6 +88,9 @@
 export GREP
 export MD5
 export WGET_EXTRA_ARGS
+export AST_USER
+export AST_GROUP
+export AST_ENABLE_ROOT
 
 # even though we could use '-include makeopts' here, use a wildcard
 # lookup anyway, so that make won't try to build makeopts if it doesn't
@@ -124,12 +127,13 @@
 # Include debug and macro symbols in the executables (-g) and profiling info (-pg)
 DEBUG=-g3
 
-ifneq ($(AST_USER),)
-  INSTALL+= -o $(AST_USER)
-endif
-
-ifneq ($(AST_GROUP),)
-  INSTALL+= -g $(AST_GROUP)
+ifneq ($(AST_ENABLE_ROOT),yes)
+  ifneq ($(AST_USER),)
+    INSTALL+= -o $(AST_USER)
+  endif
+  ifneq ($(AST_GROUP),)
+    INSTALL+= -g $(AST_GROUP)
+  endif
 endif
 
 # Define standard directories for various platforms
@@ -643,6 +647,12 @@
 		echo " WARNING WARNING WARNING" ;\
 	fi
 
+preinstall:
+	build_tools/pre_install
+
+postinstall:
+	build_tools/post_install
+
 badshell:
 ifneq ($(findstring ~,$(DESTDIR)),)
 	@echo "Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
@@ -650,7 +660,8 @@
 	@exit 1
 endif
 
-install: badshell bininstall datafiles
+install: preinstall badshell bininstall datafiles postinstall
+
 	@if [ -x /usr/sbin/asterisk-post-install ]; then \
 		/usr/sbin/asterisk-post-install $(DESTDIR) . ; \
 	fi

Added: team/pabelanger/non-root/build_tools/checkOS
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/build_tools/checkOS?view=auto&rev=276868
==============================================================================
--- team/pabelanger/non-root/build_tools/checkOS (added)
+++ team/pabelanger/non-root/build_tools/checkOS Thu Jul 15 21:09:09 2010
@@ -1,0 +1,35 @@
+#!/bin/sh
+
+set -e
+
+OS=`uname -s`
+distro='Unsupported'
+
+if [ "$OS" != 'Linux' ] ; then
+	echo $distro
+	exit
+fi
+
+if [ -f /etc/debian_version ] ; then
+	if [ -f /etc/lsb-release ] ; then
+		distro='Ubuntu'
+	else
+		distro='Debian'
+	fi
+elif [ -f /etc/gentoo-release ] ; then
+	distro='Gentoo'
+elif [ -f /etc/mandrake-release ] ; then
+	distro='Mandriva'
+elif [ -f /etc/redhat-release ] ; then
+	if [ -r /etc/fedora-release ] ; then
+		distro='Fedora'
+	else
+		distro='RedHat'
+	fi
+elif [ -f /etc/slackware-version ] ; then
+	distro='Slackware'
+elif [ -f /etc/SuSE-release ] ; then
+	distro='SUSE'
+fi
+
+echo $distro

Propchange: team/pabelanger/non-root/build_tools/checkOS
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/pabelanger/non-root/build_tools/checkOS
------------------------------------------------------------------------------
    svn:executable = *

Propchange: team/pabelanger/non-root/build_tools/checkOS
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/pabelanger/non-root/build_tools/checkOS
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/pabelanger/non-root/build_tools/post_install
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/build_tools/post_install?view=auto&rev=276868
==============================================================================
--- team/pabelanger/non-root/build_tools/post_install (added)
+++ team/pabelanger/non-root/build_tools/post_install Thu Jul 15 21:09:09 2010
@@ -1,0 +1,24 @@
+#!/bin/sh
+## Make sure we were called from Makefile
+
+if [ "x$ASTERISKVERSIONNUM" = "x" ]; then
+	echo " ** Do not call this script directly"
+	exit
+fi
+
+OS=`build_tools/checkOS`
+
+handle_ubuntu() {
+	udevadm control --reload-rules
+	/etc/init.d/dahdi restart
+}
+
+case "$OS" in
+	Ubuntu)
+	handle_ubuntu
+	;;
+
+	*)
+	echo "$OS"
+	;;
+esac

Propchange: team/pabelanger/non-root/build_tools/post_install
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/pabelanger/non-root/build_tools/post_install
------------------------------------------------------------------------------
    svn:executable = *

Propchange: team/pabelanger/non-root/build_tools/post_install
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/pabelanger/non-root/build_tools/post_install
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/pabelanger/non-root/build_tools/pre_install
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/build_tools/pre_install?view=auto&rev=276868
==============================================================================
--- team/pabelanger/non-root/build_tools/pre_install (added)
+++ team/pabelanger/non-root/build_tools/pre_install Thu Jul 15 21:09:09 2010
@@ -1,0 +1,29 @@
+#!/bin/sh
+## Make sure we were called from Makefile
+
+if [ "x$ASTERISKVERSIONNUM" = "x" ]; then
+	echo " ** Do not call this script directly"
+	exit
+fi
+
+if [ "x$AST_ENABLE_ROOT" = "xyes" ] ; then
+	exit
+fi
+
+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
+}
+
+case "$OS" in
+	Ubuntu)
+	handle_ubuntu
+	;;
+
+	*)
+	echo "$OS"
+	;;
+esac

Propchange: team/pabelanger/non-root/build_tools/pre_install
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/pabelanger/non-root/build_tools/pre_install
------------------------------------------------------------------------------
    svn:executable = *

Propchange: team/pabelanger/non-root/build_tools/pre_install
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/pabelanger/non-root/build_tools/pre_install
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/pabelanger/non-root/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/configure.ac?view=diff&rev=276868&r1=276867&r2=276868
==============================================================================
--- team/pabelanger/non-root/configure.ac (original)
+++ team/pabelanger/non-root/configure.ac Thu Jul 15 21:09:09 2010
@@ -516,6 +516,8 @@
 		*) AC_MSG_ERROR(bad value ${enableval} for --enable-root) ;;
 	esac], [enable_root=no])
 
+AC_DEFINE_UNQUOTED([AST_ENABLE_ROOT],"$enable_root",[Enable root installation])
+
 dnl Check for asterisk in /etc/passwd
 if test "${enable_root}" = "no" ; then
 	dnl parse /etc/passwd
@@ -528,15 +530,11 @@
 
 	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
+	AST_USER="${ast_user}"
+	AC_SUBST([AST_USER])
 
 	AC_MSG_CHECKING([for ${ast_group} group])
 	if test "x$GETENT" != "x:" ; then
@@ -547,16 +545,14 @@
 
 	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
+	AST_GROUP="${ast_group}"
+	AC_SUBST([AST_GROUP])
+fi
+AST_ENABLE_ROOT="${enable_root}"
+AC_SUBST([AST_ENABLE_ROOT])
 
 # https support (in main/http.c) uses funopen on BSD systems,
 # fopencookie on linux

Modified: team/pabelanger/non-root/contrib/init.d/etc_default_asterisk
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/contrib/init.d/etc_default_asterisk?view=diff&rev=276868&r1=276867&r2=276868
==============================================================================
--- team/pabelanger/non-root/contrib/init.d/etc_default_asterisk (original)
+++ team/pabelanger/non-root/contrib/init.d/etc_default_asterisk Thu Jul 15 21:09:09 2010
@@ -39,4 +39,3 @@
 # Start all recordings into a temporary directory, before moving them to
 # their final location.
 #TEMPRECORDINGLOCATION=yes
-

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=276868&r1=276867&r2=276868
==============================================================================
--- team/pabelanger/non-root/include/asterisk/autoconfig.h.in (original)
+++ team/pabelanger/non-root/include/asterisk/autoconfig.h.in Thu Jul 15 21:09:09 2010
@@ -6,6 +6,9 @@
 #include "asterisk/buildopts.h"
 
 
+
+/* Enable root installation */
+#undef AST_ENABLE_ROOT
 
 /* name of the Asterisk group */
 #undef AST_GROUP
@@ -809,7 +812,7 @@
 /* Define to 1 if you have the `strtoq' function. */
 #undef HAVE_STRTOQ
 
-/* Define to 1 if `st_blksize' is member of `struct stat'. */
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
 /* Define to 1 if you have the mISDN Supplemental Services library. */
@@ -1077,11 +1080,11 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
-
-/* Define to 1 if the C compiler supports function prototypes. */
-#undef PROTOTYPES
 
 /* Define to necessary symbol if this constant uses a non-standard name on
    your system. */
@@ -1101,11 +1104,6 @@
 
 /* Define to the type of arg 5 for `select'. */
 #undef SELECT_TYPE_ARG5
-
-/* Define to 1 if the `setvbuf' function takes the buffering type as its
-   second argument and the buffer pointer as the third, as on System V before
-   release 3. */
-#undef SETVBUF_REVERSED
 
 /* The size of `char *', as computed by sizeof. */
 #undef SIZEOF_CHAR_P
@@ -1136,20 +1134,30 @@
 /* Define to 1 if your <sys/time.h> declares `struct tm'. */
 #undef TM_IN_SYS_TIME
 
-/* Define to 1 if on AIX 3.
-   System headers sometimes define this.
-   We just want to avoid a redefinition error message.  */
+/* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
 /* Enable GNU extensions on systems that have them.  */
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
 #endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
 
 /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
 #undef _LARGEFILE_SOURCE
@@ -1166,20 +1174,6 @@
 
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
-
-/* Enable extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-
-/* Define like PROTOTYPES; this can be used by system headers. */
-#undef __PROTOTYPES
 
 /* Define to empty if `const' does not conform to ANSI C. */
 #undef const

Modified: team/pabelanger/non-root/makeopts.in
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/makeopts.in?view=diff&rev=276868&r1=276867&r2=276868
==============================================================================
--- team/pabelanger/non-root/makeopts.in (original)
+++ team/pabelanger/non-root/makeopts.in Thu Jul 15 21:09:09 2010
@@ -84,6 +84,7 @@
 
 AST_USER=@AST_USER@
 AST_GROUP=@AST_GROUP@
+AST_ENABLE_ROOT=@AST_ENABLE_ROOT@
 
 ALSA_INCLUDE=@ALSA_INCLUDE@
 ALSA_LIB=@ALSA_LIB@

Modified: team/pabelanger/non-root/sounds/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/pabelanger/non-root/sounds/Makefile?view=diff&rev=276868&r1=276867&r2=276868
==============================================================================
--- team/pabelanger/non-root/sounds/Makefile (original)
+++ team/pabelanger/non-root/sounds/Makefile Thu Jul 15 21:09:09 2010
@@ -177,7 +177,7 @@
 	rm -f *.tar.gz
 
 $(SOUNDS_DIR)/en $(MOH_DIR) $(SOUNDS_DIR)/es $(SOUNDS_DIR)/fr $(SOUNDS_CACHE_DIR):
-	${INSTALL} -d -p $@
+	$(INSTALL) -d -p $@
 
 permissions:
 	@if [ "$(AST_USER)" != "" ] ; then \




More information about the svn-commits mailing list