1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-25 09:34:11 +00:00
freebsd-ports/mail/majordomo/scripts/adaptwrapper
Anders Nordby 8a3af76424 Make port build, install and run as package.
Give warning upon installing, majordomo is legacy.

PR:		104686
Submitted by:	erwin, anders
2007-03-01 20:56:42 +00:00

77 lines
1.6 KiB
Bash

#! /bin/sh
# anders@FreeBSD.org, 2002-02-08
if [ -z "$1" ]
then
prefix=/usr/local/majordomo
else
if [ -d "$1/majordomo" ]
then
prefix=$1/majordomo
else
echo "Could not find the majordomo dir."
echo
echo "Usage: $0 <install prefix>"
exit 1
fi
fi
tempfile=`/usr/bin/mktemp -t radiolist`
/usr/bin/dialog --title "Making the majordomo wrapper run" --clear --radiolist "We need to make the majordomo wrapper program executable by your Mail\nDelivery Agent, but do not want it executable for all users due\nto security reasons.\n\n(This script can be re-executed from\n/usr/ports/mail/majordomo/scripts/adaptwrapper.)\n\nAdapt to the MDA of:" -1 -1 5 \
Sendmail "(add users daemon/mailnull to the majordom group)" ON \
Postfix "(change group ownership of wrapper to nobody)" OFF \
2>$tempfile
if [ "$?" = "1" ]
then
echo "Cancel pressed. You will need to make wrapper executable yourself."
fi
choice=`cat $tempfile`
rm -f $tempfile
if [ -z "$choice" ]
then
echo "Empty selection."
exit 1
fi
addmember() {
# $1: group $2: user
if !(pw groupmod $1 -m $2 >/dev/null 2>&1)
then
echo "Error: Could not add user $2 to group $1."
exit 1
fi
}
changegroup() {
# $1: group
mywrapper=$prefix/wrapper
if !(chgrp $1 $mywrapper >/dev/null 2>&1)
then
echo "Error: Could not change group ownership of"
echo "$mywrapper"
echo "to group $1."
exit 1
fi
}
case $choice in
'Sendmail')
addmember majordom daemon
if (pw usershow mailnull >/dev/null 2>&1)
then
addmember majordom mailnull
fi
;;
'Postfix')
changegroup nobody
;;
'None')
echo "Fine. I see you want to make wrapper executable yourself."
;;
*)
echo "Unknown MTA specified."
;;
esac