diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2014-01-20 14:11:11 +0100 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2014-01-20 15:03:32 +0100 |
commit | e9ece3556200013501706065351f1d850cdd603b (patch) | |
tree | efca6bacc83a91893dc16c88d23028438d11a057 | |
parent | 70a320b8bc4fb427465780f7112b7d899c18190a (diff) | |
download | postgresql-setup-e9ece3556200013501706065351f1d850cdd603b.tar.gz postgresql-setup-e9ece3556200013501706065351f1d850cdd603b.tar.xz postgresql-setup-e9ece3556200013501706065351f1d850cdd603b.zip |
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
-rw-r--r-- | postgresql-setup | 18 |
1 files changed, 13 insertions, 5 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 |