Home | History | Annotate | Line # | Download | only in conf
post-install revision 1.2.14.1
      1       1.1      tron #!/bin/sh
      2  1.2.14.1    martin #	$NetBSD: post-install,v 1.2.14.1 2023/12/25 12:54:33 martin Exp $
      3       1.1      tron #
      4       1.1      tron 
      5       1.1      tron # To view the formatted manual page of this file, type:
      6       1.1      tron #	POSTFIXSOURCE/mantools/srctoman - post-install | nroff -man
      7       1.1      tron 
      8       1.1      tron #++
      9       1.1      tron # NAME
     10       1.1      tron #	post-install
     11       1.1      tron # SUMMARY
     12       1.1      tron #	Postfix post-installation script
     13       1.1      tron # SYNOPSIS
     14       1.1      tron #	postfix post-install [name=value] command ...
     15       1.1      tron # DESCRIPTION
     16       1.1      tron #	The post-install script performs the finishing touch of a Postfix
     17       1.1      tron #	installation, after the executable programs and configuration
     18       1.1      tron #	files are installed. Usage is one of the following:
     19       1.1      tron # .IP o
     20       1.1      tron #	While installing Postfix from source code on the local machine, the
     21       1.1      tron #	script is run by the postfix-install script to update selected file
     22       1.1      tron #	or directory permissions and to update Postfix configuration files.
     23       1.1      tron # .IP o
     24       1.1      tron #	While installing Postfix from a pre-built package, the script is run
     25       1.1      tron #	by the package management procedure to set all file or directory
     26       1.1      tron #	permissions and to update Postfix configuration files.
     27       1.1      tron # .IP o
     28       1.1      tron #	The script can be used to change installation parameter settings such
     29       1.1      tron #	as mail_owner or setgid_group after Postfix is already installed.
     30       1.1      tron # .IP o
     31       1.1      tron #	The script can be used to upgrade configuration files and to upgrade
     32       1.1      tron #	file/directory permissions of a secondary Postfix instance.
     33       1.1      tron # .IP o
     34       1.1      tron #	At Postfix start-up time, the script is run from "postfix check" to
     35       1.1      tron #	create missing queue directories.
     36       1.1      tron # .PP
     37       1.1      tron #	The post-install script is controlled by installation parameters.
     38       1.1      tron #	Specific parameters are described at the end of this document.
     39       1.1      tron #	All installation parameters must be specified ahead of time via
     40       1.1      tron #	one of the methods described below.
     41       1.1      tron #
     42       1.1      tron #	Arguments
     43       1.1      tron # .IP create-missing
     44       1.1      tron #	Create missing queue directories with ownerships and permissions
     45       1.2  christos #	according to the contents of $meta_directory/postfix-files
     46       1.2  christos #	and optionally in $meta_directory/postfix-files.d/*, using
     47       1.2  christos #	the mail_owner and setgid_group parameter settings from the
     48       1.2  christos #	command line, process environment or from the installed
     49       1.2  christos #	main.cf file.
     50       1.1      tron #
     51       1.1      tron #	This is required at Postfix start-up time.
     52       1.1      tron # .IP set-permissions
     53       1.1      tron #	Set all file/directory ownerships and permissions according to the
     54       1.2  christos #	contents of $meta_directory/postfix-files and optionally
     55       1.2  christos #	in $meta_directory/postfix-files.d/*, using the mail_owner
     56       1.2  christos #	and setgid_group parameter settings from the command line,
     57       1.2  christos #	process environment or from the installed main.cf file.
     58       1.2  christos #	Implies create-missing.
     59       1.1      tron #
     60       1.1      tron #	This is required when installing Postfix from a pre-built package,
     61       1.1      tron #	or when changing the mail_owner or setgid_group installation parameter
     62       1.1      tron #	settings after Postfix is already installed.
     63       1.1      tron # .IP upgrade-permissions
     64       1.1      tron #	Update ownership and permission of existing files/directories as
     65       1.2  christos #	specified in $meta_directory/postfix-files and optionally
     66       1.2  christos #	in $meta_directory/postfix-files.d/*, using the mail_owner
     67       1.2  christos #	and setgid_group parameter settings from the command line,
     68       1.2  christos #	process environment or from the installed main.cf file.
     69       1.2  christos #	Implies create-missing.
     70       1.1      tron #
     71       1.1      tron #	This is required when upgrading an existing Postfix instance.
     72       1.1      tron # .IP upgrade-configuration
     73       1.1      tron #	Edit the installed main.cf and master.cf files, in order to account
     74       1.1      tron #	for missing services and to fix deprecated parameter settings.
     75       1.1      tron #
     76       1.1      tron #	This is required when upgrading an existing Postfix instance.
     77       1.1      tron # .IP upgrade-source
     78       1.1      tron #	Short-hand for: upgrade-permissions upgrade-configuration.
     79       1.1      tron #
     80       1.1      tron #	This is recommended when upgrading Postfix from source code.
     81       1.1      tron # .IP upgrade-package
     82       1.1      tron #	Short-hand for: set-permissions upgrade-configuration.
     83       1.1      tron #
     84       1.1      tron #	This is recommended when upgrading Postfix from a pre-built package.
     85       1.1      tron # .IP first-install-reminder
     86       1.1      tron #	Remind the user that they still need to configure main.cf and the
     87       1.1      tron #	aliases file, and that newaliases still needs to be run.
     88       1.1      tron #
     89       1.1      tron #	This is recommended when Postfix is installed for the first time.
     90       1.1      tron # MULTIPLE POSTFIX INSTANCES
     91       1.1      tron # .ad
     92       1.1      tron # .fi
     93       1.1      tron #	Multiple Postfix instances on the same machine can share command and
     94       1.1      tron #	daemon program files but must have separate configuration and queue
     95       1.1      tron #	directories.
     96       1.1      tron #
     97       1.1      tron #	To create a secondary Postfix installation on the same machine,
     98       1.1      tron #	copy the configuration files from the primary Postfix instance to
     99       1.1      tron #	a secondary configuration directory and execute:
    100       1.1      tron #
    101       1.1      tron #	postfix post-install config_directory=secondary-config-directory \e
    102       1.1      tron # .in +4
    103       1.1      tron #		queue_directory=secondary-queue-directory \e
    104       1.1      tron # .br
    105       1.1      tron #		create-missing
    106       1.1      tron # .PP
    107       1.1      tron #	This creates secondary Postfix queue directories, sets their access
    108       1.1      tron #	permissions, and saves the specified installation parameters to the
    109       1.1      tron #	secondary main.cf file.
    110       1.1      tron #
    111       1.1      tron #	Be sure to list the secondary configuration directory in the
    112       1.1      tron #	alternate_config_directories parameter in the primary main.cf file.
    113       1.1      tron #
    114       1.1      tron #	To upgrade a secondary Postfix installation on the same machine,
    115       1.1      tron #	execute:
    116       1.1      tron #
    117       1.1      tron #	postfix post-install config_directory=secondary-config-directory \e
    118       1.1      tron # .in +4
    119       1.1      tron #		upgrade-permissions upgrade-configuration
    120       1.1      tron # INSTALLATION PARAMETER INPUT METHODS
    121       1.1      tron # .ad
    122       1.1      tron # .fi
    123       1.1      tron #	Parameter settings can be specified through a variety of
    124       1.1      tron #	mechanisms.  In order of decreasing precedence these are:
    125       1.1      tron # .IP "command line"
    126       1.1      tron #	Parameter settings can be given as name=value arguments on
    127       1.1      tron #	the post-install command line. These have the highest precedence.
    128       1.1      tron #	Settings that override the installed main.cf file are saved.
    129       1.1      tron # .IP "process environment"
    130       1.1      tron #	Parameter settings can be given as name=value environment
    131       1.1      tron #	variables.
    132       1.1      tron #	Settings that override the installed main.cf file are saved.
    133       1.1      tron # .IP "installed configuration files"
    134       1.1      tron #	If a parameter is not specified via the command line or via the
    135       1.1      tron #	process environment, post-install will attempt to extract its
    136       1.1      tron #	value from the already installed Postfix main.cf configuration file.
    137       1.1      tron #	These settings have the lowest precedence.
    138       1.1      tron # INSTALLATION PARAMETER DESCRIPTION
    139       1.1      tron # .ad
    140       1.1      tron # .fi
    141       1.1      tron #	The description of installation parameters is as follows:
    142       1.1      tron # .IP config_directory
    143       1.1      tron #	The directory for Postfix configuration files.
    144       1.1      tron # .IP daemon_directory
    145       1.1      tron #	The directory for Postfix daemon programs. This directory
    146       1.1      tron #	should not be in the command search path of any users.
    147       1.1      tron # .IP command_directory
    148       1.1      tron #	The directory for Postfix administrative commands. This
    149  1.2.14.1    martin #	directory should be in the command search path of administrative users.
    150       1.1      tron # .IP queue_directory
    151       1.1      tron #	The directory for Postfix queues.
    152       1.1      tron # .IP data_directory
    153       1.1      tron #	The directory for Postfix writable data files (caches, etc.).
    154       1.1      tron # .IP sendmail_path
    155       1.1      tron #	The full pathname for the Postfix sendmail command.
    156       1.1      tron #	This is the Sendmail-compatible mail posting interface.
    157       1.1      tron # .IP newaliases_path
    158       1.1      tron #	The full pathname for the Postfix newaliases command.
    159       1.1      tron #	This is the Sendmail-compatible command to build alias databases
    160       1.1      tron #	for the Postfix local delivery agent.
    161       1.1      tron # .IP mailq_path
    162       1.1      tron #	The full pathname for the Postfix mailq command.
    163       1.1      tron #	This is the Sendmail-compatible command to list the mail queue.
    164       1.1      tron # .IP mail_owner
    165       1.1      tron #	The owner of the Postfix queue. Its numerical user ID and group ID
    166       1.1      tron #	must not be used by any other accounts on the system.
    167       1.1      tron # .IP setgid_group
    168       1.1      tron #	The group for mail submission and for queue management commands.
    169       1.1      tron #	Its numerical group ID must not be used by any other accounts on the
    170       1.1      tron #	system, not even by the mail_owner account.
    171       1.1      tron # .IP html_directory
    172       1.1      tron #	The directory for the Postfix HTML files.
    173       1.1      tron # .IP manpage_directory
    174       1.1      tron #	The directory for the Postfix on-line manual pages.
    175       1.1      tron # .IP sample_directory
    176       1.1      tron #	The directory for the Postfix sample configuration files.
    177       1.1      tron #	This feature is obsolete as of Postfix 2.1.
    178       1.1      tron # .IP readme_directory
    179       1.1      tron #	The directory for the Postfix README files.
    180       1.2  christos # .IP shlib_directory
    181       1.2  christos #	The directory for the Postfix shared-library files, and for
    182       1.2  christos #	the Postfix dabatase plugin files with a relative pathname
    183       1.2  christos #	in the file dynamicmaps.cf.
    184       1.2  christos # .IP meta_directory
    185       1.2  christos #	The directory for non-executable files that are shared
    186       1.2  christos #	among multiple Postfix instances, such as postfix-files,
    187       1.2  christos #	dynamicmaps.cf, as well as the multi-instance template files
    188       1.2  christos #	main.cf.proto and master.cf.proto.
    189       1.1      tron # SEE ALSO
    190       1.1      tron #	postfix-install(1) Postfix primary installation script.
    191       1.1      tron # FILES
    192       1.1      tron #	$config_directory/main.cf, Postfix installation parameters.
    193       1.2  christos #	$meta_directory/postfix-files, installation control file.
    194       1.2  christos #	$meta_directory/postfix-files.d/*, optional control files.
    195       1.1      tron #	$config_directory/install.cf, obsolete configuration file.
    196       1.1      tron # LICENSE
    197       1.1      tron # .ad
    198       1.1      tron # .fi
    199       1.1      tron #	The Secure Mailer license must be distributed with this software.
    200       1.1      tron # AUTHOR(S)
    201       1.1      tron #	Wietse Venema
    202       1.1      tron #	IBM T.J. Watson Research
    203       1.1      tron #	P.O. Box 704
    204       1.1      tron #	Yorktown Heights, NY 10598, USA
    205  1.2.14.1    martin #
    206  1.2.14.1    martin #	Wietse Venema
    207  1.2.14.1    martin #	Google, Inc.
    208  1.2.14.1    martin #	111 8th Avenue
    209  1.2.14.1    martin #	New York, NY 10011, USA
    210       1.1      tron #--
    211       1.1      tron 
    212       1.1      tron umask 022
    213       1.1      tron 
    214       1.1      tron PATH=/bin:/usr/bin:/usr/sbin:/usr/etc:/sbin:/etc:/usr/contrib/bin:/usr/gnu/bin:/usr/ucb:/usr/bsd
    215       1.1      tron SHELL=/bin/sh
    216       1.1      tron IFS=" 	
    217       1.1      tron "
    218       1.1      tron BACKUP_IFS="$IFS"
    219       1.1      tron debug=:
    220       1.1      tron #debug=echo
    221       1.1      tron MOST_PARAMETERS="command_directory daemon_directory data_directory
    222       1.1      tron     html_directory mail_owner mailq_path manpage_directory
    223       1.1      tron     newaliases_path queue_directory readme_directory sample_directory
    224       1.2  christos     sendmail_path setgid_group shlib_directory meta_directory"
    225       1.1      tron NON_SHARED="config_directory queue_directory data_directory"
    226       1.1      tron 
    227       1.1      tron USAGE="Usage: $0 [name=value] command
    228       1.1      tron     create-missing          Create missing queue directories.
    229       1.1      tron     upgrade-source          When installing or upgrading from source code.
    230       1.1      tron     upgrade-package         When installing or upgrading from pre-built package.
    231       1.1      tron     first-install-reminder  Remind of mandatory first-time configuration steps.
    232       1.1      tron     name=value              Specify an installation parameter".
    233       1.1      tron 
    234       1.1      tron # Process command-line options and parameter settings. Work around
    235       1.1      tron # brain damaged shells. "IFS=value command" should not make the
    236       1.1      tron # IFS=value setting permanent. But some broken standard allows it.
    237       1.1      tron 
    238       1.1      tron create=; set_perms=; upgrade_perms=; upgrade_conf=; first_install_reminder=
    239       1.1      tron obsolete=; keep_list=;
    240       1.1      tron 
    241       1.1      tron for arg
    242       1.1      tron do
    243       1.1      tron     case $arg in
    244       1.2  christos 	*[" 	"]*) echo $0: "Error: argument contains whitespace: '$arg'"
    245       1.2  christos 		     exit 1;;
    246       1.1      tron                 *=*) IFS= eval $arg; IFS="$BACKUP_IFS";;
    247       1.1      tron      create-missing) create=1;;
    248       1.1      tron 	  set-perm*) create=1; set_perms=1;;
    249       1.1      tron       upgrade-perm*) create=1; upgrade_perms=1;;
    250       1.1      tron       upgrade-conf*) upgrade_conf=1;;
    251       1.1      tron      upgrade-source) create=1; upgrade_conf=1; upgrade_perms=1;;
    252       1.1      tron     upgrade-package) create=1; upgrade_conf=1; set_perms=1;;
    253       1.1      tron      first-install*) first_install_reminder=1;;
    254       1.1      tron 		  *) echo "$0: Error: $USAGE" 1>&2; exit 1;;
    255       1.1      tron     esac
    256       1.1      tron     shift
    257       1.1      tron done
    258       1.1      tron 
    259       1.1      tron # Sanity checks.
    260       1.1      tron 
    261       1.1      tron test -n "$create$upgrade_conf$first_install_reminder" || {
    262       1.1      tron     echo "$0: Error: $USAGE" 1>&2
    263       1.1      tron     exit 1
    264       1.1      tron }
    265       1.1      tron 
    266       1.1      tron # Bootstrapping problem.
    267       1.1      tron 
    268       1.1      tron if [ -n "$command_directory" ]
    269       1.1      tron then
    270       1.1      tron     POSTCONF="$command_directory/postconf"
    271       1.1      tron else
    272       1.1      tron     POSTCONF="postconf"
    273       1.1      tron fi
    274       1.1      tron 
    275       1.1      tron $POSTCONF -d mail_version >/dev/null 2>/dev/null || {
    276       1.1      tron     echo $0: Error: no $POSTCONF command found. 1>&2
    277       1.1      tron     echo Re-run this command as $0 command_directory=/some/where. 1>&2
    278       1.1      tron     exit 1
    279       1.1      tron }
    280       1.1      tron 
    281       1.1      tron # Also used to require license etc. files only in the default instance.
    282       1.1      tron 
    283       1.1      tron def_config_directory=`$POSTCONF -d -h config_directory` || exit 1
    284       1.1      tron test -n "$config_directory" ||
    285       1.1      tron     config_directory="$def_config_directory"
    286       1.1      tron 
    287       1.1      tron test -d "$config_directory" || {
    288       1.1      tron     echo $0: Error: $config_directory is not a directory. 1>&2
    289       1.1      tron     exit 1
    290       1.1      tron }
    291       1.1      tron 
    292       1.1      tron # If this is a secondary instance, don't touch shared files.
    293       1.1      tron # XXX Solaris does not have "test -e".
    294       1.1      tron 
    295       1.1      tron instances=`test ! -f $def_config_directory/main.cf || 
    296       1.1      tron     $POSTCONF -c $def_config_directory -h multi_instance_directories | 
    297       1.1      tron 	sed 's/,/ /'` || exit 1
    298       1.1      tron 
    299       1.1      tron update_shared_files=1
    300       1.1      tron for name in $instances
    301       1.1      tron do
    302       1.1      tron     case "$name" in
    303       1.1      tron     "$def_config_directory") ;;
    304       1.1      tron     "$config_directory") update_shared_files=; break;;
    305       1.1      tron     esac
    306       1.1      tron done
    307       1.1      tron 
    308       1.2  christos test -f $meta_directory/postfix-files || {
    309       1.2  christos     echo $0: Error: $meta_directory/postfix-files is not a file. 1>&2
    310       1.1      tron     exit 1
    311       1.1      tron }
    312       1.1      tron 
    313       1.1      tron # SunOS5 fmt(1) truncates lines > 1000 characters.
    314       1.1      tron 
    315       1.1      tron fake_fmt() {
    316       1.1      tron     sed '
    317       1.1      tron     :top
    318       1.1      tron 	/^\(  *\)\([^ ][^ ]*\)  */{
    319       1.1      tron 	    s//\1\2\
    320       1.1      tron \1/
    321       1.1      tron 	    P
    322       1.1      tron 	    D
    323       1.1      tron 	    b top
    324       1.1      tron 	}
    325       1.1      tron     ' | fmt
    326       1.1      tron }
    327       1.1      tron 
    328       1.1      tron case `uname -s` in
    329       1.1      tron HP-UX*) FMT=cat;;
    330       1.1      tron SunOS*) FMT=fake_fmt;;
    331       1.1      tron      *) FMT=fmt;;
    332       1.1      tron esac
    333       1.1      tron 
    334       1.1      tron # If a parameter is not set via the command line or environment,
    335       1.1      tron # try to use settings from installed configuration files.
    336       1.1      tron 
    337       1.1      tron # Extract parameter settings from the obsolete install.cf file, as
    338       1.1      tron # a transitional aid.
    339       1.1      tron 
    340       1.1      tron grep setgid_group $config_directory/main.cf >/dev/null 2>&1 || {
    341       1.1      tron     test -f $config_directory/install.cf  && {
    342       1.1      tron         for name in sendmail_path newaliases_path mailq_path setgid manpages
    343       1.1      tron         do
    344       1.1      tron 	eval junk=\$$name
    345       1.1      tron         case "$junk" in
    346       1.1      tron         "") eval unset $name;;
    347       1.1      tron         esac
    348       1.1      tron 	   eval : \${$name="\`. $config_directory/install.cf; echo \$$name\`"} \
    349       1.1      tron 		|| exit 1
    350       1.1      tron         done
    351       1.1      tron         : ${setgid_group=$setgid}
    352       1.1      tron         : ${manpage_directory=$manpages}
    353       1.1      tron     }
    354       1.1      tron }
    355       1.1      tron 
    356       1.1      tron # Extract parameter settings from the installed main.cf file.
    357       1.1      tron 
    358       1.1      tron test -f $config_directory/main.cf && {
    359       1.1      tron     for name in $MOST_PARAMETERS
    360       1.1      tron     do
    361       1.1      tron 	eval junk=\$$name
    362       1.1      tron         case "$junk" in
    363       1.1      tron         "") eval unset $name;;
    364       1.1      tron         esac
    365       1.1      tron         eval : \${$name=\`$POSTCONF -c $config_directory -h $name\`} || exit 1
    366       1.1      tron     done
    367       1.1      tron }
    368       1.1      tron 
    369       1.1      tron # Sanity checks
    370       1.1      tron 
    371       1.1      tron case $manpage_directory in
    372       1.1      tron  no) echo $0: Error: manpage_directory no longer accepts \"no\" values. 1>&2
    373       1.1      tron      echo Try again with \"$0 manpage_directory=/pathname ...\". 1>&2; exit 1;;
    374       1.1      tron esac
    375       1.1      tron 
    376       1.1      tron case $setgid_group in
    377       1.1      tron  no) echo $0: Error: setgid_group no longer accepts \"no\" values. 1>&2
    378       1.1      tron      echo Try again with \"$0 setgid_group=groupname ...\" 1>&2; exit 1;;
    379       1.1      tron esac
    380       1.1      tron 
    381       1.1      tron for path in "$daemon_directory" "$command_directory" "$queue_directory" \
    382       1.2  christos     "$sendmail_path" "$newaliases_path" "$mailq_path" "$manpage_directory" \
    383       1.2  christos     "$meta_directory"
    384       1.1      tron do
    385       1.1      tron    case "$path" in
    386       1.1      tron    /*) ;;
    387       1.1      tron     *) echo $0: Error: \"$path\" should be an absolute path name. 1>&2; exit 1;;
    388       1.1      tron    esac
    389       1.1      tron done
    390       1.1      tron 
    391       1.2  christos for path in "$html_directory" "$readme_directory" "$shlib_directory"
    392       1.1      tron do
    393       1.1      tron    case "$path" in
    394       1.1      tron    /*) ;;
    395       1.1      tron    no) ;;
    396       1.1      tron     *) echo $0: Error: \"$path\" should be \"no\" or an absolute path name. 1>&2; exit 1;;
    397       1.1      tron    esac
    398       1.1      tron done
    399       1.1      tron 
    400       1.1      tron # Find out what parameters were not specified via command line,
    401       1.1      tron # via environment, or via installed configuration files.
    402       1.1      tron 
    403       1.1      tron missing=
    404       1.1      tron for name in $MOST_PARAMETERS
    405       1.1      tron do
    406       1.1      tron     eval test -n \"\$$name\" || missing="$missing $name"
    407       1.1      tron done
    408       1.1      tron 
    409       1.1      tron # All parameters must be specified at this point.
    410       1.1      tron 
    411       1.1      tron test -n "$non_interactive" -a -n "$missing" && {
    412       1.1      tron     cat <<EOF | ${FMT} 1>&2
    413       1.1      tron $0: Error: some required installation parameters are not defined.
    414       1.1      tron 
    415       1.1      tron - Either the parameters need to be given in the $config_directory/main.cf
    416       1.1      tron file from a recent Postfix installation,
    417       1.1      tron 
    418       1.1      tron - Or the parameters need to be specified through the process
    419       1.1      tron environment.
    420       1.1      tron 
    421       1.1      tron - Or the parameters need to be specified as name=value arguments
    422       1.1      tron on the $0 command line,
    423       1.1      tron 
    424       1.1      tron The following parameters were missing:
    425       1.1      tron 
    426       1.1      tron     $missing
    427       1.1      tron 
    428       1.1      tron EOF
    429       1.1      tron     exit 1
    430       1.1      tron }
    431       1.1      tron 
    432       1.1      tron POSTCONF="$command_directory/postconf"
    433       1.1      tron 
    434       1.1      tron # Save settings, allowing command line/environment override.
    435       1.1      tron 
    436       1.2  christos # Undo MAIL_VERSION expansion at the end of a parameter value. If
    437       1.2  christos # someone really wants the expanded mail version in main.cf, then
    438       1.2  christos # we're sorry.
    439       1.2  christos 
    440       1.2  christos # Confine side effects from mail_version unexpansion within a subshell.
    441       1.2  christos 
    442       1.2  christos (case "$mail_version" in
    443       1.2  christos "") mail_version="`$POSTCONF -dhx mail_version`" || exit 1
    444       1.2  christos esac
    445       1.2  christos 
    446       1.2  christos for name in $MOST_PARAMETERS
    447       1.2  christos do
    448       1.2  christos     eval junk=\$$name
    449       1.2  christos     case "$junk" in
    450       1.2  christos     *"$mail_version"*) 
    451       1.2  christos 	case "$pattern" in
    452       1.2  christos 	"") pattern=`echo "$mail_version" | sed 's/\./\\\\./g'` || exit 1
    453       1.2  christos 	esac
    454       1.2  christos 	val=`echo "$junk" | sed "s/$pattern"'$/${mail_version}/g'` || exit 1
    455       1.2  christos 	eval ${name}='"$val"'
    456       1.2  christos     esac
    457       1.2  christos done
    458       1.2  christos 
    459       1.2  christos # XXX Maybe update main.cf only with first install, upgrade, set
    460       1.2  christos # permissions, and what else? Should there be a warning otherwise?
    461       1.2  christos 
    462       1.1      tron override=
    463       1.1      tron for name in $MOST_PARAMETERS
    464       1.1      tron do
    465       1.2  christos     eval junk=\"\$$name\"
    466       1.2  christos     test "$junk" = "`$POSTCONF -c $config_directory -h $name`" || {
    467       1.1      tron 	override=1
    468       1.1      tron 	break
    469       1.1      tron     }
    470       1.1      tron done
    471       1.1      tron 
    472       1.1      tron test -n "$override" && {
    473       1.1      tron     $POSTCONF -c $config_directory -e \
    474       1.1      tron 	"daemon_directory = $daemon_directory" \
    475       1.1      tron 	"command_directory = $command_directory" \
    476       1.1      tron 	"queue_directory = $queue_directory" \
    477       1.1      tron 	"data_directory = $data_directory" \
    478       1.1      tron 	"mail_owner = $mail_owner" \
    479       1.1      tron 	"setgid_group = $setgid_group" \
    480       1.1      tron 	"sendmail_path = $sendmail_path" \
    481       1.1      tron 	"mailq_path = $mailq_path" \
    482       1.1      tron 	"newaliases_path = $newaliases_path" \
    483       1.1      tron 	"html_directory = $html_directory" \
    484       1.1      tron 	"manpage_directory = $manpage_directory" \
    485       1.1      tron 	"sample_directory = $sample_directory" \
    486       1.1      tron 	"readme_directory = $readme_directory" \
    487       1.2  christos 	"shlib_directory = $shlib_directory" \
    488       1.2  christos 	"meta_directory = $meta_directory" \
    489       1.1      tron     || exit 1
    490       1.2  christos } || exit 0) || exit 1
    491       1.1      tron 
    492       1.2  christos # Use file/directory status information in $meta_directory/postfix-files.
    493       1.1      tron 
    494       1.1      tron test -n "$create" && {
    495       1.2  christos     postfix_files_d=$meta_directory/postfix-files.d
    496       1.2  christos     for postfix_file in $meta_directory/postfix-files \
    497       1.2  christos 	`test -d $postfix_files_d && { find $postfix_files_d -type f | sort; }`
    498       1.1      tron     do
    499       1.2  christos 	exec <$postfix_file || exit 1
    500       1.2  christos 	while IFS=: read path type owner group mode flags junk
    501       1.1      tron 	do
    502       1.2  christos 	    IFS="$BACKUP_IFS"
    503       1.2  christos 	    set_permission=
    504       1.2  christos 	    # Skip comments. Skip shared files, if updating a secondary instance.
    505       1.2  christos 	    case $path in
    506       1.2  christos 	    [$]*) case "$update_shared_files" in
    507       1.2  christos 		  1) $debug keep non-shared or shared $path;;
    508       1.2  christos 		  *) non_shared=
    509       1.2  christos 		     for name in $NON_SHARED
    510       1.2  christos 		     do
    511       1.2  christos 			 case $path in
    512       1.2  christos 			 "\$$name"*) non_shared=1; break;;
    513       1.2  christos 			 esac
    514       1.2  christos 		     done
    515       1.2  christos 		     case "$non_shared" in
    516       1.2  christos 		      1) $debug keep non-shared $path;;
    517       1.2  christos 		      *) $debug skip shared $path; continue;;
    518       1.2  christos 		     esac;;
    519       1.2  christos 		  esac;;
    520       1.2  christos 	       *) continue;;
    521       1.1      tron 	    esac
    522       1.2  christos 	    # Skip hard links and symbolic links.
    523       1.2  christos 	    case $type in
    524       1.2  christos 	    [hl]) continue;;
    525       1.2  christos 	    [df]) ;;
    526       1.2  christos 	       *) echo unknown type $type for $path in $postfix_file 1>&2; exit 1;;
    527       1.2  christos 	    esac
    528       1.2  christos 	    # Expand $name, and canonicalize null fields.
    529       1.2  christos 	    for name in path owner group flags
    530       1.2  christos 	    do
    531       1.2  christos 		eval junk=\${$name}
    532       1.2  christos 		case $junk in
    533       1.2  christos 		[$]*) eval $name=$junk;;
    534       1.2  christos 		   -) eval $name=;;
    535       1.2  christos 		   *) ;;
    536       1.2  christos 		esac
    537       1.2  christos 	    done
    538       1.2  christos 	    # Skip uninstalled files.
    539       1.2  christos 	    case $path in
    540       1.2  christos 	    no|no/*) continue;;
    541       1.2  christos 	    esac
    542       1.2  christos 	    # Pick up the flags.
    543       1.2  christos 	    case $flags in *u*) upgrade_flag=1;; *) upgrade_flag=;; esac
    544       1.2  christos 	    case $flags in *c*) create_flag=1;; *) create_flag=;; esac
    545       1.2  christos 	    case $flags in *r*) recursive="-R";; *) recursive=;; esac
    546       1.2  christos 	    case $flags in *o*) obsolete_flag=1;; *) obsolete_flag=;; esac
    547       1.2  christos 	    case $flags in *[1i]*) test ! -r "$path" -a "$config_directory" != \
    548       1.2  christos 				    "$def_config_directory" && continue;; esac
    549       1.2  christos 	    # Flag obsolete objects. XXX Solaris 2..9 does not have "test -e".
    550       1.2  christos 	    if [ -n "$obsolete_flag" ]
    551       1.1      tron 	    then
    552       1.2  christos 		test -r $path -a "$type" != "d" && obsolete="$obsolete $path"
    553       1.2  christos 		continue;
    554       1.1      tron 	    else
    555       1.2  christos 		keep_list="$keep_list $path"
    556       1.2  christos 	    fi
    557       1.2  christos 	    # Create missing directories with proper owner/group/mode settings.
    558       1.2  christos 	    if [ -n "$create" -a "$type" = "d" -a -n "$create_flag" -a ! -d "$path" ]
    559       1.2  christos 	    then
    560       1.2  christos 		mkdir $path || exit 1
    561       1.2  christos 		set_permission=1
    562       1.2  christos 	    # Update all owner/group/mode settings.
    563       1.2  christos 	    elif [ -n "$set_perms" ]
    564       1.2  christos 	    then
    565       1.2  christos 		set_permission=1
    566       1.2  christos 	    # Update obsolete owner/group/mode settings.
    567       1.2  christos 	    elif [ -n "$upgrade_perms" -a -n "$upgrade_flag" ]
    568       1.2  christos 	    then
    569       1.2  christos 		set_permission=1
    570       1.2  christos 	    fi
    571       1.2  christos 	    test -n "$set_permission" && {
    572       1.2  christos 		chown $recursive $owner $path || exit 1
    573       1.2  christos 		test -z "$group" || chgrp $recursive $group $path || exit 1
    574       1.2  christos 		# Don't "chmod -R"; queue file status is encoded in mode bits.
    575       1.2  christos 		if [ "$type" = "d" -a -n "$recursive" ]
    576       1.2  christos 		then
    577       1.2  christos 		    find $path -type d -exec chmod $mode "{}" ";"
    578       1.2  christos 		else
    579       1.2  christos 		    chmod $mode $path
    580       1.2  christos 		fi || exit 1
    581       1.2  christos 	    }
    582       1.2  christos 	done
    583       1.2  christos 	IFS="$BACKUP_IFS"
    584       1.1      tron     done
    585       1.1      tron }
    586       1.1      tron 
    587       1.1      tron # Upgrade existing Postfix configuration files if necessary.
    588       1.1      tron 
    589       1.1      tron test -n "$upgrade_conf" && {
    590       1.1      tron 
    591       1.1      tron     # Postfix 2.0.
    592       1.1      tron     # Add missing relay service to master.cf.
    593       1.1      tron 
    594       1.1      tron     grep '^relay' $config_directory/master.cf >/dev/null || {
    595       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for relay service
    596       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    597       1.1      tron relay	  unix	-	-	n	-	-	smtp
    598       1.1      tron EOF
    599       1.1      tron     }
    600       1.1      tron 
    601       1.1      tron     # Postfix 1.1.
    602       1.1      tron     # Add missing flush service to master.cf.
    603       1.1      tron 
    604       1.1      tron     grep '^flush.*flush' $config_directory/master.cf >/dev/null || {
    605       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for flush service
    606       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    607       1.1      tron flush     unix  -       -       n       1000?   0       flush
    608       1.1      tron EOF
    609       1.1      tron     }
    610       1.1      tron 
    611       1.1      tron     # Postfix 2.1.
    612       1.1      tron     # Add missing trace service to master.cf.
    613       1.1      tron 
    614       1.1      tron     grep 'trace.*bounce' $config_directory/master.cf >/dev/null || {
    615       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for trace service
    616       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    617       1.1      tron trace	  unix	-	-	n	-	0	bounce
    618       1.1      tron EOF
    619       1.1      tron     }
    620       1.1      tron 
    621       1.1      tron     # Postfix 2.1.
    622       1.1      tron     # Add missing verify service to master.cf.
    623       1.1      tron 
    624       1.1      tron     grep '^verify.*verify' $config_directory/master.cf >/dev/null || {
    625       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for verify service
    626       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    627       1.1      tron verify	  unix	-	-	n	-	1	verify
    628       1.1      tron EOF
    629       1.1      tron     }
    630       1.1      tron 
    631       1.1      tron     # Postfix 2.1.
    632       1.1      tron     # Fix verify service process limit.
    633       1.1      tron 
    634       1.1      tron     grep '^verify.*[ 	]0[ 	]*verify' \
    635       1.1      tron 	$config_directory/master.cf >/dev/null && {
    636       1.1      tron 	    echo Editing $config_directory/master.cf, setting verify process limit to 1
    637       1.1      tron 	    ed $config_directory/master.cf <<EOF || exit 1
    638       1.1      tron /^verify.*[ 	]0[ 	]*verify/
    639       1.1      tron s/\([ 	]\)0\([ 	]\)/\11\2/
    640       1.1      tron p
    641       1.1      tron w
    642       1.1      tron q
    643       1.1      tron EOF
    644       1.1      tron     }
    645       1.1      tron 
    646       1.1      tron     # Postfix 1.1.
    647       1.1      tron     # Change privileged pickup service into unprivileged.
    648       1.1      tron 
    649       1.1      tron     grep "^pickup[ 	]*fifo[ 	]*n[ 	]*n" \
    650       1.1      tron 	$config_directory/master.cf >/dev/null && {
    651       1.1      tron 	    echo Editing $config_directory/master.cf, making the pickup service unprivileged
    652       1.1      tron 	    ed $config_directory/master.cf <<EOF || exit 1
    653       1.1      tron /^pickup[ 	]*fifo[ 	]*n[ 	]*n/
    654       1.1      tron s/\(n[ 	]*\)n/\1-/
    655       1.1      tron p
    656       1.1      tron w
    657       1.1      tron q
    658       1.1      tron EOF
    659       1.1      tron     }
    660       1.1      tron 
    661       1.1      tron     # Postfix 1.1.
    662       1.1      tron     # Change private cleanup and flush services into public.
    663       1.1      tron 
    664       1.1      tron     for name in cleanup flush
    665       1.1      tron     do
    666       1.1      tron 	grep "^$name[ 	]*unix[ 	]*[-y]" \
    667       1.1      tron 	    $config_directory/master.cf >/dev/null && {
    668       1.1      tron 		echo Editing $config_directory/master.cf, making the $name service public
    669       1.1      tron 	    ed $config_directory/master.cf <<EOF || exit 1
    670       1.1      tron /^$name[ 	]*unix[ 	]*[-y]/
    671       1.1      tron s/[-y]/n/
    672       1.1      tron p
    673       1.1      tron w
    674       1.1      tron q
    675       1.1      tron EOF
    676       1.1      tron 	}
    677       1.1      tron     done
    678       1.1      tron 
    679       1.1      tron     # Postfix 2.2.
    680       1.1      tron     # File systems have improved since Postfix came out, and all we
    681       1.1      tron     # require now is that defer and deferred are hashed because those
    682       1.1      tron     # can contain lots of files.
    683       1.1      tron 
    684       1.1      tron     found=`$POSTCONF -c $config_directory -h hash_queue_names`
    685       1.1      tron     missing=
    686       1.1      tron     (echo "$found" | grep defer >/dev/null)  || missing="$missing defer"
    687       1.1      tron     (echo "$found" | grep deferred>/dev/null)|| missing="$missing deferred"
    688       1.1      tron     test -n "$missing" && {
    689       1.1      tron 	echo fixing main.cf hash_queue_names for missing $missing
    690       1.1      tron 	$POSTCONF -c $config_directory -e hash_queue_names="$found$missing" ||
    691       1.1      tron 	    exit 1
    692       1.1      tron     }
    693       1.1      tron 
    694       1.1      tron     # Turn on safety nets for new features that could bounce mail that
    695       1.1      tron     # would be accepted by a previous Postfix version.
    696       1.1      tron 
    697       1.1      tron     # [The "unknown_local_recipient_reject_code = 450" safety net,
    698       1.1      tron     # introduced with Postfix 2.0 and deleted after Postfix 2.3.]
    699       1.1      tron 
    700       1.1      tron     # Postfix 2.0.
    701       1.1      tron     # Add missing proxymap service to master.cf.
    702       1.1      tron 
    703       1.1      tron     grep '^proxymap.*proxymap' $config_directory/master.cf >/dev/null || {
    704       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for proxymap service
    705       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    706       1.1      tron proxymap  unix	-	-	n	-	-	proxymap
    707       1.1      tron EOF
    708       1.1      tron     }
    709       1.1      tron 
    710       1.1      tron     # Postfix 2.1.
    711       1.1      tron     # Add missing anvil service to master.cf.
    712       1.1      tron 
    713       1.1      tron     grep '^anvil.*anvil' $config_directory/master.cf >/dev/null || {
    714       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for anvil service
    715       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    716       1.1      tron anvil	  unix	-	-	n	-	1	anvil
    717       1.1      tron EOF
    718       1.1      tron     }
    719       1.1      tron 
    720       1.1      tron     # Postfix 2.2.
    721       1.1      tron     # Add missing scache service to master.cf.
    722       1.1      tron 
    723       1.1      tron     grep '^scache.*scache' $config_directory/master.cf >/dev/null || {
    724       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for scache service
    725       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    726       1.1      tron scache	  unix	-	-	n	-	1	scache
    727       1.1      tron EOF
    728       1.1      tron     }
    729       1.1      tron 
    730       1.1      tron     # Postfix 2.2.
    731       1.1      tron     # Add missing discard service to master.cf.
    732       1.1      tron 
    733       1.1      tron     grep '^discard.*discard' $config_directory/master.cf >/dev/null || {
    734       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for discard service
    735       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    736       1.1      tron discard	  unix	-	-	n	-	-	discard
    737       1.1      tron EOF
    738       1.1      tron     }
    739       1.1      tron 
    740       1.1      tron     # Postfix 2.2.
    741       1.1      tron     # Update the tlsmgr fifo->unix service.
    742       1.1      tron 
    743       1.1      tron     grep "^tlsmgr[ 	]*fifo[ 	]" \
    744       1.1      tron 	$config_directory/master.cf >/dev/null && {
    745       1.1      tron 	    echo Editing $config_directory/master.cf, updating the tlsmgr from fifo to unix service
    746       1.1      tron 	    ed $config_directory/master.cf <<EOF || exit 1
    747       1.1      tron /^tlsmgr[ 	]*fifo[ 	]/
    748       1.1      tron s/fifo/unix/
    749       1.1      tron s/[0-9][0-9]*/&?/
    750       1.1      tron p
    751       1.1      tron w
    752       1.1      tron q
    753       1.1      tron EOF
    754       1.1      tron     }
    755       1.1      tron 
    756       1.1      tron     # Postfix 2.2.
    757       1.1      tron     # Add missing tlsmgr service to master.cf.
    758       1.1      tron 
    759       1.1      tron     grep '^tlsmgr.*tlsmgr' $config_directory/master.cf >/dev/null || {
    760       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for tlsmgr service
    761       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    762       1.1      tron tlsmgr    unix  -       -       n       1000?   1       tlsmgr
    763       1.1      tron EOF
    764       1.1      tron     }
    765       1.1      tron 
    766       1.1      tron     # Postfix 2.2.
    767       1.1      tron     # Add missing retry service to master.cf.
    768       1.1      tron 
    769       1.1      tron     grep '^retry.*error' $config_directory/master.cf >/dev/null || {
    770       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for retry service
    771       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    772       1.1      tron retry     unix  -       -       n       -       -       error
    773       1.1      tron EOF
    774       1.1      tron     }
    775       1.1      tron 
    776       1.1      tron     # Postfix 2.5.
    777       1.1      tron     # Add missing proxywrite service to master.cf.
    778       1.1      tron 
    779       1.1      tron     grep '^proxywrite.*proxymap' $config_directory/master.cf >/dev/null || {
    780       1.1      tron 	echo Editing $config_directory/master.cf, adding missing entry for proxywrite service
    781       1.1      tron 	cat >>$config_directory/master.cf <<EOF || exit 1
    782       1.1      tron proxywrite unix -       -       n       -       1       proxymap
    783       1.1      tron EOF
    784       1.1      tron     }
    785       1.1      tron 
    786       1.1      tron     # Postfix 2.5.
    787       1.1      tron     # Fix a typo in the default master.cf proxywrite entry.
    788       1.1      tron 
    789       1.1      tron     grep '^proxywrite.*-[ 	]*proxymap' $config_directory/master.cf >/dev/null && {
    790       1.1      tron 	echo Editing $config_directory/master.cf, setting proxywrite process limit to 1
    791       1.1      tron 	    ed $config_directory/master.cf <<EOF || exit 1
    792       1.1      tron /^proxywrite.*-[ 	]*proxymap/
    793       1.1      tron s/-\([ 	]*proxymap\)/1\1/
    794       1.1      tron p
    795       1.1      tron w
    796       1.1      tron q
    797       1.1      tron EOF
    798       1.1      tron     }
    799       1.1      tron 
    800       1.2  christos     # Postfix 2.8.
    801       1.2  christos     # Add missing postscreen service to master.cf.
    802       1.2  christos 
    803       1.2  christos     grep '^#*smtp.*postscreen' $config_directory/master.cf >/dev/null || {
    804       1.2  christos 	echo Editing $config_directory/master.cf, adding missing entry for postscreen TCP service
    805       1.2  christos 	cat >>$config_directory/master.cf <<EOF || exit 1
    806       1.2  christos #smtp      inet  n       -       n       -       1       postscreen
    807       1.2  christos EOF
    808       1.2  christos     }
    809       1.2  christos 
    810       1.2  christos     # Postfix 2.8.
    811       1.2  christos     # Add missing smtpd (unix-domain) service to master.cf.
    812       1.2  christos 
    813       1.2  christos     grep '^#*smtpd.*smtpd' $config_directory/master.cf >/dev/null || {
    814       1.2  christos 	echo Editing $config_directory/master.cf, adding missing entry for smtpd unix-domain service
    815       1.2  christos 	cat >>$config_directory/master.cf <<EOF || exit 1
    816       1.2  christos #smtpd     pass  -       -       n       -       -       smtpd
    817       1.2  christos EOF
    818       1.2  christos     }
    819       1.2  christos 
    820       1.2  christos     # Postfix 2.8.
    821       1.2  christos     # Add temporary dnsblog (unix-domain) service to master.cf.
    822       1.2  christos 
    823       1.2  christos     grep '^#*dnsblog.*dnsblog' $config_directory/master.cf >/dev/null || {
    824       1.2  christos 	echo Editing $config_directory/master.cf, adding missing entry for dnsblog unix-domain service
    825       1.2  christos 	cat >>$config_directory/master.cf <<EOF || exit 1
    826       1.2  christos #dnsblog   unix  -       -       n       -       0       dnsblog
    827       1.2  christos EOF
    828       1.2  christos     }
    829       1.2  christos 
    830       1.2  christos     # Postfix 2.8.
    831       1.2  christos     # Add tlsproxy (unix-domain) service to master.cf.
    832       1.2  christos 
    833       1.2  christos     grep '^#*tlsproxy.*tlsproxy' $config_directory/master.cf >/dev/null || {
    834       1.2  christos 	echo Editing $config_directory/master.cf, adding missing entry for tlsproxy unix-domain service
    835       1.2  christos 	cat >>$config_directory/master.cf <<EOF || exit 1
    836       1.2  christos #tlsproxy  unix  -       -       n       -       0       tlsproxy
    837       1.2  christos EOF
    838       1.2  christos     }
    839       1.2  christos 
    840       1.1      tron     # Report (but do not remove) obsolete files.
    841       1.1      tron 
    842       1.1      tron     test -n "$obsolete" && {
    843       1.1      tron 	cat <<EOF | ${FMT}
    844       1.1      tron 
    845       1.1      tron     Note: the following files or directories still exist but are
    846       1.1      tron     no longer part of Postfix:
    847       1.1      tron 
    848       1.1      tron     $obsolete
    849       1.1      tron 
    850       1.1      tron EOF
    851       1.1      tron     }
    852       1.1      tron 
    853       1.2  christos     # Postfix 2.9.
    854       1.2  christos     # Safety net for incompatible changes in IPv6 defaults.
    855       1.2  christos     # PLEASE DO NOT REMOVE THIS CODE. ITS PURPOSE IS TO AVOID AN
    856       1.2  christos     # UNEXPECTED DROP IN PERFORMANCE AFTER UPGRADING FROM POSTFIX
    857       1.2  christos     # BEFORE 2.9.
    858       1.2  christos     # This code assumes that the default is "inet_protocols = ipv4"
    859       1.2  christos     # when IPv6 support is not compiled in. See util/sys_defs.h.
    860       1.2  christos 
    861       1.2  christos     test "`$POSTCONF -dh inet_protocols`" = "ipv4" ||
    862       1.2  christos 	test -n "`$POSTCONF -c $config_directory -n inet_protocols`" || {
    863       1.2  christos 	cat <<EOF | ${FMT}
    864       1.2  christos     COMPATIBILITY: editing $config_directory/main.cf, setting
    865       1.2  christos     inet_protocols=ipv4.  Specify inet_protocols explicitly if you
    866       1.2  christos     want to enable IPv6.
    867       1.2  christos     In a future release IPv6 will be enabled by default.
    868       1.2  christos EOF
    869       1.2  christos 	$POSTCONF -c $config_directory inet_protocols=ipv4 || exit 1
    870       1.2  christos     }
    871       1.2  christos 
    872       1.2  christos # Disabled because unhelpful down-stream maintainers disable the safety net.
    873       1.2  christos #    # Postfix 2.10.
    874       1.2  christos #    # Safety net for incompatible changes due to the introduction
    875       1.2  christos #    # of the smtpd_relay_restrictions feature to separate the
    876       1.2  christos #    # mail relay policy from the spam blocking policy.
    877       1.2  christos #    # PLEASE DO NOT REMOVE THIS CODE. ITS PURPOSE IS TO PREVENT
    878       1.2  christos #    # INBOUND MAIL FROM UNEXPECTEDLY BOUNCING AFTER UPGRADING FROM
    879       1.2  christos #    # POSTFIX BEFORE 2.10.
    880       1.2  christos #    test -n "`$POSTCONF -c $config_directory -n smtpd_relay_restrictions`" || {
    881       1.2  christos #	cat <<EOF | ${FMT}
    882       1.2  christos #    COMPATIBILITY: editing $config_directory/main.cf, overriding
    883       1.2  christos #    smtpd_relay_restrictions to prevent inbound mail from
    884       1.2  christos #    unexpectedly bouncing.
    885       1.2  christos #    Specify an empty smtpd_relay_restrictions value to keep using 
    886       1.2  christos #    smtpd_recipient_restrictions as before.
    887       1.2  christos #EOF
    888       1.2  christos #	$POSTCONF -c $config_directory "smtpd_relay_restrictions = \
    889       1.2  christos #	    permit_mynetworks permit_sasl_authenticated \
    890       1.2  christos #	    defer_unauth_destination" || exit 1
    891       1.2  christos #    }
    892  1.2.14.1    martin 
    893  1.2.14.1    martin     # Postfix 3.4
    894  1.2.14.1    martin     # Add a postlog service entry.
    895  1.2.14.1    martin 
    896  1.2.14.1    martin     grep '^postlog' $config_directory/master.cf >/dev/null || {
    897  1.2.14.1    martin 	echo Editing $config_directory/master.cf, adding missing entry for postlog unix-domain datagram service
    898  1.2.14.1    martin 	cat >>$config_directory/master.cf <<EOF || exit 1
    899  1.2.14.1    martin postlog   unix-dgram n  -       n       -       1       postlogd
    900  1.2.14.1    martin EOF
    901  1.2.14.1    martin     }
    902       1.1      tron }
    903       1.1      tron 
    904       1.1      tron # A reminder if this is the first time Postfix is being installed.
    905       1.1      tron 
    906       1.1      tron test -n "$first_install_reminder" && {
    907       1.1      tron 
    908       1.1      tron     ALIASES=`$POSTCONF -c $config_directory -h alias_database | sed 's/^[^:]*://'`
    909       1.1      tron     NEWALIASES_PATH=`$POSTCONF -c $config_directory -h newaliases_path`
    910       1.1      tron     cat <<EOF | ${FMT}
    911       1.1      tron 
    912       1.1      tron     Warning: you still need to edit myorigin/mydestination/mynetworks
    913       1.1      tron     parameter settings in $config_directory/main.cf.
    914       1.1      tron 
    915       1.1      tron     See also http://www.postfix.org/STANDARD_CONFIGURATION_README.html
    916       1.1      tron     for information about dialup sites or about sites inside a
    917       1.1      tron     firewalled network.
    918       1.1      tron 
    919       1.1      tron     BTW: Check your $ALIASES file and be sure to set up aliases
    920       1.1      tron     that send mail for root and postmaster to a real person, then
    921       1.1      tron     run $NEWALIASES_PATH.
    922       1.1      tron 
    923       1.1      tron EOF
    924       1.1      tron 
    925       1.1      tron }
    926       1.1      tron 
    927       1.1      tron exit 0
    928