[postgresql] postgresql-setup: handle --version option earlier
Pavel Raiskup
praiskup at fedoraproject.org
Mon Jan 20 14:04:22 UTC 2014
commit 7df4c0e471c87a55c5e7b3d14404f11fb41a1427
Author: Pavel Raiskup <praiskup at redhat.com>
Date: Mon Jan 20 14:11:11 2014 +0100
postgresql-setup: handle --version option earlier
This generated the manual page badly before as the output of
--version option depended on system's postgresql.service (not
available at a build time). So handle options rather at the
beginning of the script.
Version: 9.3.2-5
postgresql-setup | 18 +++++++++++++-----
postgresql.spec | 5 ++++-
2 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/postgresql-setup b/postgresql-setup
index 80e2483..8a56028 100644
--- a/postgresql-setup
+++ b/postgresql-setup
@@ -55,6 +55,18 @@ Environment:
re-initialized from the old one.
PGSETUP_DEBUG Set to '1' if you want to see debugging output."
+# note that these options are useful at least for help2man processing
+case "$1" in
+ --version)
+ echo "postgresql-setup $PGVERSION"
+ exit 0
+ ;;
+ --help|--usage)
+ echo "$USAGE_STRING"
+ exit 0
+ ;;
+esac
+
# this parsing technique fails for PGDATA pathnames containing spaces,
# but there's not much I can do about it given systemctl's output format...
PGDATA=`systemctl show -p Environment "${SERVICE_NAME}.service" |
@@ -239,12 +251,8 @@ case "$1" in
upgrade)
upgrade
;;
- --version)
- # note that this output is at least useful for help2man processing
- echo "postgresql-setup $PGVERSION"
- ;;
*)
- echo "$USAGE_STRING"
+ echo >&2 "$USAGE_STRING"
exit 2
esac
diff --git a/postgresql.spec b/postgresql.spec
index 586b472..9eac6ce 100644
--- a/postgresql.spec
+++ b/postgresql.spec
@@ -64,7 +64,7 @@ Summary: PostgreSQL client programs
Name: postgresql
%global majorversion 9.3
Version: 9.3.2
-Release: 4%{?dist}
+Release: 5%{?dist}
# The PostgreSQL license is very similar to other MIT licenses, but the OSI
# recognizes it as an independent license, so we do as well.
@@ -1130,6 +1130,9 @@ fi
%endif
%changelog
+* Mon Jan 20 2014 Pavel Raiskup <praiskup at redhat.com> - 9.3.2-5
+- fix the postgresql-setup --version option
+
* Mon Jan 20 2014 Pavel Raiskup <praiskup at redhat.com> - 9.3.2-4
- postgresql-setup(upgrade): don't stop old server when it can not be started
- postgresql-setup(initdb, upgrade): add $PGSETUP_INITDB_OPTIONS
More information about the scm-commits
mailing list