blob: e5b24280f8307ff463e31fd298381933745ae3ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/bin/sh -e
shout() { echo "$0: $@" >&2; }
barf() { shout "fatal: $@"; exit 111; }
safe() { "$@" || barf "cannot $@"; }
here=`env - PATH=$PATH pwd`
mypwd=${here%package}
mypwd=${mypwd%/}
home=`head -1 ${mypwd}/conf-home`
bindir=""
if [ -f ${mypwd}/conf-home ]
then
bindir="${home}/bin"
fi
sendmail=`which sendmail`
dir=`dirname ${sendmail}`
if [ ${dir} != ${bindir} ]
then
if [ -L ${sendmail} ]
then
cd ${dir}
safe rm ${sendmail}
safe ln -s ${bindir}/sendmail sendmail
shout "Replaced system's sendmail with ${bindir}/sendmail"
cd ${mypwd}
else
cd ${dir}
safe mv sendmail sendmail_
safe chmod 000 sendmail_
safe ln -s ${bindir}/sendmail sendmail
shout "Replaced system's sendmail with ${bindir}/sendmail"
cd ${mypwd}
fi
fi
aliasdir=""
if [ -f ${mypwd}/conf-home ]
then
aliasdir="${home}/alias"
fi
shout "Setting s/qmail alias-dir: ${aliasdir}"
[ -d "${aliasdir}" ] || safe mkdir -p ${aliasdir}
[ -f ${aliasdir}/.qmail-root ] || safe touch ${aliasdir}/.qmail-root
[ -f ${aliasdir}/.qmail-mailer-daemon ] || safe touch ${aliasdir}/.qmail-mailer-daemon
[ -f ${aliasdir}/.qmail-postmaster ] || safe touch ${aliasdir}/.qmail-postmaster
if [ -f ${mypwd}/conf-delivery ]
then
defaultdelivery="`head -1 ${mypwd}/conf-delivery`"
if [ "x$defaultdelivery" = "x" ]
then
barf "No 'defaultdelivery' defined. Check conf-delivery."
fi
if [ -f "${home}/svc/qmail-send/run" ]
then
safe cat ${home}/svc/qmail-send/run | \
eval sed -e 's%./Maildir/%$defaultdelivery%' > run.delivery && \
mv run.delivery ${home}/svc/qmail-send/run && \
chmod +x ${home}/svc/qmail-send/run && \
shout "Setting qmail-start default-delivery: $defaultdelivery"
fi
fi
exit 0
|