Now non-interactive.

Better instructions for install/deinstall.
Cleanup.
ok espie@.
This commit is contained in:
jakob 1999-10-07 20:58:03 +00:00
parent 39c9ac3b4b
commit 96685d819f
5 changed files with 95 additions and 71 deletions

View File

@ -0,0 +1,14 @@
#!/bin/sh
if [ ! -f /etc/mailer.conf.pre-postfix ]; then
echo "can't find /etc/mailer.conf.pre-postfix, postfix not disabled"
exit 1
fi
if [ -f /etc/mailer.conf ]; then
mv -f /etc/mailer.conf /etc/mailer.conf.postfix
mv -f /etc/mailer.conf.pre-postfix /etc/mailer.conf
echo "postfix mailer.conf disabled, old mailer.conf enabled"
else
echo "can't find /etc/mailer.conf, postfix not disabled"
fi

View File

@ -0,0 +1,12 @@
#!/bin/sh
if [ -f /etc/mailer.conf.postfix ]; then
if [ -f /etc/mailer.conf ]; then
mv -f /etc/mailer.conf /etc/mailer.conf.pre-postfix
echo "old /etc/mailer.conf saved as /etc/mailer.conf.pre-postfix"
fi
mv -f /etc/mailer.conf.postfix /etc/mailer.conf
echo "postfix /etc/mailer.conf enabled"
else
echo "can't find /etc/mailer.conf.postfix, postfix not enabled"
fi

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $OpenBSD: DEINSTALL,v 1.4 1999/09/26 20:35:13 jakob Exp $
# $OpenBSD: DEINSTALL,v 1.5 1999/10/07 20:58:04 jakob Exp $
#
# De-installation setup of postfix
@ -16,60 +16,53 @@ MAILDROPGID=12
#
do_accts()
{
echo
echo ""
echo "+---------------"
echo "| Delete the 'postfix' user account, and 'postfix' and 'maildrop'"
echo "| group accounts manually for a full de-installation."
echo "| To do this: execute 'rmuser postfix' and 'rmgroup maildrop' as root."
echo "+---------------"
echo
echo ""
}
# Function: set up the postfix spool dir / chroot area
#
do_spooldir()
{
echo
echo ""
echo "+---------------"
echo "| Delete the /var/spool/postfix spool directory manually"
echo "| for a full de-installation."
echo "| To do this: execute 'rm -rf /var/spool/postfix' as root."
echo "+---------------"
echo
}
# Function: replace sendmail binaries with postfix
#
do_sendmail()
{
if [ ! -f /etc/mailer.conf.pre-postfix ]; then return ; fi
printf "Do you want to restore sendmail? [Y/n] "
read ans
case $ans in n*|N*) return ;; esac
echo
echo "-> Restoring sendmail"
mv /etc/mailer.conf /etc/mailer.conf.postfix
mv /etc/mailer.conf.pre-postfix /etc/mailer.conf
echo ""
}
# Function: install the postfix configuration files from the samples
#
do_configs()
{
echo
echo ""
echo "+---------------"
echo "| The existing $1 configuration files in ${CONFIG_DIR},"
echo "| have NOT been deleted. To do this: execute"
echo "| 'rm -rf /etc/postfix' as root."
echo "+---------------"
echo
echo ""
}
# Function: disable the installed postfix mailer.conf
#
do_disable()
{
echo -n "-> "
$PREFIX/sbin/postfix-disable
}
# verify proper execution
#
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
echo "usage: $0 distname { DEINSTALL }" >&2
exit 1
fi
@ -79,8 +72,8 @@ case $2 in
DEINSTALL)
do_accts
do_spooldir
do_configs $1
do_sendmail
do_configs $1
do_disable
;;
*)
echo "Usage: `basename $0` distname DEINSTALL" >&2

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $OpenBSD: INSTALL,v 1.5 1999/09/26 20:35:14 jakob Exp $
# $OpenBSD: INSTALL,v 1.6 1999/10/07 20:58:04 jakob Exp $
#
# Pre/post-installation setup of postfix
@ -23,18 +23,15 @@ do_accts()
else
echo "-> Creating postfix group, gid $POSTFIXGID"
echo "postfix:*:${POSTFIXGID}:" >> /etc/group
echo ""
fi
line=`egrep '^postfix:' /etc/passwd`
if [ "$line" != "" ]; then
POSTFIXUID=`echo $line | cut -f3 -d:`
else
echo "-> Creating postfix user, uid $POSTFIXUID"
chpass -a "postfix:*:${POSTFIXUID}:${POSTFIXGID}::::Disgruntled Postal Worker:/nonexistent:/sbin/nologin"
echo ""
chpass -l -a "postfix:*:${POSTFIXUID}:${POSTFIXGID}::::Disgruntled Postal Worker:/nonexistent:/sbin/nologin"
fi
echo "-> Using account 'postfix' for postfix, uid $POSTFIXUID, gid $POSTFIXGID"
echo ""
# Create Postfix maildrop group.
line=`egrep '^maildrop:' /etc/group`
if [ "$line" != "" ]; then
@ -42,7 +39,6 @@ do_accts()
else
echo "-> Creating maildrop group, gid $MAILDROPGID"
echo "maildrop:*:${MAILDROPGID}:" >> /etc/group
echo ""
fi
echo "-> Using group 'maildrop' for postdrop, gid $MAILDROPGID"
}
@ -51,48 +47,29 @@ do_accts()
#
do_spooldir()
{
echo "-> Creating Postfix spool directory and chroot area under $SPOOL_DIR"
[ -d $SPOOL_DIR ] || mkdir -p -m 755 $SPOOL_DIR
[ -d ${SPOOL_DIR}/etc ] || mkdir -p -m 755 ${SPOOL_DIR}/etc
for file in localtime services resolv.conf ; do
install -c -m 755 /etc/$file ${SPOOL_DIR}/etc
done
echo
echo "+---------------"
echo "| Postfix spool directory and chroot area created"
echo "| under $SPOOL_DIR"
echo "+---------------"
}
# Function: replace sendmail binaries with postfix
#
do_sendmail()
do_mailwrapper()
{
echo
echo "+---------------"
echo "| Postfix can be set up to replace sendmail entirely."
echo "| Please read the documentation at http://www.postfix.org/"
echo "| carefully before you decide to do this!"
echo "+---------------"
echo
printf "Do you want to replace sendmail with postfix? [Y/n] "
read ans
case $ans in n*|N*) return ;; esac
echo
echo "-> Disabling sendmail"
mv /etc/mailer.conf /etc/mailer.conf.pre-postfix
echo
echo "-> Enabling postfix replacements"
echo "-> Creating /etc/mailer.conf.postfix"
cat <<MAILER >/tmp/mailer.conf.$$
sendmail y0y0y0/sbin/sendmail
send-mail y0y0y0/sbin/sendmail
mailq y0y0y0/sbin/sendmail
newaliases y0y0y0/sbin/sendmail
MAILER
sed "s@y0y0y0@${PREFIX}@g" /tmp/mailer.conf.$$ >/etc/mailer.conf
sed "s@y0y0y0@${PREFIX}@g" /tmp/mailer.conf.$$ >/etc/mailer.conf.postfix
rm -f /tmp/mailer.conf.$$
chown root:wheel /etc/mailer.conf
chmod 644 /etc/mailer.conf
echo
chown root:wheel /etc/mailer.conf.postfix
chmod 644 /etc/mailer.conf.postfix
}
# Function: install the postfix configuration files from the samples
@ -100,13 +77,17 @@ MAILER
do_configs()
{
if [ -d $CONFIG_DIR ]; then
echo
echo ""
echo "+---------------"
echo "| The existing $1 configuration files in ${CONFIG_DIR},"
echo "| have NOT been changed. You may want to compare them to the"
echo "| current sample files, ${PREFIX}/lib/postfix,"
echo "| and update your configuration as needed."
echo "+---------------"
echo "|"
echo "| Existing ${CONFIG_DIR}/postfix-script, however, will be"
echo "| updated to the latest version."
echo "+---------------"
echo ""
else
# Install config files.
mkdir -p -m 755 $CONFIG_DIR
@ -115,18 +96,44 @@ do_configs()
install -m 644 ${CONFIG_DIR}/main.cf.$$ ${CONFIG_DIR}/main.cf
rm -f ${CONFIG_DIR}/main.cf.$$
# Configure setgid maildrop.
chgrp maildrop ${PREFIX}/sbin/postdrop
chmod 2755 ${PREFIX}/sbin/postdrop
install -m 755 -c ${CONFIG_DIR}/postfix-script-sgid ${CONFIG_DIR}/postfix-script
# The correct postfix-script will be installed later.
rm -f ${CONFIG_DIR}/postfix-script*
echo
echo ""
echo "+---------------"
echo "| The $1 configuration files in ${CONFIG_DIR},"
echo "| have been installed. Please view these files and change"
echo "| the configuration to meet your needs"
echo "| the configuration to meet your needs."
echo "+---------------"
echo ""
fi
# Configure setgid maildrop
install -m 755 -c ${PREFIX}/lib/postfix/postfix-script-sgid ${CONFIG_DIR}/postfix-script
chgrp maildrop ${PREFIX}/sbin/postdrop
chmod 2755 ${PREFIX}/sbin/postdrop
}
# Function: tell the user what s/he needs to do to use the port just installed
#
do_notice()
{
echo ""
echo "+---------------"
echo "| Postfix can be set up to replace sendmail entirely. Please read the"
echo "| documentation at file:$PREFIX/share/doc/postfix/index.html or"
echo "| http://www.postfix.org/ carefully before you decide to do this!"
echo "|"
echo "| To replace sendmail with postfix you have to install a new mailer.conf"
echo "| using the following command:"
echo "|"
echo "| $PREFIX/sbin/postfix-enable"
echo "|"
echo "| If you want to restore sendmail, this is done using the following command:"
echo "|"
echo "| $PREFIX/sbin/postfix-disable"
echo "+---------------"
echo ""
}
# verify proper execution
@ -145,7 +152,8 @@ case $2 in
POST-INSTALL)
do_spooldir
do_configs $1
do_sendmail
do_mailwrapper
do_notice
;;
*)
echo "Usage: `basename $0` distname <PRE-INSTALL|POST-INSTALL>" >&2

