masqmail

view admin/config-transition @ 273:00724782b6c9

parse.c: comments, better debugging, tiny refactoring
author markus schnalke <meillo@marmaro.de>
date Fri, 03 Dec 2010 19:25:43 -0300
parents cab46cefa4ce
children f10a56dc7481
line source
1 #!/bin/sh
2 #
3 # check masqmail config files for options that are obsolete
4 # -v enables verbose output
5 #
6 # 2010 markus schnalke <meillo@marmaro.de>
8 if [ $# -eq 0 ] ; then
9 echo "usage: config-transition [-v] CONFIGFILE..." >&2
10 exit 1
11 fi
13 awkscript="/tmp/masqmail-config-transition-$$"
15 trap 'rm -f "$awkscript"; exit' INT QUIT TERM EXIT
17 cat >"$awkscript" <<!
18 # Because of the Here-document, escape (with backslash) these characters:
19 # backslash, dollar, backtick
20 BEGIN {
22 ######## START OF CHECKS ########
24 # Rules look like this:
25 #
26 # check["regexp"] = "conf-kind" SUBSEP "version-info" SUBSEP "verbose-description"
27 #
28 # Meaning of the strings:
29 # - regexp: is also used as the name in the normal listing
30 # - conf-kind: in which kind of config the option appears (conf, route, get)
31 # - version-info: when it was removed
32 # - verbose-description: how to do it now
35 # conf file
37 check["remote_port"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
38 Use 'mail_host' in the route configuration instead. \
39 "
41 check["mbox_default.*maildir"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
42 Native maildir support was removed completely. \
43 Use an MDA, e.g. procmail, to deliver to Maildir mail folder. \
44 "
46 check["maildir_users"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
47 Native maildir support was removed completely. \
48 Use an MDA, e.g. procmail, to deliver to Maildir mail folder. \
49 "
51 check["mserver_iface"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
52 Native mserver support was removed from masqmail. \
53 Use the mservdetect tool with online_detect=pipe instead. \
54 "
56 check["get\\\\."] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
57 The POP3 client was removed from masqmail. \
58 Use a dedicated POP3 client, e.g. fetchmail, instead. \
59 "
61 check["online_gets\\\\."] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
62 The POP3 client was removed from masqmail. \
63 Use a dedicated POP3 client, e.g. fetchmail, instead. \
64 "
66 check["alias_local_caseless"] = "conf" SUBSEP "Renamed in 0.3.1" SUBSEP "\
67 It is now called 'caseless_matching' instead. \
68 "
70 # route files
72 check["pop3_login"] = "route" SUBSEP "Removed in 0.3.0" SUBSEP "\
73 POP-before-SMTP login function was removed completely. \
74 SMTP AUTH supersedes it today. \
75 If you though rely on it, stay with masqmail-0.2.x or run an arbitrary POP client before. \
76 "
78 check["do_ssl"] = "route" SUBSEP "Ignored by masqmail" SUBSEP "\
79 Please report to the mailing list at <masqmail@marmaro.de> that you used this option. \
80 We still don't know the rationale behind this option. \
81 All we have is a comment in the code saying: This option is used by sqilconf. \
82 "
84 # get files
86 # already covered by the get.* and online_gets.* options in the conf
87 # file. This check is just to make sure, because one might only check
88 # the get file.
89 # We don't check for the other get file options, which are:
90 # protocol server port wrapper user pass address return_path do_keep
91 # do_uidl do_uidl_dele max_size max_size_delete max_count resolve_list
93 check["protocol.*pop"] = "get" SUBSEP "Removed in 0.3.0" SUBSEP "\
94 The POP3 client was removed from masqmail. \
95 Use a dedicated POP3 client, e.g. fetchmail, instead. \
96 "
99 ######## END OF CHECK DEFINITIONS ########
100 }
102 function checkcomment() {
103 if (/^[ \t]*\#/) {
104 return " (in a comment)"
105 }
106 }
108 {
109 for (key in check) {
110 if (\$0 !~ key) {
111 continue;
112 }
113 # we have a match
114 split(check[key], a, SUBSEP); # array index starts with 1
115 printf("%s:%d: [%s] %s%s\n", FILENAME, NR, a[1], key, checkcomment());
116 cmd = "fold -sw 70 | sed 's,^,\t,'"
117 if (verbose) {
118 print "\t>>>> " \$0 " <<<<"
119 print a[3] | cmd
120 close(cmd)
121 print "\t" a[2]
122 print ""
123 }
124 }
125 }
127 !
130 verbose=0
131 if [ X"$1" = X"-v" ] ; then
132 verbose=1
133 shift
134 fi
136 for i do
137 awk -f "$awkscript" "verbose=$verbose" "$i"
138 done