From 39fcc2e5c31f99da787fe23888e883b8055cb271 Mon Sep 17 00:00:00 2001
From: Wietse Venema (Specify "make makefiles shared=no" to explicitly disable Postfix
shared-library support). This installs shared libraries in $shlib_directory, typically,
-/usr/lib/postfix/version or /usr/local/lib/postfix/version,
-with names like libpostfix-name.so, where the name
-is a source-code directory name such as "util" or "global", and the
-version is the Postfix release version: x.y.z for
-stable releases, x.y-date for snapshot (development)
-releases, or x.y-date-nonprod for non-production
-releases. This installs shared libraries in $shlib_directory, typically
+/usr/lib/postfix or /usr/local/lib/postfix, with file names
+libpostfix-name.so, where the name is a source-code
+directory name such as "util" or "global", and the version
+is the Postfix release version: x.y.z for stable releases,
+x.y-date for snapshot (development) releases, or
+x.y-date-nonprod for non-production releases. See section 4.3.3 "Customizing Postfix shared libraries and
database plugins" below for how to customize the Postfix shared-library
-location and version.
+location and version, including support to upgrade a running mail
+system. If you intend to upgrade Postfix without stopping the mail
system, then you should append the Postfix release version to the
shlib_directory pathname, to eliminate the possibility that programs
-from the old Postfix version will link with files from the new
-Postfix version. For example: 4.3.2 Turning on Postfix
database-plugin support
@@ -371,8 +371,8 @@ $ make makefiles shared=yes shlib_dire
diff --git a/postfix/makedefs b/postfix/makedefs index c93af8fb2..94687094f 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -720,26 +720,14 @@ CCARGS="-I. -I../../include $CCARGS" # command-line arguments. In the specific example above, gmake would # eat up the "$" and "m" before it even invokes makedefs, and it # ould replace "'${mail_version}'" and "'$(mail_version)'" with -# nothing. +# nothing. # -# We could work around this by documenting that $$ must be used (and -# fix $$ in the case that people use traditional make). But this -# would be non-intuitive and bad from a usability point of view. -# -# We could work around this by documenting that people must pass -# name=value via the environment instead of the command line, as in -# "shlib_directory=/some/where/'$mail_version' make makefiles", or -# that they issue "export" or "setenv" commands depending on their -# interactive shell. That would be non-intuitive and bad usability. -# -# Even if we did any of the above, we would not want to pass the -# unexpanded $mail_version via CCARGS, because that requires extra -# quoting with `echo "$parm_val" | sed 's/[$]/\\\\$$/'` which is -# just too ugly to be portable. -# -# The upshot of all this is that we will expand MAIL_VERSION in the -# "make makefiles parameter=value" command line, and that we pass -# the expanded text via CCARGS. This is clumsier but cleaner. +# Requiring people to specify $$ is not a good option. Instead we +# replace the string MAIL_VERSION in "make makefiles name=value" +# parameter values with a form that depends on usage context: the +# actual release version in actual pathnames, the unexpanded +# $mail_version in main.cf parameter values and built-in default +# parameter settings. # Helper function to determine DEF_MAIL_VERSION. @@ -793,6 +781,22 @@ expand_mail_version() s/\$mail_version/$mail_version/g " } + +# Helper to invoke the above. global: parm_name, parm_val, cparm_val, CCARGS. + +process_input_parameter() +{ + case "$parm_val" in + *MAIL_VERSION*) + cparm_val=`echo "$parm_val"|sed 's/MAIL_VERSION/\\\\$$mail_version/g'`|| + exit 1 + parm_val=`expand_MAIL_VERSION "$parm_val"` || exit 1 + eval ${parm_name}=\""\$parm_val"\";; + *) cparm_val="$parm_val";; + esac + CCARGS="$CCARGS -D$parm_macro=\\\"$cparm_val\\\"" +} + # Optionally override installation-parameter default settings. command_directory_macro=DEF_COMMAND_DIR @@ -817,12 +821,7 @@ do eval parm_macro=\"\$${parm_name}_macro\" case "$parm_val" in "") ;; - /*) case "$parm_val" in - *MAIL_VERSION*) - parm_val=`expand_MAIL_VERSION "$parm_val"` || exit 1 - eval ${parm_name}=\""\$parm_val"\";; - esac - CCARGS="$CCARGS -D$parm_macro=\\\"$parm_val\\\"";; + /*) process_input_parameter;; *) error "$parm_name must specify an absolute path name";; esac done @@ -837,12 +836,7 @@ do eval parm_macro=\"\$${parm_name}_macro\" case "$parm_val" in "") ;; - /*|no) case "$parm_val" in - *MAIL_VERSION*) - parm_val=`expand_MAIL_VERSION "$parm_val"` || exit 1 - eval ${parm_name}=\""\$parm_val"\";; - esac - CCARGS="$CCARGS -D$parm_macro=\\\"$parm_val\\\"";; + /*|no) process_input_parameter;; *) error "$parm_name must specify \"no\" or an absolute path name";; esac done @@ -855,12 +849,7 @@ do eval parm_macro=\"\$${parm_name}_macro\" case "$parm_val" in "") ;; - *) case "$parm_val" in - *MAIL_VERSION*) - parm_val=`expand_MAIL_VERSION "$parm_val"` || exit 1 - eval ${parm_name}=\""\$parm_val"\";; - esac - CCARGS="$CCARGS -D$parm_macro=\\\"$parm_val\\\"";; + *) process_input_parameter;; esac done diff --git a/postfix/postfix-install b/postfix/postfix-install index 076fbb22b..e4bb6f942 100644 --- a/postfix/postfix-install +++ b/postfix/postfix-install @@ -493,7 +493,7 @@ test -f $CONFIG_DIRECTORY/main.cf && { case "$junk" in "") eval unset $name;; esac - eval : \${$name=\`bin/postconf -c $CONFIG_DIRECTORY -h $name\`} || + eval : \${$name=\`bin/postconf -c $CONFIG_DIRECTORY -hx $name\`} || exit 1 done } @@ -506,7 +506,7 @@ do case "$junk" in "") eval unset $name;; esac - eval : \${$name=\`bin/postconf -c conf -d -h $name\`} || exit 1 + eval : \${$name=\`bin/postconf -c conf -d -hx $name\`} || exit 1 done # Override settings manually. @@ -800,6 +800,23 @@ do # Postfix releases, and software should not suddenly be installed in # the wrong place when Postfix is being upgraded. +case "$mail_version" in +"") mail_version="`bin/postconf -dhx mail_version`" || exit 1 +esac + +# Undo MAIL_VERSION expansion. If someone really wants the expanded +# mail version in main.cf, we're sorry. + +for name in $CONFIG_PARAMS sample_directory +do + eval junk=\$$name + case "$junk" in + *"$mail_version"*) + val=`echo "$junk" | sed "s/$mail_version/"'$mail_version/g'` || exit 1 + eval ${name}='"$val"' + esac +done + bin/postconf -c $CONFIG_DIRECTORY -e \ "daemon_directory = $daemon_directory" \ "data_directory = $data_directory" \ diff --git a/postfix/proto/INSTALL.html b/postfix/proto/INSTALL.html index 695bba4fd..f1e3672bc 100644 --- a/postfix/proto/INSTALL.html +++ b/postfix/proto/INSTALL.html @@ -283,18 +283,18 @@ $ make(Specify "make makefiles shared=no" to explicitly disable Postfix shared-library support).
-This installs shared libraries in $shlib_directory, typically, -/usr/lib/postfix/version or /usr/local/lib/postfix/version, -with names like libpostfix-name.so, where the name -is a source-code directory name such as "util" or "global", and the -version is the Postfix release version: x.y.z for -stable releases, x.y-date for snapshot (development) -releases, or x.y-date-nonprod for non-production -releases.
+This installs shared libraries in $shlib_directory, typically +/usr/lib/postfix or /usr/local/lib/postfix, with file names +libpostfix-name.so, where the name is a source-code +directory name such as "util" or "global", and the version +is the Postfix release version: x.y.z for stable releases, +x.y-date for snapshot (development) releases, or +x.y-date-nonprod for non-production releases.
See section 4.3.3 "Customizing Postfix shared libraries and database plugins" below for how to customize the Postfix shared-library -location and version. +location, including support to upgrade a running mail system safely. +
4.3.2 Turning on Postfix database-plugin support
@@ -371,8 +371,8 @@ $ make makefiles shared=yes shlib_directory=/usr/local/lib/postfix ...If you intend to upgrade Postfix without stopping the mail system, then you should append the Postfix release version to the shlib_directory pathname, to eliminate the possibility that programs -from the old Postfix version will link with files from the new -Postfix version. For example:
+will link with shared libraries or database plugins from the wrong +Postfix version. For example:diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 8eddb1cab..9e345d80a 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -3794,7 +3794,7 @@ extern char *var_local_dsn_filter; */ #define VAR_SHLIB_DIR "shlib_directory" #ifndef DEF_SHLIB_DIR -#define DEF_SHLIB_DIR "/usr/lib/postfix/$mail_version" +#define DEF_SHLIB_DIR "/usr/lib/postfix" #endif extern char *var_shlib_dir; diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 977bb88e7..48a909033 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20140625" +#define MAIL_RELEASE_DATE "20140626" #define MAIL_VERSION_NUMBER "2.12" #ifdef SNAPSHOT