/[imapfilter]/imapfilter/config
ViewVC logotype

Contents of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations)
Mon Jan 14 18:12:38 2002 UTC (22 years, 2 months ago) by lefcha
Branch: MAIN
Changes since 1.3: +21 -0 lines
Added encrypted passwords support.

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26