[Lunar-commits] CVS: moonbase/mail/sendmail Makefile, NONE, 1.1 BUILD, 1.6, 1.7 DETAILS, 1.9, 1.10 POST_INSTALL, 1.1, 1.2

Auke Kok sofar at lunar-linux.org
Wed Jan 7 14:14:18 GMT 2004


Update of /var/cvs/lunar/moonbase/mail/sendmail
In directory dbguin.lunar-linux.org:/tmp/cvs-serv10513

Modified Files:
	BUILD DETAILS POST_INSTALL 
Added Files:
	Makefile 
Log Message:
Rewriting the sendmail config setup. This time we install the m4 .cf macro's, so we can regenerate the etc/mail/*.cf files without reinstalling sendmail. I've also added a Makefile so you can regenerate them just by typing 'make'. Added a few .db files as well in there that might need updating. Should keep everyone happy now! This is becoming a nice module....


--- NEW FILE: Makefile ---
#
# Grabbed from a RH box, this makefile will allow you to quickly regen
# the most important sendmail configuration files
#

# the maps we can process:
POSSIBLE += $(shell test -f aliases       && echo aliases.db)
POSSIBLE += $(shell test -f bitdomain     && echo bitdomain.db)
POSSIBLE += $(shell test -f uudomain      && echo uudomain.db)
POSSIBLE += $(shell test -f genericstable && echo genericstable.db)
POSSIBLE += $(shell test -f userdb        && echo userdb.db)
POSSIBLE += $(shell test -f virtusertable && echo virtusertable.db)
POSSIBLE += $(shell test -f access        && echo access.db)
POSSIBLE += $(shell test -f domaintable   && echo domaintable.db)
POSSIBLE += $(shell test -f mailertable   && echo mailertable.db)

all: sendmail.cf submit.cf ${POSSIBLE}

# userdb requires btree hashtype:
userdb.db: userdb
	makemap btree $@ < $<

# aliases
aliases.db: aliases
	newaliases

%.db: %
	makemap hash $@ < $<

%.cf: %.mc
	@echo "Updating \"$@\""
	@if test -f /usr/share/sendmail/m4/cf.m4; then \
		if test -f $@ ; then mv -f $@ $@.bak; fi; \
		/usr/bin/m4 /usr/share/sendmail/m4/cf.m4 $< > $@; \
		chgrp mail $@;\
	fi;

clean:
	rm -f *.db *~

start:
	service sendmail start

stop:
	service sendmail stop

restart:
	service sendmail restart


