You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Ralf S. Engelschall" <rs...@engelschall.com> on 1998/05/04 18:04:42 UTC

[PATCH] Substitute Some More Configuration Parameters (for 1.3.1-dev)

[for 1.3.1-dev]

Substitute Some More Configuration Parameters
=============================================

This patch lets APACI's configure script determine more configuration
parameters (Group, Port, ServerAdmin, ServerName) via some intelligent tests
to remove some of the classical hurdles for new users when setting up Apache.

Actually it currently substs

   Group #-1                         Group nobody                   
     :                                 :                         
   Port 80                           Port 8080
     :                          ==>    :                         
   ServerAdmin you@your.address      ServerAdmin rse@en5.engelschall.com
     :                                 :                         
   #ServerName new.server.com        #ServerName en5.engelschall.com

when the non-root "rse" user installs Apache under Solaris. Why?  Because #-1
causes problems under Solaris, Port 80 is not allowed for non-root users and
ServerAdmin and ServerName can be set to at least approximate the real things.

Greetings,
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Index: src/CHANGES
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/CHANGES,v
retrieving revision 1.815
diff -u -r1.815 CHANGES
--- CHANGES	1998/05/04 06:58:02	1.815
+++ CHANGES	1998/05/04 15:18:03
@@ -1,3 +1,15 @@
+Changes with Apache 1.3.1
+
+    : 
+
+  *) Let APACI's configure script determine some configuration parameters
+     (Group, Port, ServerAdmin, ServerName) via some intelligent tests to
+     remove some of the classical hurdles for new users when setting up
+     Apache.
+     [Ralf S. Engelschall]
+
+    :
+
 Changes with Apache 1.3b7
 
   *) Ronald Tschalaer's Accept-Encoding patch - preserve the "x-" in
Index: Makefile.tmpl
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/Makefile.tmpl,v
retrieving revision 1.31
diff -u -r1.31 Makefile.tmpl
--- Makefile.tmpl	1998/05/04 15:29:25	1.31
+++ Makefile.tmpl	1998/05/04 15:55:02
@@ -115,6 +115,12 @@
 suexec_caller   = @suexec_caller@
 suexec_userdir  = @suexec_userdir@
 
+#   some substituted configuration parameters
+conf_group       = @conf_group@
+conf_port        = @conf_port@
+conf_serveradmin = @conf_serveradmin@
+conf_servername  = @conf_servername@
+
 #   usage of src/support stuff
 build-support     = @build_support@
 install-support   = @install_support@
@@ -376,6 +382,10 @@
 			-e 's;logs/referer_log;$(logfiledir)/referer_log;' \
 			-e 's;logs/agent_log;$(logfiledir)/agent_log;' \
 			-e 's;conf/magic;$(sysconfdir)/magic;' \
+			-e 's;Group #-1;Group $(conf_group);' \
+			-e 's;Port 80;Port $(conf_port);' \
+			-e 's;ServerAdmin you@your.address;ServerAdmin $(conf_serveradmin);' \
+			-e 's;ServerName new.host.name;ServerName $(conf_servername);' \
         	> $(TOP)/$(SRC)/.apaci.install.tmp && \
 		echo "$(INSTALL_DATA) $(TOP)/conf/$${conf}-dist[*] $(root)$(sysconfdir)/$${conf}.default"; \
 		$(INSTALL_DATA) $(TOP)/$(SRC)/.apaci.install.tmp $(root)$(sysconfdir)/$${conf}.default; \
Index: configure
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/configure,v
retrieving revision 1.22
diff -u -r1.22 configure
--- configure	1998/04/27 13:00:59	1.22
+++ configure	1998/05/04 15:15:22
@@ -694,6 +694,54 @@
 fi
 
 ##
