1 |
hanno 11/01/23 22:32:46 |
2 |
|
3 |
Added: courier-init-r3 |
4 |
Log: |
5 |
courier: Fix init-script to work with openrc/baselayout2. |
6 |
|
7 |
(Portage version: 2.1.9.35/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 mail-mta/courier/files/courier-init-r3 |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/mail-mta/courier/files/courier-init-r3?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/mail-mta/courier/files/courier-init-r3?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: courier-init-r3 |
16 |
=================================================================== |
17 |
#!/sbin/runscript |
18 |
# Portions Copyright 2003 Gentoo Linux |
19 |
# $Header: /var/cvsroot/gentoo-x86/mail-mta/courier/files/courier-init-r3,v 1.1 2011/01/23 22:32:46 hanno Exp $ |
20 |
# |
21 |
# script originally from Courier distfile original name = courier.sysvinit |
22 |
# adapted for Gentoo by Brian Jackson |
23 |
# |
24 |
# TODO |
25 |
# should we update all the .dat/.pem files when the source/config files are |
26 |
# newer than the .dat/.pem files? |
27 |
|
28 |
prefix="/usr" |
29 |
exec_prefix="/usr/bin" |
30 |
sysconfdir="/etc/courier" |
31 |
sbindir="/usr/sbin" |
32 |
libexecdir="/usr/lib/courier" |
33 |
datadir="/usr/share/courier" |
34 |
|
35 |
depend() { |
36 |
need net |
37 |
[ -d /etc/courier/authlib ] && need courier-authlib |
38 |
grep -q "^IMAPDSTART=.*[Yy].*" /etc/courier/imapd && use famd |
39 |
grep -q "^IMAPDSSLSTART=.*[Yy].*" /etc/courier/imapd-ssl && use famd |
40 |
} |
41 |
|
42 |
checkconfig() { |
43 |
|
44 |
[ -f ${sysconfdir}/pop3d-ssl ] && . ${sysconfdir}/pop3d-ssl |
45 |
|
46 |
# If we do not have a certificate, make one up. |
47 |
[ ! -f "${datadir}/pop3d.pem" ] && \ |
48 |
ebegin " generating-POP3-SSL-certificate..." && "${sbindir}/mkpop3dcert" |
49 |
|
50 |
[ -f ${sysconfdir}/imapd-ssl ] && . ${sysconfdir}/imapd-ssl |
51 |
|
52 |
# If we do not have a certificate, make one up. |
53 |
[ ! -f ${datadir}/imapd.pem ] && \ |
54 |
ebegin " generating-IMAP-SSL-certificate..." && "${sbindir}/mkimapdcert" |
55 |
|
56 |
[ -f ${sysconfdir}/esmtpd-ssl ] && . ${sysconfdir}/esmtpd-ssl |
57 |
|
58 |
# If we do not have a certificate, make one up. |
59 |
[ ! -f ${datadir}/esmtpd.pem ] && \ |
60 |
ebegin " generating-ESMTP-SSL-certificate..." && "${sbindir}/mkesmtpdcert" |
61 |
|
62 |
# First time after install create aliases.dat and smtpaccess.dat |
63 |
|
64 |
[ -f ${sysconfdir}/aliases.dat ] || ${sbindir}/makealiases |
65 |
|
66 |
[ -f ${sysconfdir}/${ACCESSFILE}.dat ] || ${sbindir}/makesmtpaccess |
67 |
|
68 |
[ -f ${sysconfdir}/${ACCESSFILE}.dat ] || ${sbindir}/makesmtpaccess-msa |
69 |
} |
70 |
|
71 |
start() { |
72 |
# Start daemons. |
73 |
ebegin "Starting Courier mail server:" |
74 |
|
75 |
checkconfig || return 1 |
76 |
|
77 |
ebegin " Starting courierfilterd" |
78 |
${sbindir}/courierfilter start |
79 |
|
80 |
[ ! -d /etc/courier/authlib ] && [ -x ${libexecdir}/authlib/authdaemond ] && \ |
81 |
${libexecdir}/authlib/authdaemond start && ebegin " Starting authdaemond" |
82 |
|
83 |
[ -x ${sbindir}/webmaild ] && \ |
84 |
${sbindir}/webmaild start && ebegin " Starting webmaild" |
85 |
|
86 |
[ -x ${sbindir}/courierldapaliasd ] && \ |
87 |
${sbindir}/courierldapaliasd start && ebegin " Starting courierldapaliasd" |
88 |
|
89 |
ebegin " Starting courierd" |
90 |
${sbindir}/courier start |
91 |
|
92 |
savepath="$PATH" |
93 |
# start esmtpd if so written |
94 |
[ -f ${sysconfdir}/esmtpd ] && source ${sysconfdir}/esmtpd |
95 |
PATH="$savepath" |
96 |
case x$ESMTPDSTART in |
97 |
x[yY]*) |
98 |
ebegin " Starting esmtpd" |
99 |
${sbindir}/esmtpd start |
100 |
;; |
101 |
esac |
102 |
|
103 |
# start esmtpd-msa if so written |
104 |
[ -f ${sysconfdir}/esmtpd-msa ] && source ${sysconfdir}/esmtpd-msa |
105 |
PATH="$savepath" |
106 |
case x$ESMTPDSTART in |
107 |
x[yY]*) |
108 |
ebegin " Starting esmtpd-msa" |
109 |
${sbindir}/esmtpd-msa start |
110 |
;; |
111 |
esac |
112 |
|
113 |
# start esmtpd-ssl if so written |
114 |
[ -f ${sysconfdir}/esmtpd-ssl ] && source ${sysconfdir}/esmtpd-ssl |
115 |
PATH="$savepath" |
116 |
case x$ESMTPDSSLSTART in |
117 |
x[yY]*) |
118 |
ebegin " Starting esmtpd-ssl" |
119 |
${sbindir}/esmtpd-ssl start |
120 |
;; |
121 |
esac |
122 |
|
123 |
# start pop3d if so written |
124 |
[ -f ${sysconfdir}/pop3d ] && source ${sysconfdir}/pop3d |
125 |
PATH="$savepath" |
126 |
case x$POP3DSTART in |
127 |
x[yY]*) |
128 |
ebegin " courier-pop3d" |
129 |
${sbindir}/courier-pop3d start |
130 |
;; |
131 |
esac |
132 |
|
133 |
# start pop3d-ssl if so written |
134 |
[ -f ${sysconfdir}/pop3d-ssl ] && source ${sysconfdir}/pop3d-ssl |
135 |
PATH="$savepath" |
136 |
case x$POP3DSSLSTART in |
137 |
x[yY]*) |
138 |
ebegin " courier-pop3d-ssl" |
139 |
${sbindir}/courier-pop3d-ssl start |
140 |
;; |
141 |
esac |
142 |
|
143 |
[ -f ${sysconfdir}/imapd ] && source ${sysconfdir}/imapd |
144 |
PATH="$savepath" |
145 |
case x$IMAPDSTART in |
146 |
x[yY]*) |
147 |
ebegin " courier-imapd" |
148 |
${sbindir}/courier-imapd start |
149 |
;; |
150 |
esac |
151 |
|
152 |
[ -f ${sysconfdir}/imapd-ssl ] && source ${sysconfdir}/imapd-ssl |
153 |
PATH="$savepath" |
154 |
case x$IMAPDSSLSTART in |
155 |
x[yY]*) |
156 |
ebegin " courier-imapd-ssl" |
157 |
${sbindir}/courier-imapd-ssl start |
158 |
;; |
159 |
esac |
160 |
|
161 |
eend $? |
162 |
} |
163 |
|
164 |
stop() { |
165 |
ebegin "Stopping Courier mail server:" |
166 |
|
167 |
ebegin " Stopping courier-esmtpd" |
168 |
${sbindir}/esmtpd stop |
169 |
|
170 |
ebegin " Stopping courier-esmtpd-msa" |
171 |
${sbindir}/esmtpd-msa stop |
172 |
|
173 |
ebegin " Stopping courier-esmtpd-ssl" |
174 |
${sbindir}/esmtpd-ssl stop |
175 |
|
176 |
[ -x ${sbindir}/courier-pop3d ] && \ |
177 |
ebegin " Stopping courier-pop3d" && ${sbindir}/courier-pop3d stop |
178 |
|
179 |
[ -x ${sbindir}/courier-pop3d-ssl ] && \ |
180 |
ebegin " Stopping courier-pop3d-ssl" && ${sbindir}/courier-pop3d-ssl stop |
181 |
|
182 |
[ -x ${sbindir}/courier-imapd ] && \ |
183 |
ebegin " Stopping courier-imapd" && ${sbindir}/courier-imapd stop |
184 |
|
185 |
|
186 |
[ -x ${sbindir}/courier-imapd-ssl ] && \ |
187 |
ebegin " Stopping courier-imapd-ssl" && ${sbindir}/courier-imapd-ssl stop |
188 |
|
189 |
ebegin " Stopping courierd" |
190 |
${sbindir}/courier stop |
191 |
|
192 |
[ -x ${sbindir}/courierldapaliasd ] && \ |
193 |
( ${sbindir}/courierldapaliasd stop ; ebegin " Stopping courierldapaliasd" ) |
194 |
|
195 |
[ -x ${sbindir}/webmaild ] && \ |
196 |
( ${sbindir}/webmaild stop ; ebegin " Stopping webmaild" ) |
197 |
|
198 |
[ ! -d /etc/courier/authlib ] && [ -x ${libexecdir}/authlib/authdaemond ] && \ |
199 |
( ${libexecdir}/authlib/authdaemond stop ; ebegin " Stopping authdaemond" ) |
200 |
|
201 |
${sbindir}/courierfilter stop |
202 |
ebegin " Stopping courierfilterd" |
203 |
|
204 |
eend $? |
205 |
} |