Sorry about that all, the Makefile ended up getting even more broken --
the changes I made were just meant to get the ball rolling.
Here's a replacement Makefile. I've also changed all the rules to use
BSD install. An install.sh is included and used by default. This should
finally settle all the chown/chmod problems. The install.sh is one taken
from INN and BIND, with one slight tweak so it works with "install path/file dir".
It's not quite perfect- for example this BINBIN, BIN and TOOLS stuff needs to be
trashed. There should be PROGS (majordomo, resend, digest, etc, mode 755),
FILES (*.pl, mode 644) and the wrapper (separate install rule). Right
now everything but wrapper just gets installed 755. I also think
the script configuring should be moved to the default "make" rule as well
as the wrapper. (no more 'make wrapper'). That part would be done as
the user. The 'make install' would start at the copying of the tmp/* files.
Right now a 'make install' generates this root-owned cruft in $builddir/tmp.
One shouldn't assume that root can write to the build directory.
But anyway this works, and to me is a whole heck of a lot clearer to the
average user.
#$Modified: Fri Nov 22 17:04:11 1996 by cwilson $
#
# $Source: /sources/cvsrepos/majordomo/Makefile,v $
# $Revision: 1.53 $
# $Date: 1996/11/22 16:33:29 $
# $Header: /sources/cvsrepos/majordomo/Makefile,v 1.53 1996/11/22 16:33:29 cwilson Exp $
#
# This is the Makefile for Majordomo.
#
#------------- Configure these items ----------------#
#
# Put the location of your Perl binary here:
PERL = /usr/local/bin/perl
# The name of your C compiler.
CC=cc
# Where do you want Majordomo to be installed? This CANNOT be the
# current directory (where you unpacked the distribution)
W_HOME = /usr/local/lib/majordomo-$(VERSION)
# Where do you want man pages to be installed?
MAN1 = $(W_HOME)/man/man1
MAN8 = $(W_HOME)/man/man8
# You need to have or create a user and group which majordomo will run as.
# Enter the UID and GID (not their names!) here:
W_USER = 123
W_GROUP = 45
# If your system is POSIX (e.g. Sun Solaris, SGI Irix 5 and 6, Dec Ultrix MIPS,
# BSDI or other 4.4-based BSD, Linux) use the following three lines. Do not
# change these values!
WRAPPER_USER = root
WRAPPER_CHMOD = 4755
POSIX = -DPOSIX_UID=$(W_USER) -DPOSIX_GID=$(W_GROUP)
# Otherwise, if your system is NOT POSIX (e.g. SunOS 4.x, SGI Irix 4,
# HP DomainOS) then comment out the above three lines and uncomment
# the following three lines.
#WRAPPER_USER = $(W_USER)
#WRAPPER_CHMOD = 6755
#POSIX =
# Define this if the majordomo programs should *also* be run in the same
# group as your MTA, usually sendmail. This is rarely needed, but some
# MTAs require certain group memberships before allowing the message sender
# to be set arbitrarily.
#
# MAIL_GID = numeric_gid_of_MTA
#--------YOU SHOULDN'T HAVE TO CHANGE ANYTHING BELOW THIS LINE.-------------
VERSION = 1.94.1
W_MAJORDOMO_CF=$(W_HOME)/majordomo.cf
W_BIN=$(W_HOME)
WRAPPER_FLAGS = -DBIN=\"$(W_BIN)\" -DPATH=\"PATH=$(W_PATH)\" \
-DHOME=\"HOME=$(W_HOME)\" -DSHELL=\"SHELL=$(W_SHELL)\" \
-DMAJORDOMO_CF=\"MAJORDOMO_CF=$(W_MAJORDOMO_CF)\" \
$(POSIX)
# For those stupid machines that try to use csh. Doh!
SHELL = /bin/sh
TOOLS = archive2.pl archive.pl archive_mh.pl \
digest.send makeindex.pl \
logsummary.pl new-list sequencer digest
BINBIN = approve bounce medit
BIN = bounce-remind config_parse.pl majordomo majordomo.pl \
majordomo_version.pl request-answer resend \
shlock.pl config-test
INSTALL = ./install.sh
default:
@echo "make what?"
@echo " install: installs everything."
@echo " install-wrapper: only install wrapper."
@echo " install-scripts: only install the scripts."
@echo " wrapper: only make wrapper."
install: wrapper install-scripts install-cf install-man
@echo ""
@echo "To finish the installation, 'su' to root and type:"
@echo ""
@echo " make install-wrapper"
@echo ""
@echo "If not installing the wrapper, type"
@echo ""
@echo " cd $(W_HOME); ./wrapper config-test"
@echo ""
@echo "(no 'su' necessary) to verify the installation."
install-wrapper: wrapper
@$(INSTALL) -o $(WRAPPER_USER) -g $(W_GROUP) -m $(WRAPPER_CHMOD) wrapper $(W_BIN)/wrapper
@echo ""
@echo "To verify that all the permissions and etc are correct,"
@echo "run the command"
@echo ""
@echo " cd $(W_HOME); ./wrapper config-test"
# fix where perl lives.
# Create a tmp directory to stuff all the files in, so we
# don't go blithly changing the master copies of stuff.
#
config-scripts:
@echo "Testing for perl ($(PERL))..."
@test -x $(PERL) || \
{ echo "You didn't correctly tell me where Perl is."; exit 1; }
@test -d tmp || mkdir tmp
@echo "Configuring scripts..."
@-for file in $(TOOLS); do \
cp contrib/$$file tmp ; \
done
@cp $(BINBIN) $(BIN) tmp
@cd tmp; $(PERL) -p -i -e 's@^#!\S+perl.*@#!$(PERL)@' $(TOOLS) $(BINBIN) $(BIN)
install-scripts: config-scripts
@test -d $(W_HOME) || (mkdir $(W_HOME); chmod 751 $(W_HOME); \
chown $(W_USER) $(W_HOME); chgrp $(W_GROUP) $(W_HOME) )
@test -d $(W_BIN)/bin || (mkdir $(W_BIN)/bin; \
chown $(W_USER) $(W_BIN)/bin; chgrp $(W_GROUP) $(W_BIN)/bin )
@echo "Copying tools to $(W_BIN)/bin"
@for file in $(BINBIN); do \
$(INSTALL) -o $(W_USER) -g $(W_GROUP) -m 755 tmp/$$file $(W_BIN);\
done
@echo "Copying Majordomo files to $(W_BIN)"
@for file in $(BIN); do \
$(INSTALL) -o $(W_USER) -g $(W_GROUP) -m 755 tmp/$$file $(W_BIN);\
done
@echo "Copying archiving and other tools to $(W_BIN)/Tools"
@test -d $(W_BIN)/Tools || (mkdir $(W_BIN)/Tools; \
chown $(W_USER) $(W_BIN)/Tools; chgrp $(W_GROUP) $(W_BIN)/Tools)
@for file in $(TOOLS); do \
$(INSTALL) -o $(W_USER) -g $(W_GROUP) -m 755 tmp/$$file $(W_BIN)/Tools; \
done
@rm -rf tmp
# the install.cf target will install the sample config file in the
# proper place unless a majordomo.cf file exists in which case the
# majordomo.cf file will be used.
# but now it won't overwrite an existing majordomo.cf file.
install-cf:
@if [ ! -f $(W_BIN)/majordomo.cf ]; \
then \
if [ -f majordomo.cf ]; \
then \
echo "Using majordomo.cf"; \
$(INSTALL) -o $(W_USER) -g $(W_GROUP) -m 644 majordomo.cf $(W_BIN)/majordomo.cf; \
else \
echo "Using sample.cf"; \
echo " Don't forget to edit $(W_BIN)/majordomo.cf !"; \
$(INSTALL) -o $(W_USER) -g $(W_GROUP) -m 644 sample.cf $(W_BIN)/majordomo.cf; \
fi; \
else \
echo "Using installed majordomo.cf"; \
fi;
install-man:
@echo "Copying manual pages to $(MAN1) and $(MAN8)"
@test -w $(MAN1) || (mkdir -p $(MAN1); \
chown $(W_USER) $(MAN1); chgrp $(W_GROUP) $(MAN1) )
@test -w $(MAN8) || (mkdir -p $(MAN8); \
chown $(W_USER) $(MAN8); chgrp $(W_GROUP) $(MAN1) )
@$(INSTALL) -o $(W_USER) -g $(W_GROUP) -m 644 Doc/man/approve.1 $(MAN1)
@$(INSTALL) -o $(W_USER) -g $(W_GROUP) -m 644 Doc/man/digest.1 $(MAN1)
@$(INSTALL) -o $(W_USER) -g $(W_GROUP) -m 644 Doc/man/bounce-remind.1 $(MAN1)
@$(INSTALL) -o $(W_USER) -g $(W_GROUP) -m 644 Doc/man/majordomo.8 $(MAN1)
install-shared: install-wrapper-shared install-scripts
install-wrapper-shared: wrapper
@test -d $(W_BIN)/wrappers || mkdir $(W_BIN)/wrappers
@test -d $(W_BIN)/wrappers/$(W_GROUP) || mkdir $(W_BIN)/wrappers/$(W_GROUP)
strip wrapper
$(INSTALL) -o $(WRAPPER_USER) -g $(W_GROUP) -m $(WRAPPER_CHMOD) wrapper $(W_BIN)/wrapper.$(ARCHCMD)
cp wrapper $(W_BIN)/wrappers/$(W_GROUP)/wrapper.$(ARCHCMD)
$(INSTALL) -o $(W_USER) -g $(W_GROUP) -m 755 wrapper.sh $(W_BIN)/wrapper
wrapper: wrapper.c
$(CC) $(WRAPPER_FLAGS) -o wrapper wrapper.c
clean:
rm -f wrapper *~
dist-clean: clean
rm -f majordomo.cf .cvsignore todo.local .dcl archive
rm -rf regress Doc/samples Tools
distribution: dist-clean
mkdir majordomo-$(VERSION)
mv * .??* majordomo-$(VERSION) || exit 0
rm -rf majordomo-$(VERSION)/CVS majordomo-$(VERSION)/*/CVS \
majordomo-$(VERSION)/*/*/CVS
tar -cvf majordomo-$(VERSION).tar.Z\
majordomo-$(VERSION)
#! /bin/sh
## $Revision: 1.8 $
## A script to install files and directories.
PROGNAME=`basename $0`
## Paths to programs. CHOWN and WHOAMI are checked below.
CHOWN=chown
CHGRP=chgrp
CHMOD=chmod
CP=cp
LN=ln
MKDIR=mkdir
MV=mv
RM=rm
STRIP=strip
WHOAMI=whoami
## Some systems don't support -x, so we have to use -f.
if [ ${CHOWN} = chown ] ; then
if [ -f /etc/chown ] ; then
CHOWN=/etc/chown
else
if [ -f /usr/etc/chown ] ; then
CHOWN=/usr/etc/chown
fi
fi
fi
if [ ${WHOAMI} = whoami ] ; then
if [ -f /usr/ucb/whoami ] ; then
WHOAMI=/usr/ucb/whoami
fi
fi
## Defaults.
CHOWNIT=false
CHGROUPIT=false
CHMODIT=false
STRIPIT=false
BACKIT=false
TOUCHIT=true
ROOT=unknown
## Process JCL.
MORETODO=true
while ${MORETODO} ; do
case X"$1" in
X-b)
BACKIT=true
BACKUP="$2"
shift
;;
X-b*)
BACKIT=true
BACKUP=`expr "$1" : '-b\(.*\)'`
;;
X-g)
GROUP="$2"
CHGROUPIT=true
shift
;;
X-g*)
GROUP=`expr "$1" : '-g\(.*\)'`
CHGROUPIT=true
;;
X-G)
case ${ROOT} in
unknown)
case `${WHOAMI}` in
root)
ROOT=true
;;
*)
ROOT=false
;;
esac
;;
esac
GROUP="$2"
shift
${ROOT} && CHGROUPIT=true
;;
X-G*)
case ${ROOT} in
unknown)
case `${WHOAMI}` in
root)
ROOT=true
;;
*)
ROOT=false
;;
esac
;;
esac
if ${ROOT} ; then
GROUP=`expr "$1" : '-g\(.*\)'`
CHGROUPIT=true
fi
;;
X-m)
MODE="$2"
CHMODIT=true
shift
;;
X-m*)
MODE=`expr "$1" : '-m\(.*\)'`
CHMODIT=true
;;
X-n)
TOUCHIT=false
;;
X-o)
OWNER="$2"
CHOWNIT=true
shift
;;
X-o*)
OWNER=`expr "$1" : '-o\(.*\)'`
CHOWNIT=true
;;
X-O)
case ${ROOT} in
unknown)
case `${WHOAMI}` in
root)
ROOT=true
;;
*)
ROOT=false
;;
esac
;;
esac
OWNER="$2"
shift
${ROOT} && CHOWNIT=true
;;
X-O*)
case ${ROOT} in
unknown)
case `${WHOAMI}` in
root)
ROOT=true
;;
*)
ROOT=false
;;
esac
;;
esac
if ${ROOT} ; then
OWNER=`expr "$1" : '-o\(.*\)'`
CHOWNIT=true
fi
;;
X-s)
STRIPIT=true
;;
X--)
shift
MORETODO=false
;;
X-*)
echo "${PROGNAME}: Unknown flag $1" 1>&2
exit 1
;;
*)
MORETODO=false
;;
esac
${MORETODO} && shift
done
## Process arguments.
if [ $# -ne 2 ] ; then
echo "Usage: ${PROGNAME} [flags] source destination"
exit 1
fi
## Making a directory?
if [ X"$1" = X. ] ; then
DEST="$2"
if [ ! -d "${DEST}" ] ; then
${MKDIR} "${DEST}" || exit 1
fi
if ${CHOWNIT} ; then
${CHOWN} "${OWNER}" "${DEST}" || exit 1
fi
if ${CHGROUPIT} ; then
${CHGRP} "${GROUP}" "${DEST}" || exit 1
fi
if ${CHMODIT} ; then
umask 0
${CHMOD} "${MODE}" "${DEST}" || exit 1
fi
exit 0
fi
## Get the destination and a temp file in the destination diretory.
if [ -d "$2" ] ; then
DEST="$2/`basename $1`"
TEMP="$2/$$.tmp"
else
DEST="$2"
TEMP="`expr "$2" : '\(.*\)/.*'`/$$.tmp"
fi
## If not given the same name, we must try to copy.
if [ X"$1" != X"$2" ] ; then
if cmp -s "$1" "${DEST}" ; then
## Files are same; touch or not.
${TOUCHIT} && touch "${DEST}"
else
## If destination exists and we wish to backup, link to backup.
if [ -f "${DEST}" ] ; then
if ${BACKIT} ; then
${RM} -f "${DEST}${BACKUP}"
${LN} "${DEST}" "${DEST}${BACKUP}"
fi
fi
## Copy source to the right dir, then move to right spot.
## Done in two parts so we can hope for atomicity.
${RM} -f "${TEMP}" || exit 1
${CP} "$1" "${TEMP}" || exit 1
${MV} -f "${TEMP}" "${DEST}" || exit 1
fi
fi
## Strip and set the modes.
if ${STRIPIT} ; then
${STRIP} "${DEST}" || exit 1
fi
if ${CHOWNIT} ; then
${CHOWN} "${OWNER}" "${DEST}" || exit 1
fi
if ${CHGROUPIT} ; then
${CHGRP} "${GROUP}" "${DEST}" || exit 1
fi
if ${CHMODIT} ; then
umask 0
${CHMOD} "${MODE}" "${DEST}" || exit 1
fi
exit 0
References:
|
|