home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20110725.etc.tar.gz / bradford.20110725.etc.tar / etc / postfix / post-install < prev    next >
Text File  |  2006-05-02  |  22KB  |  698 lines

  1. #!/bin/sh
  2.  
  3. # To view the formatted manual page of this file, type:
  4. #    POSTFIXSOURCE/mantools/srctoman - post-install | nroff -man
  5.  
  6. #++
  7. # NAME
  8. #    post-install
  9. # SUMMARY
  10. #    Postfix post-installation script
  11. # SYNOPSIS
  12. #    post-install [name=value] command ...
  13. # DESCRIPTION
  14. #    The post-install script performs the finishing touch of a Postfix
  15. #    installation, after the executable programs and configuration
  16. #    files are installed. Usage is one of the following:
  17. # .IP o
  18. #    While installing Postfix from source code on the local machine, the
  19. #    script is run by the postfix-install script to update selected file
  20. #    or directory permissions and to update Postfix configuration files.
  21. # .IP o
  22. #    While installing Postfix from a pre-built package, the script is run
  23. #    by the package management procedure to set all file or directory
  24. #    permissions and to update Postfix configuration files.
  25. # .IP o
  26. #    The script can be used to change installation parameter settings such
  27. #    as mail_owner or setgid_group after Postfix is already installed.
  28. # .IP o
  29. #    The script can be used to upgrade configuration files and to upgrade
  30. #    file/directory permissions of a secondary Postfix instance.
  31. # .IP o
  32. #    At Postfix start-up time, the script is run from "postfix check" to
  33. #    create missing queue directories.
  34. # .PP
  35. #    The post-install script is controlled by installation parameters.
  36. #    Specific parameters are described at the end of this document.
  37. #    All installation parameters must be specified ahead of time via
  38. #    one of the methods described below.
  39. #
  40. #    Arguments
  41. # .IP create-missing
  42. #    Create missing queue directories with ownerships and permissions
  43. #    according to the contents of $config_directory/postfix-files, using
  44. #    the mail_owner and setgid_group parameter settings from the command
  45. #    line, process environment or from the installed main.cf file.
  46. #
  47. #    This is required at Postfix start-up time.
  48. # .IP set-permissions
  49. #    Set all file/directory ownerships and permissions according to the
  50. #    contents of $config_directory/postfix-files, using the mail_owner
  51. #    and setgid_group parameter settings from the command line, process
  52. #    environment or from the installed main.cf file. Implies create-missing.
  53. #
  54. #    This is required when installing Postfix from a pre-built package,
  55. #    or when changing the mail_owner or setgid_group installation parameter
  56. #    settings after Postfix is already installed.
  57. # .IP upgrade-permissions
  58. #    Update ownership and permission of existing files/directories as
  59. #    specified in $config_directory/postfix-files, using the mail_owner
  60. #    and setgid_group parameter settings from the command line, process
  61. #    environment or from the installed main.cf file. Implies create-missing.
  62. #
  63. #    This is required when upgrading an existing Postfix instance.
  64. # .IP upgrade-configuration
  65. #    Edit the installed main.cf and master.cf files, in order to account
  66. #    for missing services and to fix deprecated parameter settings.
  67. #
  68. #    This is required when upgrading an existing Postfix instance.
  69. # .IP upgrade-source
  70. #    Short-hand for: upgrade-permissions upgrade-configuration.
  71. #
  72. #    This is recommended when upgrading Postfix from source code.
  73. # .IP upgrade-package
  74. #    Short-hand for: set-permissions upgrade-configuration.
  75. #
  76. #    This is recommended when upgrading Postfix from a pre-built package.
  77. # .IP first-install-reminder
  78. #    Remind the user that they still need to configure main.cf and the
  79. #    aliases file, and that newaliases still needs to be run.
  80. #
  81. #    This is recommended when Postfix is installed for the first time.
  82. # MULTIPLE POSTFIX INSTANCES
  83. # .ad
  84. # .fi
  85. #    Multiple Postfix instances on the same machine can share command and
  86. #    daemon program files but must have separate configuration and queue
  87. #    directories.
  88. #
  89. #    To create a secondary Postfix installation on the same machine,
  90. #    copy the configuration files from the primary Postfix instance to
  91. #    a secondary configuration directory and execute:
  92. #
  93. #    post-install config_directory=secondary-config-directory \e
  94. # .in +4
  95. #        queue_directory=secondary-queue-directory \e
  96. # .br
  97. #        create-missing
  98. # .PP
  99. #    This creates secondary Postfix queue directories, sets their access
  100. #    permissions, and saves the specified installation parameters to the
  101. #    secondary main.cf file.
  102. #
  103. #    Be sure to list the secondary configuration directory in the
  104. #    alternate_config_directories parameter in the primary main.cf file.
  105. #
  106. #    To upgrade a secondary Postfix installation on the same machine,
  107. #    execute:
  108. #
  109. #    post-install config_directory=secondary-config-directory \e
  110. # .in +4
  111. #        upgrade-permissions upgrade-configuration
  112. # INSTALLATION PARAMETER INPUT METHODS
  113. # .ad
  114. # .fi
  115. #    Parameter settings can be specified through a variety of
  116. #    mechanisms.  In order of decreasing precedence these are:
  117. # .IP "command line"
  118. #    Parameter settings can be given as name=value arguments on
  119. #    the post-install command line. These have the highest precedence.
  120. #    Settings that override the installed main.cf file are saved.
  121. # .IP "process environment"
  122. #    Parameter settings can be given as name=value environment
  123. #    variables.
  124. #    Settings that override the installed main.cf file are saved.
  125. # .IP "installed configuration files"
  126. #    If a parameter is not specified via the command line or via the
  127. #    process environment, post-install will attempt to extract its
  128. #    value from the already installed Postfix main.cf configuration file.
  129. #    These settings have the lowest precedence.
  130. # INSTALLATION PARAMETER DESCRIPTION
  131. # .ad
  132. # .fi
  133. #    The description of installation parameters is as follows:
  134. # .IP config_directory
  135. #    The directory for Postfix configuration files.
  136. # .IP daemon_directory
  137. #    The directory for Postfix daemon programs. This directory
  138. #    should not be in the command search path of any users.
  139. # .IP command_directory
  140. #    The directory for Postfix administrative commands. This
  141. #    directory should be in the command search path of adminstrative users.
  142. # .IP queue_directory
  143. #    The directory for Postfix queues.
  144. # .IP sendmail_path
  145. #    The full pathname for the Postfix sendmail command.
  146. #    This is the Sendmail-compatible mail posting interface.
  147. # .IP newaliases_path
  148. #    The full pathname for the Postfix newaliases command.
  149. #    This is the Sendmail-compatible command to build alias databases
  150. #    for the Postfix local delivery agent.
  151. # .IP mailq_path
  152. #    The full pathname for the Postfix mailq command.
  153. #    This is the Sendmail-compatible command to list the mail queue.
  154. # .IP mail_owner
  155. #    The owner of the Postfix queue. Its numerical user ID and group ID
  156. #    must not be used by any other accounts on the system.
  157. # .IP setgid_group
  158. #    The group for mail submission and for queue management commands.
  159. #    Its numerical group ID must not be used by any other accounts on the
  160. #    system, not even by the mail_owner account.
  161. # .IP html_directory
  162. #    The directory for the Postfix HTML files.
  163. # .IP manpage_directory
  164. #    The directory for the Postfix on-line manual pages.
  165. # .IP sample_directory
  166. #    The directory for the Postfix sample configuration files.
  167. # .IP readme_directory
  168. #    The directory for the Postfix README files.
  169. # SEE ALSO
  170. #    postfix-install(1) Postfix primary installation script.
  171. # FILES
  172. #    $config_directory/main.cf, Postfix installation parameters.
  173. #    $config_directory/postfix-files, installation control file.
  174. #    $config_directory/install.cf, obsolete configuration file.
  175. # LICENSE
  176. # .ad
  177. # .fi
  178. #    The Secure Mailer license must be distributed with this software.
  179. # AUTHOR(S)
  180. #    Wietse Venema
  181. #    IBM T.J. Watson Research
  182. #    P.O. Box 704
  183. #    Yorktown Heights, NY 10598, USA
  184. #--
  185.  
  186. umask 022
  187.  
  188. PATH=/bin:/usr/bin:/usr/sbin:/usr/etc:/sbin:/etc:/usr/contrib/bin:/usr/gnu/bin:/usr/ucb:/usr/bsd
  189. SHELL=/bin/sh
  190. IFS="     
  191. "
  192. BACKUP_IFS="$IFS"
  193.  
  194. USAGE="Usage: $0 [name=value] command
  195.     create-missing          Create missing queue directories.
  196.     upgrade-source          When installing or upgrading from source code.
  197.     upgrade-package         When installing or upgrading from pre-built package.
  198.     first-install-reminder  Remind of mandatory first-time configuration steps.
  199.     name=value              Specify an installation parameter".
  200.  
  201. # Process command-line options and parameter settings. Work around
  202. # brain damaged shells. "IFS=value command" should not make the
  203. # IFS=value setting permanent. But some broken standard allows it.
  204.  
  205. create=; set_perms=; upgrade_perms=; upgrade_conf=; first_install_reminder=
  206. obsolete=; keep_list=;
  207.  
  208. for arg
  209. do
  210.     case $arg in
  211.                 *=*) IFS= eval $arg; IFS="$BACKUP_IFS";;
  212.      create-missing) create=1;;
  213.       set-perm*) create=1; set_perms=1;;
  214.       upgrade-perm*) create=1; upgrade_perms=1;;
  215.       upgrade-conf*) upgrade_conf=1;;
  216.      upgrade-source) create=1; upgrade_conf=1; upgrade_perms=1;;
  217.     upgrade-package) create=1; upgrade_conf=1; set_perms=1;;
  218.      first-install*) first_install_reminder=1;;
  219.           *) echo "$0: Error: $USAGE" 1>&2; exit 1;;
  220.     esac
  221.     shift
  222. done
  223.  
  224. # Sanity checks.
  225.  
  226. test -n "$create$upgrade_conf$first_install_reminder" || {
  227.     echo "$0: Error: $USAGE" 1>&2
  228.     exit 1
  229. }
  230.  
  231. # Bootstrapping problem.
  232.  
  233. if [ -n "$command_directory" ]
  234. then
  235.     POSTCONF="$command_directory/postconf"
  236. else
  237.     POSTCONF="postconf"
  238. fi
  239.  
  240. $POSTCONF -d mail_version >/dev/null 2>/dev/null || {
  241.     echo $0: Error: no $POSTCONF command found. 1>&2
  242.     echo Re-run this command as $0 command_directory=/some/where. 1>&2
  243.     exit 1
  244. }
  245.  
  246. test -n "$config_directory" ||
  247.     config_directory=`$POSTCONF -d -h config_directory` || exit 1
  248.  
  249. test -d "$config_directory" || {
  250.     echo $0: Error: $config_directory is not a directory. 1>&2
  251.     exit 1
  252. }
  253.  
  254. test -f $config_directory/postfix-files || {
  255.     echo $0: Error: $config_directory/postfix-files is not a file. 1>&2
  256.     exit 1
  257. }
  258.  
  259. # SunOS5 fmt(1) truncates lines > 1000 characters.
  260.  
  261. fake_fmt() {
  262.     sed '
  263.     :top
  264.     /^\(  *\)\([^ ][^ ]*\)  */{
  265.         s//\1\2\
  266. \1/
  267.         P
  268.         D
  269.         b top
  270.     }
  271.     ' | fmt
  272. }
  273.  
  274. case `uname -s` in
  275. HP-UX*) FMT=cat;;
  276. SunOS*) FMT=fake_fmt;;
  277.      *) FMT=fmt;;
  278. esac
  279.  
  280. # If a parameter is not set via the command line or environment,
  281. # try to use settings from installed configuration files.
  282.  
  283. # Extract parameter settings from the obsolete install.cf file, as
  284. # a transitional aid.
  285.  
  286. grep setgid_group $config_directory/main.cf >/dev/null 2>&1 || {
  287.     test -f $config_directory/install.cf  && {
  288.         for name in sendmail_path newaliases_path mailq_path setgid manpages
  289.         do
  290.     eval junk=\$$name
  291.         case "$junk" in
  292.         "") eval unset $name;;
  293.         esac
  294.        eval : \${$name="\`. $config_directory/install.cf; echo \$$name\`"} \
  295.         || exit 1
  296.         done
  297.         : ${setgid_group=$setgid}
  298.         : ${manpage_directory=$manpages}
  299.     }
  300. }
  301.  
  302. # Extract parameter settings from the installed main.cf file.
  303.  
  304. test -f $config_directory/main.cf && {
  305.     for name in daemon_directory command_directory queue_directory mail_owner \
  306.         setgid_group sendmail_path newaliases_path mailq_path \
  307.     html_directory manpage_directory sample_directory readme_directory
  308.     do
  309.     eval junk=\$$name
  310.         case "$junk" in
  311.         "") eval unset $name;;
  312.         esac
  313.         eval : \${$name=\`$POSTCONF -c $config_directory -h $name\`} || exit 1
  314.     done
  315. }
  316.  
  317. # Sanity checks
  318.  
  319. case $manpage_directory in
  320.  no) echo $0: Error: manpage_directory no longer accepts \"no\" values. 1>&2
  321.      echo Try again with \"$0 manpage_directory=/pathname ...\". 1>&2; exit 1;;
  322. esac
  323.  
  324. case $setgid_group in
  325.  no) echo $0: Error: setgid_group no longer accepts \"no\" values. 1>&2
  326.      echo Try again with \"$0 setgid_group=groupname ...\" 1>&2; exit 1;;
  327. esac
  328.  
  329. for path in "$daemon_directory" "$command_directory" "$queue_directory" \
  330.     "$sendmail_path" "$newaliases_path" "$mailq_path" "$manpage_directory"
  331. do
  332.    case "$path" in
  333.    /*) ;;
  334.     *) echo $0: Error: \"$path\" should be an absolute path name. 1>&2; exit 1;;
  335.    esac
  336. done
  337.  
  338. for path in "$html_directory" "$readme_directory"
  339. do
  340.    case "$path" in
  341.    /*) ;;
  342.    no) ;;
  343.     *) echo $0: Error: \"$path\" should be \"no\" or an absolute path name. 1>&2; exit 1;;
  344.    esac
  345. done
  346.  
  347. # Find out what parameters were not specified via command line,
  348. # via environment, or via installed configuration files.
  349.  
  350. missing=
  351. for name in daemon_directory command_directory queue_directory mail_owner \
  352.     setgid_group sendmail_path newaliases_path mailq_path manpage_directory \
  353.     readme_directory html_directory
  354. do
  355.     eval test -n \"\$$name\" || missing="$missing $name"
  356. done
  357.  
  358. # All parameters must be specified at this point.
  359.  
  360. test -n "$non_interactive" -a -n "$missing" && {
  361.     cat <<EOF | ${FMT} 1>&2
  362. $0: Error: some required installation parameters are not defined.
  363.  
  364. - Either the parameters need to be given in the $config_directory/main.cf
  365. file from a recent Postfix installation,
  366.  
  367. - Or the parameters need to be specified through the process
  368. environment.
  369.  
  370. - Or the parameters need to be specified as name=value arguments
  371. on the $0 command line,
  372.  
  373. The following parameters were missing:
  374.  
  375.     $missing
  376.  
  377. EOF
  378.     exit 1
  379. }
  380.  
  381. POSTCONF="$command_directory/postconf"
  382.  
  383. # Save settings, allowing command line/environment override.
  384.  
  385. override=
  386. for name in daemon_directory command_directory queue_directory mail_owner \
  387.     setgid_group sendmail_path newaliases_path mailq_path manpage_directory \
  388.     sample_directory readme_directory html_directory
  389. do
  390.     eval test \"\$$name\" = \"`$POSTCONF -c $config_directory -h $name`\" || {
  391.     override=1
  392.     break
  393.     }
  394. done
  395.  
  396. test -n "$override" && {
  397.     $POSTCONF -c $config_directory -e \
  398.     "daemon_directory = $daemon_directory" \
  399.     "command_directory = $command_directory" \
  400.     "queue_directory = $queue_directory" \
  401.     "mail_owner = $mail_owner" \
  402.     "setgid_group = $setgid_group" \
  403.     "sendmail_path = $sendmail_path" \
  404.     "mailq_path = $mailq_path" \
  405.     "newaliases_path = $newaliases_path" \
  406.     "html_directory = $html_directory" \
  407.     "manpage_directory = $manpage_directory" \
  408.     "sample_directory = $sample_directory" \
  409.     "readme_directory = $readme_directory" \
  410.     || exit 1
  411. }
  412.  
  413. # Use file/directory status information in $config_directory/postfix-files.
  414.  
  415. test -n "$create" && {
  416.     exec <$config_directory/postfix-files || exit 1
  417.     while IFS=: read path type owner group mode flags junk
  418.     do
  419.     IFS="$BACKUP_IFS"
  420.     set_permission=
  421.     # Skip comments.
  422.     case $path in
  423.     [$]*) ;;
  424.        *) continue;;
  425.     esac
  426.     # Skip hard links and symbolic links.
  427.     case $type in
  428.     [hl]) continue;;
  429.     [df]) ;;
  430.        *) echo unknown type $type for $path in $config_directory/postfix-files1>&2; exit 1;;
  431.     esac
  432.     # Expand $name, and canonicalize null fields.
  433.     for name in path owner group flags
  434.     do
  435.         eval junk=\${$name}
  436.         case $junk in
  437.         [$]*) eval $name=$junk;;
  438.            -) eval $name=;;
  439.            *) ;;
  440.         esac
  441.     done
  442.     # Skip uninstalled files.
  443.     case $path in
  444.     no|no/*) continue;;
  445.     esac
  446.     # Pick up the flags.
  447.     case $flags in *u*) upgrade_flag=1;; *) upgrade_flag=;; esac
  448.     case $flags in *c*) create_flag=1;; *) create_flag=;; esac
  449.     case $flags in *r*) recursive="-R";; *) recursive=;; esac
  450.     case $flags in *o*) obsolete_flag=1;; *) obsolete_flag=;; esac
  451.     # Flag obsolete objects. XXX Solaris 2..9 does not have "test -e".
  452.     if [ -n "$obsolete_flag" ]
  453.     then
  454.         test -r $path -a "$type" != "d" && obsolete="$obsolete $path"
  455.         continue;
  456.     else
  457.         keep_list="$keep_list $path"
  458.     fi
  459.     # Create missing directories with proper owner/group/mode settings.
  460.     if [ -n "$create" -a "$type" = "d" -a -n "$create_flag" -a ! -d "$path" ]
  461.     then
  462.         mkdir $path || exit 1
  463.         set_permission=1
  464.     # Update all owner/group/mode settings.
  465.     elif [ -n "$set_perms" ]
  466.     then
  467.         set_permission=1
  468.     # Update obsolete owner/group/mode settings.
  469.     elif [ -n "$upgrade_perms" -a -n "$upgrade_flag" ]
  470.     then
  471.         set_permission=1
  472.     fi
  473.     test -n "$set_permission" && {
  474.         chown $recursive $owner $path || exit 1
  475.         test -z "$group" || chgrp $recursive $group $path || exit 1
  476.         if [ "$type" = "d" -a -n "$recursive" ]
  477.         then
  478.         find $path -type d -exec chmod $mode "{}" ";"
  479.         else
  480.         chmod $mode $path
  481.         fi || exit 1
  482.     }
  483.     done
  484.     IFS="$BACKUP_IFS"
  485. }
  486.  
  487. # Upgrade existing Postfix configuration files if necessary.
  488.  
  489. test -n "$upgrade_conf" && {
  490.  
  491.     # Add missing relay service to master.cf.
  492.  
  493.     grep '^relay' $config_directory/master.cf >/dev/null || {
  494.     echo Editing $config_directory/master.cf, adding missing entry for relay service
  495.     cat >>$config_directory/master.cf <<EOF || exit 1
  496. relay      unix    -    -    n    -    -    smtp
  497. EOF
  498.     }
  499.  
  500.     # Add missing flush service to master.cf.
  501.  
  502.     grep '^flush.*flush' $config_directory/master.cf >/dev/null || {
  503.     echo Editing $config_directory/master.cf, adding missing entry for flush service
  504.     cat >>$config_directory/master.cf <<EOF || exit 1
  505. flush     unix  -       -       n       1000?   0       flush
  506. EOF
  507.     }
  508.  
  509.     # Add missing trace service to master.cf.
  510.  
  511.     grep 'trace.*bounce' $config_directory/master.cf >/dev/null || {
  512.     echo Editing $config_directory/master.cf, adding missing entry for trace service
  513.     cat >>$config_directory/master.cf <<EOF || exit 1
  514. trace      unix    -    -    n    -    0    bounce
  515. EOF
  516.     }
  517.  
  518.     # Add missing verify service to master.cf.
  519.  
  520.     grep '^verify.*verify' $config_directory/master.cf >/dev/null || {
  521.     echo Editing $config_directory/master.cf, adding missing entry for verify service
  522.     cat >>$config_directory/master.cf <<EOF || exit 1
  523. verify      unix    -    -    n    -    1    verify
  524. EOF
  525.     }
  526.  
  527.     # Fix verify service process limit.
  528.  
  529.     grep '^verify.*[     ]0[     ]*verify' \
  530.     $config_directory/master.cf >/dev/null && {
  531.         echo Editing $config_directory/master.cf, setting verify process limit to 1
  532.         ed $config_directory/master.cf <<EOF || exit 1
  533. /^verify.*[     ]0[     ]*verify/
  534. s/\([     ]\)0\([     ]\)/\11\2/
  535. p
  536. w
  537. q
  538. EOF
  539.     }
  540.  
  541.     # Change privileged pickup service into unprivileged.
  542.  
  543.     grep "^pickup[     ]*fifo[     ]*n[     ]*n" \
  544.     $config_directory/master.cf >/dev/null && {
  545.         echo Editing $config_directory/master.cf, making the pickup service unprivileged
  546.         ed $config_directory/master.cf <<EOF || exit 1
  547. /^pickup[     ]*fifo[     ]*n[     ]*n/
  548. s/\(n[     ]*\)n/\1-/
  549. p
  550. w
  551. q
  552. EOF
  553.     }
  554.  
  555.     # Change private cleanup and flush services into public.
  556.  
  557.     for name in cleanup flush
  558.     do
  559.     grep "^$name[     ]*unix[     ]*[-y]" \
  560.         $config_directory/master.cf >/dev/null && {
  561.         echo Editing $config_directory/master.cf, making the $name service public
  562.         ed $config_directory/master.cf <<EOF || exit 1
  563. /^$name[     ]*unix[     ]*[-y]/
  564. s/[-y]/n/
  565. p
  566. w
  567. q
  568. EOF
  569.     }
  570.     done
  571.  
  572.     # File systems have improved since Postfix came out, and all we
  573.     # require now is that defer and deferred are hashed because those
  574.     # can contain lots of files.
  575.  
  576.     found=`$POSTCONF -c $config_directory -h hash_queue_names`
  577.     missing=
  578.     (echo "$found" | grep defer >/dev/null)  || missing="$missing defer"
  579.     (echo "$found" | grep deferred>/dev/null)|| missing="$missing deferred"
  580.     test -n "$missing" && {
  581.     echo fixing main.cf hash_queue_names for missing $missing
  582.     $POSTCONF -c $config_directory -e hash_queue_names="$found$missing" ||
  583.         exit 1
  584.     }
  585.  
  586.     # Turn on safety nets for new features that could bounce mail that
  587.     # would be accepted by a previous Postfix version.
  588.     # This safety net is also documented in LOCAL_RECIPIENT_README.
  589.  
  590.     unknown_local=unknown_local_recipient_reject_code
  591.     has_lrm=`$POSTCONF -n local_recipient_maps`
  592.     has_lrjc=`$POSTCONF -n $unknown_local`
  593.  
  594.     if [ -z "$has_lrm" -a -z "$has_lrjc" ]
  595.     then
  596.     echo SAFETY: editing main.cf, setting $unknown_local=450.
  597.     echo See the LOCAL_RECIPIENT_README file for details.
  598.     $POSTCONF -e "$unknown_local = 450" || exit 1
  599.     fi
  600.  
  601.     # Add missing proxymap service to master.cf.
  602.  
  603.     grep '^proxymap.*proxymap' $config_directory/master.cf >/dev/null || {
  604.     echo Editing $config_directory/master.cf, adding missing entry for proxymap service
  605.     cat >>$config_directory/master.cf <<EOF || exit 1
  606. proxymap  unix    -    -    n    -    -    proxymap
  607. EOF
  608.     }
  609.  
  610.     # Add missing anvil service to master.cf.
  611.  
  612.     grep '^anvil.*anvil' $config_directory/master.cf >/dev/null || {
  613.     echo Editing $config_directory/master.cf, adding missing entry for anvil service
  614.     cat >>$config_directory/master.cf <<EOF || exit 1
  615. anvil      unix    -    -    n    -    1    anvil
  616. EOF
  617.     }
  618.  
  619.     # Add missing scache service to master.cf.
  620.  
  621.     grep '^scache.*scache' $config_directory/master.cf >/dev/null || {
  622.     echo Editing $config_directory/master.cf, adding missing entry for scache service
  623.     cat >>$config_directory/master.cf <<EOF || exit 1
  624. scache      unix    -    -    n    -    1    scache
  625. EOF
  626.     }
  627.  
  628.     # Add missing discard service to master.cf.
  629.  
  630.     grep '^discard.*discard' $config_directory/master.cf >/dev/null || {
  631.     echo Editing $config_directory/master.cf, adding missing entry for discard service
  632.     cat >>$config_directory/master.cf <<EOF || exit 1
  633. discard      unix    -    -    n    -    -    discard
  634. EOF
  635.     }
  636.  
  637.     # Update the tlsmgr fifo->unix service.
  638.  
  639.     grep "^tlsmgr[     ]*fifo[     ]" \
  640.     $config_directory/master.cf >/dev/null && {
  641.         echo Editing $config_directory/master.cf, updating the tlsmgr from fifo to unix service
  642.         ed $config_directory/master.cf <<EOF || exit 1
  643. /^tlsmgr[     ]*fifo[     ]/
  644. s/fifo/unix/
  645. p
  646. w
  647. q
  648. EOF
  649.     }
  650.  
  651.     # Add missing tlsmgr service to master.cf.
  652.  
  653.     grep '^tlsmgr.*tlsmgr' $config_directory/master.cf >/dev/null || {
  654.     echo Editing $config_directory/master.cf, adding missing entry for tlsmgr service
  655.     cat >>$config_directory/master.cf <<EOF || exit 1
  656. tlsmgr    unix  -       -       n       1000?   1       tlsmgr
  657. EOF
  658.     }
  659.  
  660.     # Report (but do not remove) obsolete files.
  661.  
  662.     test -n "$obsolete" && {
  663.     cat <<EOF | ${FMT}
  664.  
  665.     Note: the following files or directories still exist but are
  666.     no longer part of Postfix:
  667.  
  668.     $obsolete
  669.  
  670. EOF
  671.     }
  672.  
  673. }
  674.  
  675. # A reminder if this is the first time Postfix is being installed.
  676.  
  677. test -n "$first_install_reminder" && {
  678.  
  679.     ALIASES=`$POSTCONF -h alias_database | sed 's/^[^:]*://'`
  680.     NEWALIASES_PATH=`$POSTCONF -h newaliases_path`
  681.     cat <<EOF | ${FMT}
  682.  
  683.     Warning: you still need to edit myorigin/mydestination/mynetworks
  684.     parameter settings in $config_directory/main.cf.
  685.  
  686.     See also http://www.postfix.org/faq.html for information about
  687.     dialup sites or about sites inside a firewalled network.
  688.  
  689.     BTW: Check your $ALIASES file and be sure to set up aliases
  690.     that send mail for root and postmaster to a real person, then
  691.     run $NEWALIASES_PATH.
  692.  
  693. EOF
  694.  
  695. }
  696.  
  697. exit 0
  698.