Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 107 lines (73 sloc) 2.04 KB
#!/bin/sh -e
# $Header: /repo/cvs.copy/maild/maild-installer,v 1.7 2005/06/14 22:32:31 dancy Exp $
# Checks for the existence of a file or symlink
function EXISTS {
[ -L "$1" -o -e "$1" ]
}
# Returns true if thing exists but is not a symlink
function NON_SYMLINK {
[ ! -L "$1" -a -e "$1" ]
}
function migrate {
if ! EXISTS "$1.sendmail" && NON_SYMLINK "$1"; then
mv "$1" "$1.sendmail"
fi
ln -nsf /usr/local/sbin/maild "$1"
}
if [ `id -u` -ne 0 ]; then
echo Maild installation requires root privileges
exit 1
fi
lib=/usr/local/lib
if [ -x /etc/init.d/maild ] && /etc/init.d/maild status; then
/etc/init.d/maild stop
restart_maild=t
fi
echo Preparing...
mkdir -p $lib /usr/local/sbin /var/spool/maild
if [ -e $lib/maild.old ]; then
echo Removing prior backup installation...
rm -r $lib/maild.old
fi
if [ -e $lib/maild ]; then
echo Making backup of current installation...
mv $lib/maild $lib/maild.old
fi
echo Extracting...
(cd $lib && tar zxf -) < maild.tar.gz
echo Installing...
chown -R root:root $lib/maild
chmod +s $lib/maild/maild
ln -snf $lib/maild/maild /usr/local/sbin/maild
ln -snf $lib/maild/maild /usr/local/sbin/maild-mailq
if [ -e /etc/init.d/maild ]; then
mv /etc/init.d/maild /etc/init.d/maild.old
fi
mv maild.init /etc/init.d/maild
if [ -e /etc/init.d/maild.old ]; then
if diff /etc/init.d/maild.old /etc/init.d/maild >/dev/null; then
rm /etc/init.d/maild.old
fi
fi
if [ ! -e /etc/sysconfig/maild ]; then
echo QUEUE=15m > /etc/sysconfig/maild
fi
if [ -x /usr/sbin/alternatives ]; then
/usr/sbin/alternatives --install \
/usr/sbin/sendmail mta /usr/local/sbin/maild 95 \
--slave /usr/bin/mailq mta-mailq /usr/local/sbin/maild-mailq \
--initscript maild
/usr/sbin/alternatives --auto mta
else
migrate /usr/sbin/sendmail
migrate /usr/bin/mailq
fi
if [ ! -L /usr/lib/sendmail ]; then
ln -snf ../sbin/sendmail /usr/lib/sendmail
fi
echo Cleaning up
rm maild.tar.gz $0
if [ -n "$restart_maild" ]; then
/etc/init.d/maild start
fi
echo Done.
Something went wrong with that request. Please try again.