+##  determine special configuration parameters
+##
+conf_group="#-1"
+if [ ".`egrep ^nobody: /etc/group`" != . ]; then
+    conf_group="nobody"
+fi
+conf_port="80"
+if [ ".`id | grep root`" = . ]; then
+    conf_port="8080"
+fi
+username="$LOGNAME"
+if [ ".$username" = . ]; then
+    username="$USER"
+    if [ ".$username" = . ]; then
+        username="`whoami 2>/dev/null | sed -e 's/\n$//'`"
+        if [ ".$username" = . ]; then
+            username="`who am i 2>/dev/null | cut '-d ' -f1`"
+            if [ ".$username" = . ]; then
+                username="unknown"
+            fi
+        fi
+    fi
+fi
+hostname="`uname -n | sed -e 's/\n$//'`"
+if [ ".$hostname" = . ]; then
+    hostname="`hostname | sed -e 's/\n$//'`"
+    if [ ".$hostname" = . ]; then
+        hostname="hostname"
+    fi
+fi
+hostname="`echo $hostname | sed -e 's/\..*//'`"
+domainname="";
+if [ -f /etc/resolv.conf ]; then
+    domainname="`egrep '^[  ]*domain' /etc/resolv.conf |\
+                 sed -e 's/.*domain//' -e 's/^[     ]*//' \
+                     -e 's/^ *//' -e 's/^   *//' \
+                     -e 's/^\.//' -e 's/^/./'`"
+    if [ ".$domainname" = . ]; then
+        domainname="`egrep '^[ 	]*search' /etc/resolv.conf |\
+		             sed -e 's/.*search//' -e 's/^[ 	]*//' \
+					     -e 's/^ *//' -e 's/^	*//' \
+						 -e 's/ .*//' -e 's/^\.//' -e 's/^/./'`"
+    fi
+fi
+conf_serveradmin="$username@$hostname$domainname"
+conf_servername="$hostname$domainname"
+
+##
 ##  determine prefix-relative paths for directories
 ##  because Apache supports them for the -d and -f 
 ##  options, the LoadModule directive, etc.
@@ -773,6 +821,10 @@
 -e "s%@suexec@%$suexec%g" \
 -e "s%@suexec_caller@%$suexec_caller%g" \
 -e "s%@suexec_userdir@%$suexec_userdir%g" \
+-e "s%@conf_group@%$conf_group%g" \
+-e "s%@conf_port@%$conf_port%g" \
+-e "s%@conf_serveradmin@%$conf_serveradmin%g" \
+-e "s%@conf_servername@%$conf_servername%g" \
 -e "s%@build_support@%$build_support%g" \
 -e "s%@install_support@%$install_support%g" \
 -e "s%@clean_support@%$clean_support%g" \

Re: [PATCH] Substitute Some More Configuration Parameters (for 1.3.1-dev)

Posted by Manoj Kasichainula <ma...@io.com>.
On Mon, May 04, 1998 at 06:04:42PM +0200, Ralf S. Engelschall wrote:
>    Port 80                           Port 8080

I like to have my packages buildable by non-root users. This change
breaks that unless I patch.

>      :                          ==>    :                         
>    ServerAdmin you@your.address      ServerAdmin rse@en5.engelschall.com

Same issue, and the ServerAdmin would end up pointing to me by
default.

>      :                                 :                         
>    #ServerName new.server.com        #ServerName en5.engelschall.com

I think it's a bad idea to have my build machine's name embedded into
the config file.

To summarize, these are great changes for people building from the
tarball, but bad for package builders if we are trying to avoid lots
of patching. When this is incorporated into 1.3.1-dev, how about
options to control these changes, or better yet, a global option
--packagebuild which will disable this sort of environment adaptation?

-- 
Manoj Kasichainula - manojk at io dot com - http://www.io.com/~manojk/
"Everything sucks." - Butthead

Re: [PATCH] Substitute Some More Configuration Parameters (for 1.3.1-dev)

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Mon, May 04, 1998 at 07:04:42PM +0200, Ralf S. Engelschall wrote:
> Actually it currently substs
> 
>    Group #-1                         Group nobody                   
>      :                                 :                         
On my linux box (slackware derived), I have grooup "nogroup", but no
"nobody" group. Perhaps "nogroup" could be tried as a fallback.

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request