Bug 26299

Summary: Improvement to Makefile in /etc/mail allows library of mc's for different hosts
Product: Base System Reporter: brett <brett>
Component: miscAssignee: Gregory Neil Shapiro <gshapiro>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description brett 2001-04-02 21:00:01 UTC
The Makefile in /etc/mail is a great improvement over past releases.
However, it doesn't make it easy to keep a set of different .mc
files on hand for different hosts! I've added a bit of code to
the Makefile that looks at the output of `hostname` and uses
`hostname`.mc as the .mc file from which sendmail.cf is built.
This lets an administrator take a library of .mc files from host
to host; the correct one is installed according to the host name.

Fix: 

The code I use is as follows (replacing the line that says 

SENDMAIL_MC?=           freebsd.mc

in the original):

# If the environment variable SENDMAIL_MC is defined, build cf from
# that. Otherwise, try to build `hostname`.mc. If there's no such
# file, fall back to freebsd.mc.

.ifndef SENDMAIL_MC
SENDMAIL_MC!=           hostname
SENDMAIL_MC:=           ${SENDMAIL_MC}.mc

.if !exists(${SENDMAIL_MC})
SENDMAIL_MC=            freebsd.mc
.endif
.endif

(and then continuing with

INSTALL_CF=             ${SENDMAIL_MC:R}.cf

etc.)

etc.
Comment 1 brett 2001-04-02 21:28:09 UTC
One additional note: A big advantage of having this code in place is that 
an administrator who desides to modify his sendmail.cf can copy 
freebsd.mc to foo.bar.com.mc and then begin editing THAT instead of the 
original. The original freebsd.mc can stay around as an example and/or as 
a fallback.

A note advising the administrator that this can be done (that is, copy 
freebsd.mc to foo.bar.com.mc and then modify it) should be added to the 
README if the code is inserted.

--Brett
Comment 2 Gregory Neil Shapiro freebsd_committer freebsd_triage 2001-04-03 04:25:25 UTC
State Changed
From-To: open->analyzed

Why couldn't this be done with a /etc/make.conf entry?  I'm not inclined to 
go overboard with this Makefile. 


Comment 3 Gregory Neil Shapiro freebsd_committer freebsd_triage 2001-04-03 04:25:25 UTC
Responsible Changed
From-To: freebsd-bugs->gshapiro

Over to sendmail maintainer
Comment 4 James Housley 2001-04-03 11:30:53 UTC
Brett,
  I think your idea is a good one, but why not go all the way?  Create
the file for the user/admin if it doesn't exist.  That way the
instructions can be simpler, no if you don't have ... then copy ... .

--- Makefile.orig       Thu Mar 29 11:03:42 2001
+++ Makefile    Tue Apr  3 06:27:21 2001
@@ -37,7 +37,14 @@
 # uucpdomain, virtusertable
 #
 
-SENDMAIL_MC?=          freebsd.mc
+.ifndef SENDMAIN_MC
+SENDMAIL_MC!=          hostname
+SENDMAIL_MC:=          ${SENDMAIL_MC}.mc
+
+${SENDMAIL_MC}:
+       cp freebsd.mc ${SENDMAIL_MC}
+.endif
+
 INSTALL_CF=            ${SENDMAIL_MC:R}.cf
 
 SENDMAIL_ALIASES?=     /etc/mail/aliases

-- 
/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
 X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
jeh@FreeBSD.org      http://www.FreeBSD.org     The Power to Serve
jim@TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
microsoft: "where do you want to go today?"
linux:     "where do you want to go tomorrow?"
BSD:       "are you guys coming, or what?"
Comment 5 brett 2001-04-03 18:23:13 UTC
James:

Interesting idea. The only catch is that you usually want to 
make edit the copy BEFORE you build. This wouldn't create the
copy until you ran make.

--Brett

At 04:30 AM 4/3/2001, James Housley wrote:
  
>Brett,
>  I think your idea is a good one, but why not go all the way?  Create
>the file for the user/admin if it doesn't exist.  That way the
>instructions can be simpler, no if you don't have ... then copy ... .
>
>--- Makefile.orig       Thu Mar 29 11:03:42 2001
>+++ Makefile    Tue Apr  3 06:27:21 2001
>@@ -37,7 +37,14 @@
> # uucpdomain, virtusertable
> #
> 
>-SENDMAIL_MC?=          freebsd.mc
>+.ifndef SENDMAIN_MC
>+SENDMAIL_MC!=          hostname
>+SENDMAIL_MC:=          ${SENDMAIL_MC}.mc
>+
>+${SENDMAIL_MC}:
>+       cp freebsd.mc ${SENDMAIL_MC}
>+.endif
>+
> INSTALL_CF=            ${SENDMAIL_MC:R}.cf
> 
> SENDMAIL_ALIASES?=     /etc/mail/aliases
>
>-- 
>/"\   ASCII Ribbon Campaign  .
>\ / - NO HTML/RTF in e-mail  .
> X  - NO Word docs in e-mail .
>/ \ -----------------------------------------------------------------
>jeh@FreeBSD.org      http://www.FreeBSD.org     The Power to Serve
>jim@TheHousleys.Net  http://www.TheHousleys.net
>---------------------------------------------------------------------
>microsoft: "where do you want to go today?"
>linux:     "where do you want to go tomorrow?"
>BSD:       "are you guys coming, or what?"
Comment 6 Gregory Neil Shapiro freebsd_committer freebsd_triage 2001-05-15 17:01:48 UTC
State Changed
From-To: analyzed->feedback

The change has been committed to the HEAD (-CURRENT).  It will be MFC'ed to 
RELENG_4 (-STABLE) in 8 days, at which time this PR will be closed.
Comment 7 Gregory Neil Shapiro freebsd_committer freebsd_triage 2001-05-24 21:52:27 UTC
State Changed
From-To: feedback->closed

The changes have been committed to -STABLE (RELENG_4).