masqmail

changeset 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 92b58989a09e
children 44043b92114f
files contrib/config-transition
diffstat 1 files changed, 135 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/contrib/config-transition	Wed Jul 21 22:12:55 2010 +0200
     1.3 @@ -0,0 +1,135 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# check masqmail config files for options that are obsolete
     1.7 +# -v enables verbose output
     1.8 +#
     1.9 +# 2010  markus schnalke <meillo@marmaro.de>
    1.10 +
    1.11 +if [ $# -eq 0 ] ; then
    1.12 +	echo "usage: config-transition [-v] CONFIGFILE..." >&2
    1.13 +	exit 1
    1.14 +fi
    1.15 +
    1.16 +awkscript="/tmp/masqmail-config-transition-$$"
    1.17 +
    1.18 +trap 'rm -f "$awkscript"; exit' INT QUIT TERM EXIT
    1.19 +
    1.20 +cat >"$awkscript" <<!
    1.21 +# Because of the Here-document, escape (with backslash) these characters:
    1.22 +# backslash, dollar, backtick
    1.23 +BEGIN {
    1.24 +
    1.25 +########  START OF CHECKS  ########
    1.26 +
    1.27 +# Rules look like this:
    1.28 +#
    1.29 +# check["regexp"] = "conf-kind" SUBSEP "version-info" SUBSEP "verbose-description"
    1.30 +#
    1.31 +# Meaning of the strings:
    1.32 +# - regexp: is also used as the name in the normal listing
    1.33 +# - conf-kind: in which kind of config the option appears (conf, route, get)
    1.34 +# - version-info: when it was removed
    1.35 +# - verbose-description: how to do it now
    1.36 +
    1.37 +
    1.38 +# conf file
    1.39 +
    1.40 +check["remote_port"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
    1.41 +Use 'mail_host' in the route configuration instead. \
    1.42 +"
    1.43 +
    1.44 +check["mbox_default.*maildir"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
    1.45 +Native maildir support was removed completely. \
    1.46 +Use an MDA, e.g. procmail, to deliver to Maildir mail folder. \
    1.47 +"
    1.48 +
    1.49 +check["maildir_users"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
    1.50 +Native maildir support was removed completely. \
    1.51 +Use an MDA, e.g. procmail, to deliver to Maildir mail folder. \
    1.52 +"
    1.53 +
    1.54 +check["mserver_iface"] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
    1.55 +Native mserver support was removed from masqmail. \
    1.56 +Use the mservdetect tool with online_detect=pipe instead. \
    1.57 +"
    1.58 +
    1.59 +check["get\\\\."] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
    1.60 +The POP3 client was removed from masqmail. \
    1.61 +Use a dedicated POP3 client, e.g. fetchmail, instead. \
    1.62 +"
    1.63 +
    1.64 +check["online_gets\\\\."] = "conf" SUBSEP "Removed in 0.3.0" SUBSEP "\
    1.65 +The POP3 client was removed from masqmail. \
    1.66 +Use a dedicated POP3 client, e.g. fetchmail, instead. \
    1.67 +"
    1.68 +
    1.69 +# route files
    1.70 +
    1.71 +check["pop3_login"] = "route" SUBSEP "Removed in 0.3.0" SUBSEP "\
    1.72 +POP-before-SMTP login function was removed completely. \
    1.73 +SMTP AUTH supersedes it today. \
    1.74 +If you though rely on it, stay with masqmail-0.2.x or run an arbitrary POP client before. \
    1.75 +"
    1.76 +
    1.77 +check["do_ssl"] = "route" SUBSEP "Ignored by masqmail" SUBSEP "\
    1.78 +Please report to the mailing list at <masqmail@marmaro.de> that you used this option. \
    1.79 +We still don't know the rationale behind this option. \
    1.80 +All we have is a comment in the code saying: This option is used by sqilconf. \
    1.81 +"
    1.82 +
    1.83 +# get files
    1.84 +
    1.85 +# already covered by the get.* and online_gets.* options in the conf
    1.86 +# file. This check is just to make sure, because one might only check
    1.87 +# the get file.
    1.88 +# We don't check for the other get file options, which are:
    1.89 +# protocol server port wrapper user pass address return_path do_keep
    1.90 +# do_uidl do_uidl_dele max_size max_size_delete max_count resolve_list
    1.91 +
    1.92 +check["protocol.*pop"] = "get" SUBSEP "Removed in 0.3.0" SUBSEP "\
    1.93 +The POP3 client was removed from masqmail. \
    1.94 +Use a dedicated POP3 client, e.g. fetchmail, instead. \
    1.95 +"
    1.96 +
    1.97 +
    1.98 +########  END OF CHECK DEFINITIONS  ########
    1.99 +}
   1.100 +
   1.101 +function checkcomment() {
   1.102 +	if (/^[ \t]*\#/) {
   1.103 +		return " (in a comment)"
   1.104 +	}
   1.105 +}
   1.106 +
   1.107 +{
   1.108 +	for (key in check) {
   1.109 +		if (\$0 !~ key) {
   1.110 +			continue;
   1.111 +		}
   1.112 +		# we have a match
   1.113 +		split(check[key], a, SUBSEP);  # array index starts with 1
   1.114 +		printf("%s:%d: [%s] %s%s\n", FILENAME, NR, a[1], key, checkcomment());
   1.115 +		cmd = "fold -sw 70 | sed 's,^,\t,'"
   1.116 +		if (verbose) {
   1.117 +			print "\t>>>> " \$0 " <<<<"
   1.118 +			print a[3] | cmd
   1.119 +			close(cmd)
   1.120 +			print "\t" a[2]
   1.121 +			print ""
   1.122 +		}
   1.123 +	}
   1.124 +}
   1.125 +			
   1.126 +!
   1.127 +
   1.128 +
   1.129 +verbose=0
   1.130 +if [ X"$1" = X"-v" ] ; then
   1.131 +	verbose=1
   1.132 +	shift
   1.133 +fi
   1.134 +
   1.135 +for i do
   1.136 +	awk -f "$awkscript" "verbose=$verbose" "$i"
   1.137 +done
   1.138 +