summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2014-12-18 17:41:01 +0100
committerPavel Raiskup <praiskup@redhat.com>2014-12-18 17:53:01 +0100
commitcedcdd82b7cd87371e938ab1cfbbfdce8b9b637c (patch)
treefae2fc455efa2a990fe271c0c73730f58455f8f3
parente8c705cc6bafda2e155ce0edf9df5dfcc0316d6c (diff)
downloadpostgresql-setup-cedcdd82b7cd87371e938ab1cfbbfdce8b9b637c.tar.gz
postgresql-setup-cedcdd82b7cd87371e938ab1cfbbfdce8b9b637c.tar.xz
postgresql-setup-cedcdd82b7cd87371e938ab1cfbbfdce8b9b637c.zip
postgresql-setup: use --username for pg_upgrade 9.4+
The --user option still works but we should be rather careful for the future. Master only. References: http://www.postgresql.org/docs/9.4/static/release-9-4.html * configure.ac (AC_INIT): Bump to 3.0~dev version. (PG_UPGRADE_BIN_USER_OPT): New variable carrying the right format of pg_upgrade's username option. * postgresql-setup.in (upgrade): Use @PG_UPGRADE_BIN_USER_OPT@.
-rw-r--r--configure.ac11
-rw-r--r--postgresql-setup.in2
2 files changed, 10 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index b480210..6b2cfb0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,5 @@
-AC_INIT([postgresql-setup], [2.0], [praiskup@redhat.com])
+# Use the MAJ.MIN[~SUFF]. Note that X.X > X.X~SUFF!
+AC_INIT([postgresql-setup], [3.0~dev], [praiskup@redhat.com])
AC_CONFIG_AUX_DIR(auxdir)
config_aux_dir=auxdir
AC_SUBST([config_aux_dir])
@@ -45,8 +46,9 @@ sed_subst_var_pattern(pgcontribdocdir)
sed_subst_var_pattern(PGDATADIR)
sed_subst_var_pattern(pgdocdir)
sed_subst_var_pattern(PGENGINE)
-sed_subst_var_pattern(PGVERSION)
sed_subst_var_pattern(PGMAJORVERSION)
+sed_subst_var_pattern(PG_UPGRADE_BIN_USER_OPT)
+sed_subst_var_pattern(PGVERSION)
sed_subst_var_pattern(PKGCONFIG_DIR)
sed_subst_var_pattern(pkgname)
sed_subst_var_pattern(POSTGRES_HOMEDIR)
@@ -104,6 +106,11 @@ if test -z "$PGVERSION" -a -z "$PGMAJORVERSION"; then
PGMAJORVERSION=${PGVERSION%%.[[0-9]]}
fi
+AX_COMPARE_VERSION([9.4], [lt], [$PGVERSION],
+ [PG_UPGRADE_BIN_USER_OPT="--username"],
+ [PG_UPGRADE_BIN_USER_OPT="--user"])
+AC_SUBST([PG_UPGRADE_BIN_USER_OPT])
+
# detect PGENGINE location (where the binaries are), if needed
if test -z "$PGENGINE"; then
test -z "$ac_cv_path_POSTGRES_BIN" &&
diff --git a/postgresql-setup.in b/postgresql-setup.in
index 608b11d..17a14f0 100644
--- a/postgresql-setup.in
+++ b/postgresql-setup.in
@@ -228,7 +228,7 @@ upgrade()
'--new-datadir=$pgdata' \
--link \
'--old-port=$PGPORT' '--new-port=$PGPORT' \
- --user=postgres \
+ @PG_UPGRADE_BIN_USER_OPT@=postgres \
$PGSETUP_PGUPGRADE_OPTIONS" \
>> "$upgrade_log" 2>&1 < /dev/null
if [ $? -ne 0 ]; then