/[imapfilter]/imapfilter/config
ViewVC logotype

Annotation of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.20 - (hide annotations)
Sun Jul 27 10:05:08 2003 UTC (20 years, 8 months ago) by lefcha
Branch: MAIN
Changes since 1.19: +11 -11 lines
Changed variable ssl to ssltls.

1 lefcha 1.1 #!/bin/sh
2    
3 lefcha 1.2 # Default values
4    
5 lefcha 1.1 destdir="/usr/local"
6     bindir="$destdir/bin"
7     mandir="$destdir/man"
8    
9     debug="yes"
10     checkperms="yes"
11 lefcha 1.4 encpasswds="yes"
12 lefcha 1.20 ssltls="yes"
13 lefcha 1.19 cram="yes"
14 lefcha 1.1
15     libs=""
16 lefcha 1.19 libssl="-lssl"
17     libcrypto="-lcrypto"
18 lefcha 1.1
19 lefcha 1.10 cflags=""
20 lefcha 1.17 ldflags=""
21 lefcha 1.10
22 lefcha 1.1 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 lefcha 1.5 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 lefcha 1.6 elif [ $head = "encpasswds" ]
55     then
56     if [ $body = "yes" ]; then encpasswds="yes"
57 lefcha 1.8 elif [ $body = "no" ]; then encpasswds="no"
58 lefcha 1.6 fi
59 lefcha 1.20 elif [ $head = "ssltls" ]
60 lefcha 1.5 then
61 lefcha 1.20 if [ $body = "yes" ]; then ssltls="yes"
62     elif [ $body = "no" ]; then ssltls="no"
63 lefcha 1.5 fi
64 lefcha 1.19 elif [ $head = "cram" ]
65     then
66     if [ $body = "yes" ]; then cram="yes"
67     elif [ $body = "no" ]; then cram="no"
68     fi
69 lefcha 1.5 fi
70 lefcha 1.1 ;;
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 lefcha 1.15 -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 lefcha 1.1 -o option=argument Enabling/disabling of program's options.
86    
87     Options:
88 lefcha 1.14 debug Debugging information, useful during development [$debug]
89     checkperms Configuration file's permissions checking [$checkperms]
90     encpasswds Encrypted passwords support [$encpasswds]
91 lefcha 1.20 ssltls Secure Socket Layer and Transport Layer Security [$ssltls]
92 lefcha 1.19 cram Challenge-Response Authentication Mechanism [$cram]
93 lefcha 1.1 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 lefcha 1.9 printf "Destination directory [$destdir]: "
105 lefcha 1.1 read tmp
106     if [ -n "$tmp" ]; then destdir="$tmp"; fi
107    
108 lefcha 1.9 printf "Binaries directory [$bindir]: "
109 lefcha 1.1 read tmp
110     if [ -n "$tmp" ]; then bindir="$tmp"; fi
111    
112 lefcha 1.9 printf "Manual pages directory [$mandir]: "
113 lefcha 1.1 read tmp
114     if [ -n "$tmp" ]; then mandir="$tmp"; fi
115    
116 lefcha 1.9 printf "Debugging information [$debug]: "
117 lefcha 1.1 read tmp
118     if [ -n "$tmp" ]; then debug="$tmp"; fi
119    
120 lefcha 1.9 printf "Configuration file permissions checking [$checkperms]: "
121 lefcha 1.1 read tmp
122     if [ -n "$tmp" ]; then checkperms="$tmp"; fi
123    
124 lefcha 1.14 printf "Encrypted passwords support [$encpasswds]: "
125 lefcha 1.4 read tmp
126     if [ -n "$tmp" ]; then encpasswds="$tmp"; fi
127    
128 lefcha 1.20 printf "Secure Socket Layer and Transport Layer Security [$ssltls]: "
129 lefcha 1.1 read tmp
130 lefcha 1.20 if [ -n "$tmp" ]; then ssltls="$tmp"; fi
131 lefcha 1.19
132     printf "Challenge-Response Authentication Mechanism [$cram]: "
133     read tmp
134     if [ -n "$tmp" ]; then cram="$tmp"; fi
135 lefcha 1.1 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 lefcha 1.4 Encrypted passwords support: $encpasswds
143 lefcha 1.20 Secure Socket Layer and Transport Layer Security: $ssltls
144     Challenge-Response Authentication Mechanism: $cram
145 lefcha 1.1 EOF
146     fi
147    
148    
149     # Libraries
150    
151 lefcha 1.20 if [ $ssltls = "yes" ]
152 lefcha 1.1 then
153 lefcha 1.19 libs="$libs $libssl $libcrypto"
154     elif [ $encpasswds = "yes" || $cram = "yes" ]
155 lefcha 1.4 then
156 lefcha 1.19 libs="$libs $libcrypto"
157 lefcha 1.1 fi
158    
159    
160 lefcha 1.10 # C flags
161    
162     if [ $debug = "yes" ]
163     then
164     cflags="-g"
165     else
166     cflags="-O"
167     fi
168    
169 lefcha 1.4
170 lefcha 1.1 # Backup of original Makefile and config.h
171    
172 lefcha 1.13 if [ ! -f .Makefile ]; then cp -f Makefile .Makefile; fi
173     if [ ! -f .config.h ]; then cp -f config.h .config.h; fi
174 lefcha 1.1
175    
176     # Write Makefile
177    
178 lefcha 1.13 mv -f Makefile Makefile~
179 lefcha 1.1
180     cat > Makefile << EOF
181     CC = cc
182 lefcha 1.10 CFLAGS = $cflags
183 lefcha 1.16 LDFLAGS =
184 lefcha 1.1
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 lefcha 1.19 OBJ = auth.o data.o file.o imap.o imapfilter.o lock.o log.o memory.o misc.o \\
194 lefcha 1.3 passwd.o response.o request.o socket.o tty.o
195 lefcha 1.1
196     LIBS = $libs
197    
198     imapfilter: \$(OBJ)
199 lefcha 1.16 \$(CC) \$(LIBS) \$(LDFLAGS) -o \$(BIN) \$(OBJ)
200 lefcha 1.1
201 lefcha 1.19 auth.o data.o file.o imap.o imapfilter.o lock.o log.o response.o request.o \\
202 lefcha 1.3 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 lefcha 1.1
205     install: imapfilter
206 lefcha 1.11 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 lefcha 1.12 if test ! -d \$(MANDIR)/man5; then mkdir -p \$(MANDIR)/man5; fi
211 lefcha 1.11 cp -f \$(MAN_RC) \$(MANDIR)/man5 && chmod 0644 \$(MANDIR)/man5/\$(MAN_RC)
212 lefcha 1.1
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 lefcha 1.11 @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 lefcha 1.1 EOF
223    
224    
225     # Write config.h
226    
227 lefcha 1.13 mv -f config.h config.h~
228 lefcha 1.1
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 lefcha 1.4 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 lefcha 1.1 fi
254     echo >> config.h
255    
256     echo "/* Secure Socket Layer and Transport Layer Security support. */" >> config.h
257 lefcha 1.20 if [ $ssltls = "yes" ]
258 lefcha 1.1 then
259     echo "#define SSL_TLS" >> config.h
260     else
261     echo "#undef SSL_TLS" >> config.h
262 lefcha 1.19 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 lefcha 1.1 fi
272    
273    
274     exit 0

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26