/[imapfilter]/imapfilter/config
ViewVC logotype

Annotation of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (hide annotations)
Tue May 20 12:17:52 2003 UTC (20 years, 11 months ago) by lefcha
Branch: MAIN
Changes since 1.17: +0 -21 lines
Removed memory lock functionality.

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26