/[imapfilter]/imapfilter/config
ViewVC logotype

Annotation of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (hide annotations)
Mon Sep 30 19:27:50 2002 UTC (21 years, 6 months ago) by lefcha
Branch: MAIN
Changes since 1.11: +1 -1 lines
Typo error fix.

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26