diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2014-06-23 09:24:02 +0200 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2014-07-01 09:20:41 +0200 |
commit | 3768b99c83410e9744f35494624f41f78e5ab867 (patch) | |
tree | dac221c68c2bacf0adbddb8cd05471c65a0f8f42 | |
parent | 651b75248c77434e2960113dd2ab51a171e8be6b (diff) | |
download | postgresql-setup-3768b99c83410e9744f35494624f41f78e5ab867.tar.gz postgresql-setup-3768b99c83410e9744f35494624f41f78e5ab867.tar.xz postgresql-setup-3768b99c83410e9744f35494624f41f78e5ab867.zip |
docs: update option documentation and generate man
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | doc/Makefile.am | 7 | ||||
-rw-r--r-- | postgresql-setup.in | 43 |
6 files changed, 50 insertions, 11 deletions
@@ -10,3 +10,5 @@ missing *.log postgresql-setup INSTALL +postgresql-setup.1 +*.tar.gz @@ -1,3 +1,8 @@ +2014-06-23 Pavel Raiskup <praiskup@redhat.com> + docs: generate manual page + + The help2man utility is needed for man-page generation. + 2014-06-21 Pavel Raiskup <praiskup@redhat.com> postgresql-setup: do not resist on PGPORT in service file diff --git a/Makefile.am b/Makefile.am index ba79058..c197a0c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1 +1,3 @@ +SUBDIRS = . doc + bin_SCRIPTS = postgresql-setup diff --git a/configure.ac b/configure.ac index 5e2161e..c7eafb8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_INIT([postgresql-setup], [0.9], [praiskup@redhat.com]) AM_INIT_AUTOMAKE([-Wall]) -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile doc/Makefile]) AC_CONFIG_FILES([postgresql-setup], [chmod +x postgresql-setup]) # For SELinux purposes use rather runuser diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..c099ad8 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,7 @@ +HELP2MAN = $(SHELL) $(top_srcdir)/$(config_aux_dir)/missing --run help2man + +dist_man_MANS = $(srcdir)/postgresql-setup.1 + +$(srcdir)/postgresql-setup.1: $(top_srcdir)/postgresql-setup.in + @echo "Updating the man page '$@'"; \ + $(HELP2MAN) --output=$@ $(top_srcdir)/postgresql-setup -N diff --git a/postgresql-setup.in b/postgresql-setup.in index 1c66a2d..6cd9893 100644 --- a/postgresql-setup.in +++ b/postgresql-setup.in @@ -34,15 +34,15 @@ SYSCONFIG_DIR=@SYSCONFIG_DIR@ SU=@SU@ -USAGE_STRING=$" -Usage: $0 {initdb|upgrade} [--name SERVICE_NAME] +USAGE_STRING=$"\ +Usage: $0 MODE [OPTION...] [--unit UNIT_NAME] Script is aimed to help sysadmin with basic database cluster administration. -The SERVICE_NAME is used for selection of proper unit configuration file; For -more info and howto/when use this script please look at the docu file +The UNIT_NAME is used for selection of proper sysconfig or unit configuration +file; For more info and howto/when use this script please look at the docu file $README_DIST. The 'postgresql' -string is used when no SERVICE_NAME is explicitly passed. +string is used when no UNIT_NAME is explicitly passed. Available operation mode: --initdb Create a new PostgreSQL database cluster. This is usually the @@ -52,6 +52,12 @@ Available operation mode: newer major version (currently from $PREVMAJORVERSION \ to $PGMAJORVERSION). +Options: + --unit unit ID of PostgreSQL to run against + --help show this help + --version show version of this package + --debug show basic debugging information + Environment: PGSETUP_INITDB_OPTIONS Options carried by this variable are passed to subsequent call of \`initdb\` binary (see man @@ -64,6 +70,7 @@ Environment: pg_upgrade(1). PGSETUP_DEBUG Set to '1' if you want to see debugging output." + die() { echo >&2 $"FATAL: $@" ; exit 1 ; } error() { echo >&2 $"ERROR: $@" ; } error_q() { echo >&2 $" $@" ; } @@ -72,6 +79,14 @@ info() { echo >&2 $" * $@" ; } debug() { test "$option_debug" = "1" && echo >&2 $"DEBUG: $@"; } +print_version() +{ + echo "@PACKAGE@ @VERSION@" + echo $"Built against PostgreSQL version @PGMAJORVERSION@ and configured" + echo $"to upgrade from PostgreSQL version @PREVMAJORVERSION@." +} + + # code shared between initdb and upgrade actions perform_initdb() { @@ -338,31 +353,40 @@ case "$1" in initdb|upgrade) shift fi - set -- $additional_opts "$action" --service "$service" "$@" + set -- $additional_opts "$action" --unit "$service" "$@" warn "arguments transformed to: ${0##*/} $@" esac # </Compat> + +# postgresql-setup arguments are parsed into those variables option_mode=none option_service=postgresql option_port= option_debug=0 +# Content of /etc/sysconfig/$option_service fills those: sysconfig_pgdata= sysconfig_pgport= +# Configuration from (/etc/systemd/system/$option_service.service) fills those +# variables (this is here for compat, users should user rather sysconfig). unit_pgdata= unit_pgport= +# Configuration from postgresql.conf: conf_pgport= +# Key variables. Try to fill them postgresql.conf, sysconfig or unit file +# configuration (the later mentioned has more priority). pgdata=default pgport=default + short_opts="" long_opts="\ initdb,upgrade,\ -service:,port:,\ +unit:,service:,port:,\ debug,\ version,help,usage" @@ -382,7 +406,7 @@ while true; do shift ;; - --service) + --unit|--service) option_service=$2 shift 2 ;; @@ -403,7 +427,7 @@ while true; do ;; --version) - echo "postgresql-setup $PGVERSION" + print_version exit 0 ;; @@ -466,7 +490,6 @@ export PGPORT=$pgport script_result=0 - # See how we were called. case "$option_mode" in initdb) |