View File

@ -3,6 +3,8 @@ sbin/postcat
sbin/postconf
sbin/postdrop
sbin/postfix
sbin/postfix-enable
sbin/postfix-disable
sbin/postkick
sbin/postlock
sbin/postlog
@ -89,13 +91,11 @@ man/man8/showq.8
man/man8/smtp.8
man/man8/smtpd.8
man/man8/trivial-rewrite.8
share/doc/postfix/Makefile.in
share/doc/postfix/access.5.html
share/doc/postfix/aliases.5.html
share/doc/postfix/architecture.html
share/doc/postfix/backstage.html
share/doc/postfix/basic.html
share/doc/postfix/big-picture.fig
share/doc/postfix/big-picture.gif
share/doc/postfix/big-picture.html
share/doc/postfix/bounce.8.html
@ -106,9 +106,7 @@ share/doc/postfix/defer.8.html
share/doc/postfix/delivering.html
share/doc/postfix/error.8.html
share/doc/postfix/faq.html
share/doc/postfix/flow.fig
share/doc/postfix/goals.html
share/doc/postfix/inbound.fig
share/doc/postfix/inbound.gif
share/doc/postfix/index.html
share/doc/postfix/local.8.html
@ -116,7 +114,6 @@ share/doc/postfix/mailq.1.html
share/doc/postfix/master.8.html
share/doc/postfix/motivation.html
share/doc/postfix/newaliases.1.html
share/doc/postfix/outbound.fig
share/doc/postfix/outbound.gif
share/doc/postfix/pickup.8.html
share/doc/postfix/pipe.8.html
@ -140,7 +137,6 @@ share/doc/postfix/rewrite.html
share/doc/postfix/security.html
share/doc/postfix/sendmail.1.html
share/doc/postfix/showq.8.html
share/doc/postfix/small-picture.fig
share/doc/postfix/small-picture.gif
share/doc/postfix/smtp.8.html
share/doc/postfix/smtpd.8.html
@ -149,3 +145,4 @@ share/doc/postfix/trivial-rewrite.8.html
share/doc/postfix/uce.html
share/doc/postfix/virtual.5.html
@dirrm share/doc/postfix
@unexec [ -f /etc/mailer.conf.postfix ] && rm -f /etc/mailer.conf.postfix