Index: BUILD
===================================================================
RCS file: /var/cvs/lunar/moonbase/mail/sendmail/BUILD,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- BUILD	17 Oct 2003 04:46:43 -0000	1.6
+++ BUILD	7 Jan 2004 14:14:15 -0000	1.7
@@ -1,149 +1,50 @@
 (
 
-  # clear variables:
-  unset CONFIGURE_SENDMAIL REUSE AGREED JUNK
-
   # global options for sendmail:
-  echo "define(\`confGBINGRP', \`mail')" >> devtools/Site/site.config.m4
-  echo "define(\`confMSPQOWN', \`mail')" >> devtools/Site/site.config.m4
-  echo "define(\`confTRUSTED_USER', \`mail')" >> devtools/Site/site.config.m4
-  echo "define(\`confRUN_AS_USER', \`mail:mail')"  >> devtools/Site/site.config.m4
-  #
-  echo "define(\`confMANROOT', \`/usr/share/man/man')" >> devtools/Site/site.config.m4
+  echo "define(\`confGBINGRP', \`mail')" >> devtools/Site/site.config.m4  &&
+  echo "define(\`confMSPQOWN', \`mail')" >> devtools/Site/site.config.m4  &&
+  echo "define(\`confTRUSTED_USER', \`mail')" >> devtools/Site/site.config.m4  &&
+  echo "define(\`confRUN_AS_USER', \`mail:mail')"  >> devtools/Site/site.config.m4  &&
+  echo "define(\`confMANROOT', \`/usr/share/man/man')" >> devtools/Site/site.config.m4  &&
+  # global stuff for submit.mc:
+  echo "define(\`confTRUSTED_USER', \`mail')" >> cf/cf/submit.mc  &&
+  echo "define(\`confRUN_AS_USER', \`mail:mail')" >> cf/cf/submit.mc  &&
+  # pick a default sendmail.mc
+  cp cf/cf/generic-linux.mc cf/cf/sendmail.mc  &&
 
-  # 
-  # Now try to configure sendmail to create a sendmail.cf for this site
-  #
+  ( cd cf/cf && sh Build submit.cf sendmail.cf )  &&
 
-  echo ""
-  echo "================"
-  echo ""
-  echo "Sendmail can now be configured. If you have a working setup and wish"
-  echo "to keep exactly the same config you may safely skip this section by"
-  echo "answering 'n' to the next question. Alternatively, you can easily"
-  echo "reconfigure your current setup by entering the configuration part"
-  echo "of the installation by typing 'y'"
-  echo ""
-  # ask whether we want this at all
-  if query "Do you wish to (re)configure sendmail?" y
-  then
-    # do we have a backup sendmail.mc in /etc/mail???
-    if [ -f /etc/mail/sendmail.mc ]; then
-      # there exists a previously stored sendmail.mc!
-      # suggest using this one to create new config first
-      echo ""
-      echo "Sendmail was previously configured already and we can re-use"
-      echo "this configuration to reconfigure sendmail. Do you wish to"
-      echo "use the existing sendmail.mc to reconfigure sendmail?"
-      echo ""
-      if query "Re-use configuration?" y
-      then
-        cp /etc/mail/sendmail.mc cf/cf/sendmail.mc
-      fi
-    fi
-  
-    # suggest using the default generic-linux.mc if a sendmail.mc
-    # does not exist yet (not reusing an old one)
-    if [ ! -f cf/cf/sendmail.mc ]; then
-      echo ""
-      echo "I will put a default config.mc so you can edit it"
-      echo "manually. Please refer to the sendmail manual for"
-      echo "which features you need to add, change or remove."
-      echo "NOW would be a great time to fire up your browser"
-      echo "and surf to www.sendmail.org!"
-      echo ""
-      cp cf/cf/generic-linux.mc cf/cf/sendmail.mc
-      echo "Press Enter..."
-      read JUNK
-    fi
-  
-    # check for editor
-    if [ -z $EDITOR ]; then
-      EDITOR=vi
-    fi
-  
-    if [ -z `which $EDITOR` ]; then
-      # oops, no editor
-      echo "AIEE! I can't find an appropriate editor! please set the EDITOR"
-      echo "variable (e.g. export EDITOR=vi) and restart lin sendmail!"
-      exit 1
-    fi
-  
-    # fire up editor in a loop
-    while [ -z $AGREED ]; do
-      $EDITOR cf/cf/sendmail.mc
-      echo "Here's the result of the sendmail configuration file compilation,"
-      echo "if you don't like it or changed your mind, you can repeat this step"
-      echo "by typing 'n' at the next question"
-      echo ""
-      echo "=== sendmail.cf ==="
-      cd cf/cf
-      sh Build sendmail.cf
-      cd ../..
-      echo ""
-      
-      if query "Use this configuration?" y
-      then
-        # patch submit.cf
-        echo ""
-        echo "submit.cf will now be patched so it will run as user 'mail:mail',"
-        echo "using the standard submit.mc. This is almost always sufficient for"
-        echo "any user."
-        echo ""
-        echo "=== submit.cf ==="
-        cd cf/cf
-        echo "define(\`confTRUSTED_USER', \`mail')" >> submit.mc
-        echo "define(\`confRUN_AS_USER', \`mail:mail')" >> submit.mc
-        sh Build submit.cf
-        echo ""
-        echo "Press enter to continue with final installation..."
-        read JUNK
-  
-        # here we copy it to the right location:
-        mkdir -p /etc/mail
-        sh Build install-cf
-        cd ../..
-        # and our bonus: backup our .mc 2 :)
-        cp cf/cf/sendmail.mc /etc/mail/sendmail.mc
-        cp cf/cf/submit.mc /etc/mail/submit.mc
-        AGREED=y
-      else
-        AGREED=
-      fi
-    done
-  fi
+  sh Build  &&
 
-) && (
-  
-  #
-  # First compile the source code
-  #
-  sh Build
+  prepare_install  &&
 
-  #
-  # Installation of sendmail
-  #
-  
   # users to be created:
-  add_priv_user mail:mail
+  add_priv_user mail:mail  &&
   
+  sh Build install
+
   # directories and files:
-  mkdir -p /var/spool/mail
-  mkdir -p /var/spool/mqueue
-  mkdir -p /var/spool/clientmqueue
+  mkdir -p /etc/mail  &&
+  mkdir -p /var/spool/mail  &&
+  mkdir -p /var/spool/mqueue  &&
+  mkdir -p /var/spool/clientmqueue  &&
   
   # permissions, permissions, permissions!
-  chown -R root:mail /etc/mail
-  chown mail:mail /var/spool/mail
-  chown root:mail /var/spool/mqueue
-  chown mail:mail /var/spool/clientmqueue
-  
-  chmod 1777 /var/spool/mail
-  chmod 0750 /var/spool/mqueue
-  chmod 0770 /var/spool/clientmqueue
+  chown -R root:mail /etc/mail  &&
+  chown mail:mail /var/spool/mail  &&
+  chown root:mail /var/spool/mqueue  &&
+  chown mail:mail /var/spool/clientmqueue  &&
+ 
+  chmod 0750 /etc/mail  &&
+  chmod 1777 /var/spool/mail  &&
+  chmod 0750 /var/spool/mqueue  &&
+  chmod 0770 /var/spool/clientmqueue  &&
   
-  # have sendmail's install do it all over again
-  prepare_install
-  sh Build install
+  # copy the m4 stuff over:
+  mkdir -p /usr/share/sendmail  &&
+  cp -a cf/* /usr/share/sendmail  &&
+
+  # include this nifty configuration help thingamasomething:
+  install -m 644 -o root -g root $SCRIPT_DIRECTORY/Makefile /etc/mail/
   
 ) > $C_FIFO 2>&1

Index: DETAILS
===================================================================
RCS file: /var/cvs/lunar/moonbase/mail/sendmail/DETAILS,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- DETAILS	17 Oct 2003 04:46:43 -0000	1.9
+++ DETAILS	7 Jan 2004 14:14:15 -0000	1.10
@@ -5,7 +5,7 @@
    SOURCE_URL[0]=ftp://ftp.sendmail.org/pub/$MODULE/$SOURCE
    SOURCE_URL[1]=http://www.sendmail.org/ftp/$SOURCE
       SOURCE_VFY=md5:393f5d09d462f522c8288363870b2b42
-        WEB_SITE=http://www.sendmail.org
+        WEB_SITE=http://www.sendmail.org/
          ENTERED=20010922
          UPDATED=20031017
            SHORT="sendmail is the de-facto SMTP server."

Index: POST_INSTALL
===================================================================
RCS file: /var/cvs/lunar/moonbase/mail/sendmail/POST_INSTALL,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- POST_INSTALL	2 Jan 2003 09:37:04 -0000	1.1
+++ POST_INSTALL	7 Jan 2004 14:14:15 -0000	1.2
@@ -1,16 +1,16 @@
-# initialize the database, should not croak
-touch /etc/mail/local-host-names
-touch /etc/mail/aliases
-    
-if [ -f /etc/mail/aliases ] ; then
-  newaliases
-fi
-if [ -f /etc/mail/virtusers ] ; then
-  makemap hash /etc/mail/virtusers.db < /etc/mail/virtusers
-fi
-if [ -f /etc/mail/genericstable ] ; then
-  makemap hash /etc/mail/genericstable.db < /etc/mail/genericstable
-fi
-if [ -f /etc/mail/access ] ; then
-  makemap hash /etc/mail/access.db < /etc/mail/access
-fi
+if [ ! -f /etc/mail/local-host-names ] ; then
+  touch /etc/mail/local-host-names
+fi  &&
+if [ ! -f /etc/mail/aliases ] ; then
+  touch /etc/mail/aliases
+fi  &&
+if [ ! -f /etc/mail/sendmail.mc ] ; then
+  install -m 0640 -g mail -o root $SOURCE_DIRECTORY/cf/cf/sendmail.mc /etc/mail/
+  ( cd /etc/mail && make sendmail.cf )
+fi  &&
+if [ ! -f /etc/mail/submit.mc ] ; then
+  install -m 0640 -g mail -o root $SOURCE_DIRECTORY/cf/cf/submit.mc /etc/mail/
+  ( cd /etc/mail && make submit.cf )
+fi  &&
+( cd /etc/mail && make all )
+



More information about the Lunar-commits mailing list