-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall
executable file
·135 lines (115 loc) · 4.21 KB
/
install
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/sh
#********************************************************************************
# eQmail-1.10 install script
#
# Having a comfortable shell like bash available always would make
# things much easier and the code more compact!
#********************************************************************************
#. `dirname $0`/conf-build # 'conf-build' have to be in the same folder
#. cfg/getids.inc
. `dirname $0`/conf.tmp # 'conf.tmp'
PKGDIR="$HOMEDIR"
BINDIR="$PKGDIR/bin"
CFGDIR="$PKGDIR/etc"
MANDIR="$PKGDIR/man"
DOCDIR="$PKGDIR/doc"
VARDIR="$PKGDIR/var"
# man pages
for i in 1 5 7 8 ; do
[ -d $MANDIR/man$i ] || mkdir -p $MANDIR/man$i
cp man/$i/* $MANDIR/man$i
done
chmod -R 0644 $MANDIR
chmod 0755 $MANDIR $MANDIR/*
# doc
mkdir -p "$DOCDIR"
cp doc/FAQ "$DOCDIR"
cp doc/INSTAL* "$DOCDIR"
cp doc/PIC.* "$DOCDIR"
#cp README* $DOCDIR/doc
cp doc/REMOVE.* "$DOCDIR"
cp doc/SENDMAIL "$DOCDIR"
cp doc/TEST.* "$DOCDIR"
cp doc/UPGRADE "$DOCDIR"
chmod 0644 "$DOCDIR"/*
# top level
mkdir -p $BINDIR/plugins $VARDIR/alias $VARDIR/queue
mkdir -p "$CFGDIR/bootctrl" $PKGDIR/tmp
chown -R $UIDO:$GIDQ "$BINDIR" "$CFGDIR"
# dir users could be special: if it exists don't touch it!
[ -d $VARDIR/users ] || (mkdir $VARDIR/users ; chown $UIDO:$GIDQ $VARDIR/users)
# queue - DO NOT REMOVE THIS LINE
T=$VARDIR/queue # just to shortening next commands (T: tmp)
mkdir -p $T/bounce $T/lock $T/pid
i=0
until [ $i -eq "$SPLIT" ]
do
# Create splitted queue subdirectories
mkdir -p $T/info/$i $T/intd/$i $T/local/$i $T/mess/$i $T/remote/$i $T/todo/$i
i=$(($i+1))
done
# set all:
chown -R $UIDQ:$GIDQ $VARDIR/queue
chmod -R 0750 $VARDIR/queue
# set new: bounce, info, local, remote
chown -R $UIDS:$GIDQ $T/bounce $T/info $T/local $T/remote
chmod -R 0700 $T/info $T/intd $T/local $T/pid $T/remote
# upgrade/qmail-fixq: set correct mode of files (messages)
find $VARDIR/queue/ -type f -exec chmod 644 {} + -exec chown $UIDQ:0 {} +
# special files in 'lock'
dd if=/dev/zero of=$VARDIR/queue/lock/tcpto bs=2048 count=1 2>/dev/null
chown $UIDR:$GIDQ $VARDIR/queue/lock/tcpto
chmod 0644 $VARDIR/queue/lock/tcpto
touch $VARDIR/queue/lock/sendmutex
chown $UIDS:$GIDQ $VARDIR/queue/lock/sendmutex
chmod 0600 $VARDIR/queue/lock/sendmutex
mkfifo $VARDIR/queue/lock/trigger 2>/dev/null
chown $UIDS:$GIDQ $VARDIR/queue/lock/trigger
chmod 0622 $VARDIR/queue/lock/trigger
#
#[ -L "$PKGDIR/queue" ] || ln -sf $VARDIR/queue $PKGDIR/queue # as long not changed in code
# bin
cp bouncesaying condredirect datemail except forward maildir2mbox \
maildirmake mailsubj mksrvrcerts mkrsadhkeys predate preline "$BINDIR"
cp qmail-bfque qmail-bfrmt qmail-clean qmail-fixq qmail-getpw qmail-inject \
qmail-local qmail-lspawn qmail-newmrh qmail-newu qmail-print qmail-pw2u \
qmail-qmqpc qmail-qmqpd qmail-qmtpd qmail-qread qmail-qstat \
qmail-queue qmail-remote qmail-rspawn qmail-send qmail-shcfg \
qmail-smtpd qmail-start qmail-tcpok qmail-tcpto "$BINDIR"
cp qreceipt sendmail splogger tcp-env "$BINDIR"
cp qmail-tcpsrv tcprules "$BINDIR"
chown -R $UIDO:$GIDQ $BINDIR/*
chmod -R 0755 $BINDIR/*
cd "$BINDIR"
chmod 0711 qmail-getpw qmail-local qmail-remote qmail-rspawn \
qmail-clean qmail-send qmail-pw2u splogger
chmod 0700 qmail-lspawn qmail-start qmail-newu qmail-newmrh
cd $OLDPWD
chown $UIDQ:$GIDQ $BINDIR/qmail-queue
chmod 4711 $BINDIR/qmail-queue
# alias dir
cd $VARDIR/alias
touch .qmail-root
echo root > .qmail-postmaster
[ -L .qmail-mailer-daemon ] || ln -s .qmail-postmaster .qmail-mailer-daemon
chmod 644 .qmail-*
$BINDIR/maildirmake .Maildir 2>/dev/null
cd $OLDPWD
chown -R $UIDA:$GIDQ $VARDIR/alias
chmod 2755 $VARDIR/alias
# at least set rights and group of the home dir
chmod 755 $PKGDIR ; chgrp $GIDQ $PKGDIR
#cd $PKGDIR
#[ -L control ] || ln -s etc control # change mkconfig before removing this!
#cd $OLDPWD
# basic configuration
. ./mkconfig
# some links could be helpful
[ -d /usr/local/bin ] || mkdir -p /usr/local/bin
cd /usr/local/bin
for L in maildirmake qmail-fixq sendmail qmail-qstat qmail-shcfg
do
readlink $L 2>&1 >/dev/null || ln -s $BINDIR/$L $L
done
# ....
cd $OLDPWD