/[imapfilter]/imapfilter/config
ViewVC logotype

Contents of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (show annotations)
Sun Jul 27 15:53:10 2003 UTC (20 years, 8 months ago) by lefcha
Branch: MAIN
Changes since 1.20: +4 -4 lines
Added temporary buffer auxiliary routines.

1 #!/bin/sh
2
3 # Default values
4
5 destdir="/usr/local"
6 bindir="$destdir/bin"
7 mandir="$destdir/man"
8
9 debug="yes"
10 checkperms="yes"
11 encpasswds="yes"
12 ssltls="yes"
13 cram="yes"
14
15 libs=""
16 libssl="-lssl"
17 libcrypto="-lcrypto"
18
19 cflags=""
20 ldflags=""
21
22 interactive="no"
23
24
25 # Get options and arguments
26
27 while getopts "hid:b:m:o:" opt
28 do
29 case $opt in
30 d)
31 destdir=$OPTARG
32 bindir=$destdir/bin
33 mandir=$destdir/man
34 ;;
35 b)
36 bindir=$OPTARG
37 ;;
38 m)
39 mandir=$OPTARG
40 ;;
41 o)
42 head=`echo $OPTARG | cut -d= -f1`
43 body=`echo $OPTARG | cut -d= -f2`
44 if [ $head = "debug" ]
45 then
46 if [ $body = "yes" ]; then debug="yes"
47 elif [ $body = "no" ]; then debug="no"
48 fi
49 elif [ $head = "checkperms" ]
50 then
51 if [ $body = "yes" ]; then checkperms="yes"
52 elif [ $body = "no" ]; then checkperms="no"
53 fi
54 elif [ $head = "encpasswds" ]
55 then
56 if [ $body = "yes" ]; then encpasswds="yes"
57 elif [ $body = "no" ]; then encpasswds="no"
58 fi
59 elif [ $head = "ssltls" ]
60 then
61 if [ $body = "yes" ]; then ssltls="yes"
62 elif [ $body = "no" ]; then ssltls="no"
63 fi
64 elif [ $head = "cram" ]
65 then
66 if [ $body = "yes" ]; then cram="yes"
67 elif [ $body = "no" ]; then cram="no"
68 fi
69 fi
70 ;;
71 i)
72 interactive="yes"
73 ;;
74 h | *)
75 cat << EOF
76 Usage:
77 config [-hi] [-d destdir] [-b bindir] [-m mandir] [-o option=argument]
78
79 Description:
80 -h This brief usage and description message.
81 -i Interactive mode.
82 -d destdir Installation path for program's files [$destdir]
83 -b bindir Installation path for binaries [$bindir]
84 -m mandir Installation path for manual pages [$mandir]
85 -o option=argument Enabling/disabling of program's options.
86
87 Options:
88 debug Debugging information, useful during development [$debug]
89 checkperms Configuration file's permissions checking [$checkperms]
90 encpasswds Encrypted passwords support [$encpasswds]
91 ssltls Secure Socket Layer and Transport Layer Security [$ssltls]
92 cram Challenge-Response Authentication Mechanism [$cram]
93 EOF
94 exit 1
95 ;;
96 esac
97 done
98
99
100 # Interactive or non-interactive mode
101
102 if [ $interactive = "yes" ]
103 then
104 printf "Destination directory [$destdir]: "
105 read tmp
106 if [ -n "$tmp" ]; then destdir="$tmp"; fi
107
108 printf "Binaries directory [$bindir]: "
109 read tmp
110 if [ -n "$tmp" ]; then bindir="$tmp"; fi
111
112 printf "Manual pages directory [$mandir]: "
113 read tmp
114 if [ -n "$tmp" ]; then mandir="$tmp"; fi
115
116 printf "Debugging information [$debug]: "
117 read tmp
118 if [ -n "$tmp" ]; then debug="$tmp"; fi
119
120 printf "Configuration file permissions checking [$checkperms]: "
121 read tmp
122 if [ -n "$tmp" ]; then checkperms="$tmp"; fi
123
124 printf "Encrypted passwords support [$encpasswds]: "
125 read tmp
126 if [ -n "$tmp" ]; then encpasswds="$tmp"; fi
127
128 printf "Secure Socket Layer and Transport Layer Security [$ssltls]: "
129 read tmp
130 if [ -n "$tmp" ]; then ssltls="$tmp"; fi
131
132 printf "Challenge-Response Authentication Mechanism [$cram]: "
133 read tmp
134 if [ -n "$tmp" ]; then cram="$tmp"; fi
135 else
136 cat << EOF
137 Destination directory: $destdir
138 Binaries directory: $bindir
139 Manual pages directory: $mandir
140 Debugging information: $debug
141 Configuration file permissions checking: $checkperms
142 Encrypted passwords support: $encpasswds
143 Secure Socket Layer and Transport Layer Security: $ssltls
144 Challenge-Response Authentication Mechanism: $cram
145 EOF
146 fi
147
148
149 # Libraries
150
151 if [ $ssltls = "yes" ]
152 then
153 libs="$libs $libssl $libcrypto"
154 elif [ $encpasswds = "yes" || $cram = "yes" ]
155 then
156 libs="$libs $libcrypto"
157 fi
158
159
160 # C flags
161
162 if [ $debug = "yes" ]
163 then
164 cflags="-g"
165 else
166 cflags="-O"
167 fi
168
169
170 # Backup of original Makefile and config.h
171
172 if [ ! -f .Makefile ]; then cp -f Makefile .Makefile; fi
173 if [ ! -f .config.h ]; then cp -f config.h .config.h; fi
174
175
176 # Write Makefile
177
178 mv -f Makefile Makefile~
179
180 cat > Makefile << EOF
181 CC = cc
182 CFLAGS = $cflags
183 LDFLAGS =
184
185 DESTDIR = $destdir
186 BINDIR = $bindir
187 MANDIR = $mandir
188
189 MAN_BIN = imapfilter.1
190 MAN_RC = imapfilterrc.5
191
192 BIN = imapfilter
193 OBJ = auth.o buffer.o data.o file.o imap.o imapfilter.o lock.o log.o \\
194 memory.o misc.o passwd.o response.o request.o socket.o tty.o
195
196 LIBS = $libs
197
198 imapfilter: \$(OBJ)
199 \$(CC) \$(LIBS) \$(LDFLAGS) -o \$(BIN) \$(OBJ)
200
201 auth.o buffer.o data.o file.o imap.o imapfilter.o lock.o log.o response.o \\
202 request.o memory.o passwd.o socket.o tty.o: imapfilter.h config.h
203 data.o imapfilter.o imap.o file.o passwd.o request.o socket.o: data.h
204
205 install: imapfilter
206 if test ! -d \$(BINDIR); then mkdir -p \$(BINDIR); fi
207 cp -f \$(BIN) \$(BINDIR) && chmod 0755 \$(BINDIR)/\$(BIN)
208 if test ! -d \$(MANDIR)/man1; then mkdir -p \$(MANDIR)/man1; fi
209 cp -f \$(MAN_BIN) \$(MANDIR)/man1 && chmod 0644 \$(MANDIR)/man1/\$(MAN_BIN)
210 if test ! -d \$(MANDIR)/man5; then mkdir -p \$(MANDIR)/man5; fi
211 cp -f \$(MAN_RC) \$(MANDIR)/man5 && chmod 0644 \$(MANDIR)/man5/\$(MAN_RC)
212
213 uninstall:
214 rm -f \$(BINDIR)/\$(BIN) \$(MANDIR)/man1/\$(MAN_BIN) \$(MANDIR)/man5/\$(MAN_RC)
215
216 clean:
217 rm -f \$(OBJ) \$(BIN) imapfilter.core core *.BAK *~
218
219 distclean: clean
220 @if test -f .Makefile; then mv -f .Makefile Makefile; fi
221 @if test -f .config.h; then mv -f .config.h config.h; fi
222 EOF
223
224
225 # Write config.h
226
227 mv -f config.h config.h~
228
229 echo "/* Debugging information. */" > config.h
230 if [ $debug = "yes" ]
231 then
232 echo "#define DEBUG" >> config.h
233 else
234 echo "#undef DEBUG" >> config.h
235 fi
236 echo >> config.h
237
238 echo "/* Configuration file's permissions checking. */" >> config.h
239 if [ $checkperms = "yes" ]
240 then
241 echo "#define CHECK_PERMISSIONS" >> config.h
242 else
243 echo "#undef CHECK_PERMISSIONS" >> config.h
244 fi
245 echo >> config.h
246
247 echo "/* Encrypted passwords support. */" >> config.h
248 if [ $encpasswds = "yes" ]
249 then
250 echo "#define ENCRYPTED_PASSWORDS" >> config.h
251 else
252 echo "#undef ENCRYPTED_PASSWORDS" >> config.h
253 fi
254 echo >> config.h
255
256 echo "/* Secure Socket Layer and Transport Layer Security support. */" >> config.h
257 if [ $ssltls = "yes" ]
258 then
259 echo "#define SSL_TLS" >> config.h
260 else
261 echo "#undef SSL_TLS" >> config.h
262 fi
263 echo >> config.h
264
265 echo "/* Challenge-Response Authentication Mechanism support. */" >> config.h
266 if [ $cram = "yes" ]
267 then
268 echo "#define CRAM_MD5" >> config.h
269 else
270 echo "#undef CRAM_MD5" >> config.h
271 fi
272
273
274 exit 0

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26