masqmail
view contrib/config-transition @ 219:c5d319418813
added config-transition
this script takes config files and checks them for obsolete options
if any found, it outputs them
if called with -v it also explains how to substitute them
the usual call: config-transition -v /etc/masqmail/*
author | meillo@marmaro.de |
---|---|
date | Wed, 21 Jul 2010 22:12:55 +0200 |
parents | |
children |
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 # route files
68 check["pop3_login"] = "route" SUBSEP "Removed in 0.3.0" SUBSEP "\
69 POP-before-SMTP login function was removed completely. \
70 SMTP AUTH supersedes it today. \
71 If you though rely on it, stay with masqmail-0.2.x or run an arbitrary POP client before. \
72 "
74 check["do_ssl"] = "route" SUBSEP "Ignored by masqmail" SUBSEP "\
75 Please report to the mailing list at <masqmail@marmaro.de> that you used this option. \
76 We still don't know the rationale behind this option. \
77 All we have is a comment in the code saying: This option is used by sqilconf. \
78 "
80 # get files
82 # already covered by the get.* and online_gets.* options in the conf
83 # file. This check is just to make sure, because one might only check
84 # the get file.
85 # We don't check for the other get file options, which are:
86 # protocol server port wrapper user pass address return_path do_keep
87 # do_uidl do_uidl_dele max_size max_size_delete max_count resolve_list
89 check["protocol.*pop"] = "get" SUBSEP "Removed in 0.3.0" SUBSEP "\
90 The POP3 client was removed from masqmail. \
91 Use a dedicated POP3 client, e.g. fetchmail, instead. \
92 "
95 ######## END OF CHECK DEFINITIONS ########
96 }
98 function checkcomment() {
99 if (/^[ \t]*\#/) {
100 return " (in a comment)"
101 }
102 }
104 {
105 for (key in check) {
106 if (\$0 !~ key) {
107 continue;
108 }
109 # we have a match
110 split(check[key], a, SUBSEP); # array index starts with 1
111 printf("%s:%d: [%s] %s%s\n", FILENAME, NR, a[1], key, checkcomment());
112 cmd = "fold -sw 70 | sed 's,^,\t,'"
113 if (verbose) {
114 print "\t>>>> " \$0 " <<<<"
115 print a[3] | cmd
116 close(cmd)
117 print "\t" a[2]
118 print ""
119 }
120 }
121 }
123 !
126 verbose=0
127 if [ X"$1" = X"-v" ] ; then
128 verbose=1
129 shift
130 fi
132 for i do
133 awk -f "$awkscript" "verbose=$verbose" "$i"
134 done