summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2016-07-22 08:20:28 +0200
committerPavel Raiskup <praiskup@redhat.com>2016-07-22 08:20:28 +0200
commit3fcfb0e1f4cf535ce3356ecef32a21a9e9fc27b5 (patch)
tree21edbc3325b8df4933e943d257e685862ff890ae
parent300dc14017f27bc2ea79c0bb01a627d84d7790f6 (diff)
downloadpostgresql-setup-3fcfb0e1f4cf535ce3356ecef32a21a9e9fc27b5.tar.gz
postgresql-setup-3fcfb0e1f4cf535ce3356ecef32a21a9e9fc27b5.tar.xz
postgresql-setup-3fcfb0e1f4cf535ce3356ecef32a21a9e9fc27b5.zip
Move the repo to github.HEADmaster
-rw-r--r--AUTHORS5
-rw-r--r--COPYING18
-rw-r--r--Makefile.am163
-rw-r--r--NEWS162
-rw-r--r--README16
-rw-r--r--README.rpm-dist.template648
-rw-r--r--THANKS3
-rw-r--r--TODO35
-rwxr-xr-xauxdir/install_local10
-rw-r--r--configure.ac186
-rw-r--r--doc/.gitignore1
-rw-r--r--doc/Makefile.am30
-rw-r--r--etc/postgresql-setup/upgrade/postgresql.conf31
-rw-r--r--legacy-sysv-script.in6
-rw-r--r--m4/_ax_text_tpl.m4163
-rw-r--r--m4/packaging.m444
-rw-r--r--postgresql-check-db-dir.in104
-rw-r--r--postgresql-ctl.in31
-rw-r--r--postgresql-setup.in826
-rw-r--r--postgresql.init.in287
-rw-r--r--postgresql.service.in50
-rw-r--r--share/postgresql-setup/.gitignore2
-rw-r--r--share/postgresql-setup/Makefile.inc21
-rw-r--r--share/postgresql-setup/library.sh.in139
-rw-r--r--style.dsl15
-rw-r--r--tests/Makefile.am45
-rw-r--r--tests/atlocal.in1
-rw-r--r--tests/testsuite.at36
28 files changed, 1 insertions, 3077 deletions
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index eafb7c6..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,5 +0,0 @@
-Devrim GÜNDÜZ
-Honza Horák
-Tom Lane
-Jozef Mlích
-Pavel Raiskup
diff --git a/COPYING b/COPYING
deleted file mode 100644
index c0cecad..0000000
--- a/COPYING
+++ /dev/null
@@ -1,18 +0,0 @@
-Portions Copyright (c) 2011-2014, Red Hat Inc.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose, without fee, and without a written agreement
-is hereby granted, provided that the above copyright notice and this
-paragraph and the following two paragraphs appear in all copies.
-
-IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
-DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
-LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
-DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
-PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 6b7fa10..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,163 +0,0 @@
-setup = $(NAME_BINARYBASE)-setup
-setup_in = postgresql-setup.in
-
-ctl = $(NAME_BINARYBASE)-ctl
-ctl_in = postgresql-ctl.in
-
-checkdb = $(NAME_BINARYBASE)-check-db-dir
-checkdb_in = postgresql-check-db-dir.in
-
-service = $(NAME_SERVICE).service
-service_in = postgresql.service.in
-serviceat = $(NAME_SERVICE)@.service
-serviceat_in = postgresql.service.in
-
-initscript = initscript
-initscript_in = postgresql.init.in
-
-readme_dist = README.rpm-dist
-readme_dist_db = README.rpm-dist.sgml
-readme_dist_m4 = README.rpm-dist.m4
-readme_dist_sed = README.rpm-dist.sed
-readme_template = README.rpm-dist.template
-
-EXTRA_DIST =
-INTERMEDIATE_FILES =
-GENERATED_FILES =
-CLEANFILES =
-
-# include $(srcdir)/build-helpers/Makefile.inc
-
-SUBDIRS = . doc tests
-
-bin_SCRIPTS = $(setup)
-libexec_SCRIPTS = $(ctl) $(checkdb)
-
-legacyscriptsdir = $(systemdlegacyscriptsdir)/$(NAME_SERVICE)
-
-noinst_DATA =
-
-# TODO: Ideally, 'make distcheck' should check every file we generate.
-if WANT_SYSVINIT
-noinst_DATA += $(initscript)
-GENERATED_FILES += $(initscript)
-else
-systemdunits_DATA = $(service) $(serviceat)
-legacyscripts_SCRIPTS = initdb upgrade
-endif
-
-pgdoc_DATA = $(readme_dist)
-
-noinst_DATA += $(TEST_GEN_FILES_LIST)
-
-$(ctl): $(ctl_in) $(c_s)
- $(text_tpl_gen_script)
-
-$(setup): $(setup_in) $(c_s)
- $(text_tpl_gen_script)
-
-$(checkdb): $(check) $(checkdb_in) $(c_s)
- $(text_tpl_gen_script)
-
-$(initscript): $(initscript_in) $(c_s)
- $(text_tpl_gen_script)
-
-initdb upgrade: legacy-sysv-script.in $(c_s)
- $(text_tpl_gen_script)
-
-# In ideal world, postgresql@.service would be hardlink to postgresql.service.
-# That would require, however, the rhbz#1141824 resolved so we could install
-# system-default drop-in file. Make a "almost" duplicate files now.
-
-$(serviceat): $(serviceat_in) $(c_s)
- $(AM_V_GEN)\
- ax_text_add_sed_substs="-e /@PGDATA_ENVIRONMENT[@]/d" ; \
- $(text_tpl_gen_verbose)
-
-$(service): $(service_in) $(c_s)
- $(AM_V_GEN)\
- ax_text_add_sed_substs="-e s|@PGDATA_ENVIRONMENT[@]|Environment=PGDATA=$(PGDATADIR)|" ; \
- $(text_tpl_gen_verbose)
-
-$(readme_dist_sed): $(readme_template) $(c_s)
- $(text_tpl_gen)
-
-$(readme_dist_m4): $(readme_dist_sed)
- $(text_tpl_gen_conv) && \
- m4 -P < $< > $@
-
-$(readme_dist_db): $(readme_dist_m4)
- $(text_tpl_gen_conv) && \
- $(text_tpl_sed_call) < $(readme_dist_m4) | m4 -P > $(readme_dist_db)
-
-$(readme_dist): $(readme_dist_db) $(srcdir)/style.dsl
- $(text_tpl_gen_conv) && docbook2txt -d $(srcdir)/style.dsl $(readme_dist_db) >/dev/null && \
- mv -f $(readme_dist).txt $(readme_dist)
-
-EXTRA_DIST += \
- $(srcdir)/*.in \
- $(srcdir)/etc/postgresql-setup/upgrade/postgresql.conf \
- $(readme_template) \
- style.dsl
-
-include $(srcdir)/share/postgresql-setup/Makefile.inc
-
-GENERATED_FILES += \
- $(bin_SCRIPTS) \
- $(libexec_SCRIPTS) \
- $(pgdoc_DATA) \
- $(pkgsysconf_DATA) \
- $(systemdunits_DATA) \
- $(legacyscripts_SCRIPTS)
-
-INTERMEDIATE_FILES += \
- $(readme_dist_m4) \
- $(readme_dist_sed) \
- $(readme_dist_db)
-
-CLEANFILES += $(GENERATED_FILES) $(TEST_GEN_FILES_LIST) $(INTERMEDIATE_FILES)
-
-$(TEST_GEN_FILES_LIST): $(GENERATED_FILES)
- $(AM_V_GEN)rm -rf $(TEST_GEN_FILES_LIST) && \
- for i in $(GENERATED_FILES); do \
- echo $$i >> $@ ; \
- done
-
-install-data-hook:
-if WANT_SYSVINIT
-else
- test `id -u` -ne 0 || systemctl daemon-reload
-endif
- $(MKDIR_P) $(DESTDIR)/$(sysconfdir)/$(NAME_BINARYBASE)-setup/upgrade
-
-install-exec-hook:
-if WANT_SYSVINIT
- $(MKDIR_P) $(DESTDIR)/$(initscriptsdir)
- $(install_sh_SCRIPT) $(initscript) $(DESTDIR)/$(initscriptsdir)/$(NAME_SERVICE)
-endif
-
-uninstall-hook:
- rm -rf $(DESTDIR)/$(initscriptsdir)/$(NAME_SERVICE)
-
-GL_GEN_BIN = gitlog-to-changelog
-GL_GEN = if test -d .git; then \
- $(SHELL) $(top_srcdir)/$(config_aux_dir)/missing --run \
- $(GL_GEN_BIN) --format='%s%n%n%b%n' --since 2014-06-30 > ChangeLog ; \
- rc=$$? ; \
- if test $$rc -eq 127; then \
- if test x"$$IGNORE_CHANGELOG" != xyes; then \
- echo >&2 "ERROR: Get the $(GL_GEN_BIN) or ignore ChangeLog by IGNORE_CHANGELOG=yes" ; \
- exit 1 ; \
- fi ; \
- else \
- test $$rc -eq 0 ; \
- fi \
- fi
-
-.PHONY: ChangeLog
-ChangeLog:
- $(AM_V_GEN)$(GL_GEN)
-
-dist-hook: ChangeLog
-
-DISTCLEANFILES = ChangeLog
diff --git a/NEWS b/NEWS
deleted file mode 100644
index 2adefb1..0000000
--- a/NEWS
+++ /dev/null
@@ -1,162 +0,0 @@
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-New in 4.0 version:
-
-* The postgresql-upgrade package is now optional packaging feature, for the
- postgresql-setup --upgrade scenario it might/might not be needed.
-
-* Additional check for correct postgres's $HOME permissions implemented.
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Bugfixes in 3.5 version
-
-* Fix spelling in error message regarding data-dir mountpoint.
-
-* Fix testsuite for SCL.
-
-* Fix documentation regarding --initdb (we require root actually).
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Bugfixes in 3.4 version
-
-* Fix upgrade for non-standard unit names with --unit option.
-
-New in 3.4 version
-
-* Add --upgrade-from-unit option which allows proper selection of
- predecessor service name (when the default detection does not help).
-
-* postgresql-setup now throws warning if the PGDATA directory (or its
- parent directory) is a mountpoint.
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Bugfixes in 3.3 version
-
-* The PGPORT/PGOPTS/.. variables should be correctly forwarded down from
- the initstcript into postgresql-ctl.
-
-* Initscript's 'start' function again reports success if daemon is already
- running.
-
-New in 3.3 version
-
-* New option PGSTARTWAIT for sysvinit systems.
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-New in 3.2 version
-
-* The --new-systemd-unit option now cleans the recently created drop-in
- directory if something goes wrong.
-
-Bugfixes in 3.2 version
-
-* Fix regression of setting the default pgdata variable for non-default
- unit names. This broke --new-systemd-unit option and --initdb, because
- the postgresql-setup logic tried to create the data directory on the
- same place as the _default_ unit stores data (instead of explicitly
- asking for --datadir option).
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-New in 3.1 version
-
-* When doing --upgrade, postgresql-setup now guards against upgrading when
- the old postgresql server is still running.
-
-Bugfixes in 3.1 version
-
-* The 'pg_upgrade --link' option is not used for non-in-place upgrades
- scenarios.
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-New in 3.0 version
-
-* Use 'pg_upgrade --username' instead of 'pg_upgrade --user' for
- PostgreSQL >= 9.4.
-
-* postgresql-setup now works if postgres user is /bin/nologin
-
-* Legacy scripts are now generated from single template file, also are
- simplified a bit.
-
-* There are now options (by upgrade configuration file) how to upgrade from an
- PG stack running in SCL (Software Collections)
-
-* documentation README.rpm-dist is generated from docbook sources
-
-* The sysvinit support should be OK finally, sysvinit system is now
- automatically detected without --with-sysvinit configure option.
-
-* The starting timeout is now configurable via PGSTARTTIMEOUT.
-
-* Service file and initscript now support running of PostgreSQL extensions
- built against specific software collections, specified by PGSCLS
- environment variable.
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-New in 2.0 version
-
-* With configre --with-sysvinit we are able to install sysvinit
- configuration instead of systemd.
-
-* For systemd systems, the "legacy" scripts for 'service postgresql initdb'
- and 'service postgresql upgrade' are installed.
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-New in 1.0 version
-
-* The postgresql-check-db-dir is now more strict to admin's configuration
- and tries to avoid future incompatibilities by warning about the
- /etc/systemd/system/postgresql@instance.service.d/ non-existence.
- Idea by Honza Horák.
-
-* The /etc/postgresql/* path is not used for configuration as it does not
- conform systemd's intentions, see the thread:
- http://www.spinics.net/lists/fedora-devel/msg200450.html . We encourage
- users to configure via postgresql.service.d/ drop-in directory.
-
-* postgresql-setup is now able to (the very ugly way, though) to read
- environment variable setup from systemd's environment files specified
- via EnvironmentFile= statement (reminded by private rhbz#1135611).
-
-* postgresql-setup now detects whether systemd configuration changed
- while the `systemctl daemon-reload` was not done yet. Without
- daemon-reload, running postgresql-setup could lead to unexpected results.
-
-* When the --new-systemd-unit (together with --unit & --port & --datadir) is
- given, postgresql-setup is now able to generate very simple drop-in
- configuration file - so instantiating another PostgreSQL server may be
- done by single command.
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-New in 0.9.1 version
-
-* The postgresql-setup script does not require --port option when upgrading.
-
-* Each service produces its own upgrade/initdb log files under postgres'
- home directory.
-
-* The README.rpm-dist file now follows the changes in 0.9 and 0.9.1.
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-New in 0.9 version
-
-* This is inital version actually, changes are against F21 version:
- http://pkgs.fedoraproject.org/cgit/postgresql.git/tree/?id=49f074f1918a61
-
-* Prepared for /etc/sysconfig/postgresql configuration, taking into account
- that we should make the s/postgresql.service/postgresql@.service/
- (instantiable) change.
-
-* Allow user to specify PGPORT also by 'port' option in postgresql.conf
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/README b/README
index abb754b..d8fb549 100644
--- a/README
+++ b/README
@@ -1,15 +1 @@
-----------------
-postgresql-setup
-----------------
-
-BuildRequires:
- - m4
- - docbook-utils
- - help2man
- - elinks (pretty README.rpm-dist)
-
-Suggested BuildRequires:
- - util-linux (mountpoint utility)
-
-Maintainer's BuildRequires:
- - autoconf, automake, autoconf-archive
+repository moved to https://github.com/devexp-db/postgresql-setup
diff --git a/README.rpm-dist.template b/README.rpm-dist.template
deleted file mode 100644
index b482d10..0000000
--- a/README.rpm-dist.template
+++ /dev/null
@@ -1,648 +0,0 @@
-<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
-
-<!--- m4_divert(-1)
-m4_changequote(`[', `]')
-# vim: ft=xml
-
-m4_define([PGSETUP_SERVICE],
-m4_ifelse([@WANT_SYSVINIT@], [1], m4_dnl
-[service $1 $2],m4_dnl
-[systemctl $2 $1.service]))
-
-m4_define([PGSETUP_SERVICE_START], PGSETUP_SERVICE($1, start))
-m4_define([PGSETUP_SERVICE_STOP], PGSETUP_SERVICE($1, stop))
-
-m4_define([PGSETUP_SERVICE_ENABLE],
-m4_ifelse([@WANT_SYSVINIT@], [1], m4_dnl
-[chkconfig $1 on],m4_dnl
-[systemctl enable $1.service]))
-
-m4_define([PGSETUP_SERVICE_DISABLE],
-m4_ifelse([@WANT_SYSVINIT@], [1], m4_dnl
-[chkconfig $1 off],m4_dnl
-[systemctl disable $1.service]))
-
-m4_define([PGSETUP_ADMIN], [postgres])
-
-m4_define([_PGSETUP_COMMAND], [
-<screen>
- <prompt>$2 </prompt><userinput>$1</userinput>
-</screen>
-])
-
-m4_define([PGSETUP_COMMAND], [_PGSETUP_COMMAND($1, [$])])
-m4_define([PGSETUP_ROOT_COMMAND], [_PGSETUP_COMMAND($1, [#])])
-
-m4_divert[]m4_dnl
--->
-
-<article lang="en">
-<articleinfo>
-<title>PostgreSQL in RPMs</title>
-</articleinfo>
-
-<sect1 id="introduction">
- <title>INTRODUCTION</title>
- <para>
- This document exists to explain the layout of the RPMs for PostgreSQL, to
- describe various RPM specifics, and to document special features found in
- the RPMset.
- </para>
- <para>
- This document is written to be applicable to version @PGMAJORVERSION@ of PostgreSQL,
- which is the current version of the RPMs as of this writing. More to the
- point, versions prior to @PGMAJORVERSION@ are not documented here.
- </para>
- <para>
- This document is intended for use only with the RPMs supplied in Red Hat
- Enterprise Linux, CentOS and Fedora. Note that there are also "PGDG"
- RPMs available directly from the upstream PostgreSQL project. Those are
- slightly different.
- </para>
-</sect1>
-
-<sect1>
- <title>QUICKSTART</title>
- <para>
- For a fresh installation, you will need to initialize the cluster first (as
- a root user):
-
- PGSETUP_ROOT_COMMAND(@NAME_BINARYBASE@-setup --initdb)
-
- and it will prepare a new database cluster for you. Then you will need to
- start PostgreSQL. Now, as root, run:
-
- PGSETUP_ROOT_COMMAND([PGSETUP_SERVICE_START(@NAME_SERVICE@)])
-
- This command will start a postmaster that will listen on localhost and Unix
- socket 5432 only. Edit @PGDATADIR@/postgresql.conf and pg_hba.conf if you
- want to allow remote access -- see the section on Grand Unified
- Configuration.
-
- You will probably also want to do
-
- PGSETUP_ROOT_COMMAND([PGSETUP_SERVICE_ENABLE(@NAME_SERVICE@)])
-
- so that the postmaster is automatically started during future reboots.
-
- </para>
-
- <para>
- The file @POSTGRES_HOMEDIR@/.bash_profile is packaged to help with the
- setting of environment variables. You may edit this file, and it won't be
- overwritten during an upgrade. However, enhancements and bugfixes may be
- added to this file, so be sure to check .bash_profile.rpmnew after
- upgrading.
- </para>
-
- <para>
- The user 'postgres' is created during installation of the server subpackage.
- This user by default is UID and GID 26. The user has the default shell set
- to bash, and the home directory set to @POSTGRES_HOMEDIR@. This user also
- has no default password, so the only way to become this user is to su to it
- from root. If you want to be able to su to it from a non-root account or
- log in directly as 'postgres' you will need to set a password using passwd.
- Test section 2.
- </para>
-
-</sect1>
-
-<sect1>
- <title>UPGRADING AN INSTALLATION</title>
-
- <para>
- For a minor-version upgrade (such as 9.3.1 to 9.3.4; last number changes),
- just install the new RPMs; there's usually nothing more to it than that.
- Upgrading across a major release of PostgreSQL (for example, from 9.2.x to
- 9.3.x) requires more effort.
- </para>
-
- <para>
- If you are upgrading across more than one major release of PostgreSQL
- (for example, from 8.3.x to 9.0.x), you will need to follow the
- "traditional" dump and reload process to bring your data into the new
- version. That is: *before* upgrading, run pg_dumpall to extract all your
- data into a SQL file. Shut down the old postmaster, upgrade to the new
- version RPMs, perform initdb, and run the dump file through psql to restore
- your data.
- </para>
-
- <para>
- In some major releases, the RPMs also support faster upgrade from concrete
- subset of previous releases. You can run the:
-
- PGSETUP_COMMAND(@NAME_BINARYBASE@-setup --upgrade-ids)
-
- to see what previous versions you are able to upgrade from. This is much
- faster than a dump and reload. To do a faster upgrade:
- <orderedlist>
- <listitem>
- <para>
- shut down the old postmaster running against old data
- </para>
- </listitem>
- <listitem>
- <para>
- optionally make a backup of data directory (recommended!)
- </para>
- </listitem>
- <listitem>
- <para>
- install the new version's RPMs (install all the ones you had before,
- plus @NAME_PACKAGE@-upgrade)
- </para>
- </listitem>
- <listitem>
- <para>
- as root, run "@NAME_BINARYBASE@-setup --upgrade [[--upgrade-from ID]]"
- </para>
- </listitem>
- <listitem>
- <para>
- update the configuration files @PGDATADIR@/*.conf with any
- customizations you had before (your old configuration files are in
- old data directory or in @PGDATADIR@-old/ if you've done
- in-place upgrade)
- </para>
- </listitem>
- <listitem>
- <para>
- as root, run "PGSETUP_SERVICE_START(@NAME_SERVICE@)"
- </para>
- </listitem>
- <listitem>
- <para>
- the @NAME_PACKAGE@-upgrade package can be removed after the update is
- complete, as can old data directory
- </para>
- </listitem>
- </orderedlist>
-
- NOTE: The in-place upgrade process is new and relatively poorly tested,
- so if your data is critical it's a really good idea to make a tarball
- backup of old data directory before running the upgrade. This will
- let you get back to where you were in case of disaster.
-
- </para>
-</sect1>
-
-<sect1>
- <title>POSTGRESQL RPM PACKAGES AND RATIONALE</title>
-
- <para>
- PostgreSQL is split up into multiple packages so that users can 'pick and
- choose' what pieces are needed, and what dependencies are required.
- </para>
-
- <table>
- <title>Sub-package list</title>
- <tgroup cols='2' align='left' colsep='1' rowsep='1'>
- <thead>
- <row><entry>Package</entry><entry>Description</entry></row>
- </thead>
- <tbody>
- <row>
- <entry>@NAME_PACKAGE@:</entry>
- <entry>Key client programs and basic documentation</entry>
- </row>
- <row>
- <entry>@NAME_PACKAGE@-libs:</entry>
- <entry>Client shared libraries</entry>
- </row>
- <row>
- <entry>@NAME_PACKAGE@-server:</entry>
- <entry>Server executables and data files</entry>
- </row>
- <row>
- <entry>@NAME_PACKAGE@-test:</entry>
- <entry>The regression tests and associated files</entry>
- </row>
- <row>
- <entry>@NAME_PACKAGE@-upgrade:</entry>
- <entry>Support files for upgrading from previous major version</entry>
- </row>
- <row>
- <entry>@NAME_PACKAGE@-docs:</entry>
- <entry>Full documentation in HTML and PDF, the tutorial files</entry>
- </row>
- <row>
- <entry>@NAME_PACKAGE@-contrib:</entry>
- <entry>Add-on loadable modules and programs</entry>
- </row>
- <row>
- <entry>@NAME_PACKAGE@-plperl:</entry>
- <entry>PL/Perl procedural language</entry>
- </row>
- <row>
- <entry>@NAME_PACKAGE@-plpython:</entry>
- <entry>PL/Python procedural language (for Python 2)</entry>
- </row>
- <row>
- <entry>@NAME_PACKAGE@-plpython3:</entry>
- <entry>PL/Python procedural language (for Python 3)</entry>
- </row>
- <row>
- <entry>@NAME_PACKAGE@-pltcl:</entry>
- <entry>PL/Tcl procedural language</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- <para>
- You have to install @NAME_PACKAGE@ and @NAME_PACKAGE@-libs to do anything.
- @NAME_PACKAGE@-server is needed unless you only plan to use the clients to
- work with a remote PostgreSQL server. The others are optional.
- </para>
- <para>
- Note that there are no @NAME_PACKAGE@-perl, @NAME_PACKAGE@-jdbc,
- @NAME_PACKAGE@-odbc, @NAME_PACKAGE@-python, @NAME_PACKAGE@-tcl, or
- @NAME_PACKAGE@-tk subpackages any longer. Those programs have been split
- off into separate source distributions. They are still available, but in
- some cases not under those RPM names.
- </para>
-</sect1>
-
-<sect1>
- <title>RPM FILE LOCATIONS</title>
- <para>
- To be in compliance with the Linux FHS, the PostgreSQL RPMs install files in
- a manner not consistent with most of the PostgreSQL documentation.
- According to the standard PostgreSQL documentation, PostgreSQL is installed
- under the directory /usr/local/pgsql, with executables, source, and data
- existing in various subdirectories.
- </para>
- <para>
- Different distributions have different ideas of some of these file
- locations. In particular, the documentation directory can be /usr/doc,
- /usr/doc/packages, /usr/share/doc, /usr/share/doc/packages, or some other
- similar path.
- </para>
- <para>
- However, this installation (which usually matches the Red Hat / CentOS /
- Fedora RPM's) install the files like:
- </para>
- <table>
- <title>Filesystem layout</title>
- <tgroup cols='2' align='left' colsep='1' rowsep='1'>
- <thead>
- <row><entry>Description</entry><entry><emphasis>Directory</emphasis></entry></row>
- </thead>
- <tbody>
- <row><entry>Executables</entry><entry>@bindir@</entry></row>
- <row><entry>Libraries</entry><entry>@libdir@</entry></row>
- <row><entry>Documentation</entry><entry>@pgdocdir@/html</entry></row>
- <row><entry>PDF documentation</entry><entry>@pgdocdir@</entry></row>
- <row><entry>Contrib documentation</entry><entry>@pgcontribdocdir@</entry></row>
- <row><entry>Source</entry><entry>not installed</entry></row>
- <row><entry>Data</entry><entry>@PGDATADIR@</entry></row>
- <row><entry>Backup area</entry><entry>@sharedstatedir@/pgsql/backups</entry></row>
- <row><entry>Templates</entry><entry>@datadir@/pgsql</entry></row>
- <row><entry>Procedural Languages</entry><entry>@libdir@/pgsql</entry></row>
- <row><entry>Development Headers</entry><entry>@includedir@/pgsql</entry></row>
- <row><entry>Other shared data</entry><entry>@datadir@/pgsql</entry></row>
- <row><entry>Regression tests</entry><entry>@libdir@/pgsql/test/regress (in the -test package)</entry></row>
- </tbody>
- </tgroup>
- </table>
-
- <para>
- While it may seem gratuitous to place these files in different locations,
- the FHS requires it -- distributions should not ever touch /usr/local. It
- may also seem like more work to keep track of where everything is -- but,
- that's the beauty of RPM -- you don't have to keep track of the files, RPM
- does it for you.
- </para>
- <para>
- These RPMs are designed to be LSB-compliant -- if you find this not to be
- the case, please let us know by way of the pgsql-pkg-yum@postgresql.org
- mailing list.
- </para>
-</sect1>
-
-<sect1>
- <title>MULTIPLE POSTMASTERS</title>
-m4_ifelse([@WANT_SYSVINIT@], [1], m4_dnl
-[
- <para>
- The @NAME_PACKAGE@-server RPM contains an "initscript" that is used to start
- the postmaster. The current version of this script has logic to be able to
- start multiple postmasters, with different data areas, listening on
- different ports, etc. To use this functionality requires root access.
- </para>
-
- <para>
- As an example, let us create a secondary postmaster called, creatively
- enough, 'secondary'. Here are the steps:
- </para>
-
- <orderedlist>
- <listitem>
- <para>
- create a hard link in /etc/rc.d/init.d (or equivalent location) to
- '@NAME_SERVICE@' named 'secondary'.
- PGSETUP_ROOT_COMMAND(ln @NAME_SERVICE@ secondary)
- Pick a name not already used in /etc/rc.d/init.d!
- </para>
- </listitem>
- <listitem>
- <para>
- create a file in /etc/sysconfig/pgsql named secondary. This file is
- a shell script -- typically you would define PGDATA, PGPORT, and PGOPTS
- here. Since $PGDATA/postgresql.conf may override many of these
- settings, except PGDATA, you might be surprised on startup.
- </para>
- </listitem>
- <listitem>
- <para>
- create the target PGDATA
- </para>
- </listitem>
- <listitem>
- <para>
- Initdb the targe PGDATA as documented in the main documentation.
- Automatic initdb may or may not work for you, so a manual one is
- preferred. This must be done as user 'postgres'
- </para>
- </listitem>
- <listitem>
- <para>
- Edit postgresql.conf to change the port, address, tcpip settings, etc.
- </para>
- </listitem>
- <listitem>
- <para>
- Start the postmaster with 'service secondary start'.
- </para>
- </listitem>
- </orderedlist>
-
- <para>
- Note that there may be problems with the standard symlink -- consider this
- support experimental at this point in time.
- </para>
-], m4_dnl
-[
- <para>
- The postgresql-server package contains a systemd "unit" files
- @NAME_SERVICE@.service and @NAME_SERVICE@@.service. The first file is used
- solely to start the default PostgreSQL server. The second one is designed
- to allow instantiating additional PostgreSQL servers on same machine.
- </para>
- <para>
- As an example, let us create a secondary PostgreSQL service called,
- creatively enough, 'postgresql@secondary'. Here are the steps:
- </para>
-
- <orderedlist>
- <listitem>
- <para>
- Run the following command to create the necessary configuration and to
- initialize the new database cluster
- </para>
- <screen>
- <prompt>$ </prompt><userinput>@NAME_BINARYBASE@-setup --initdb \</userinput>
- <userinput> --unit postgresql@secondary \</userinput>
- <userinput> --new-systemd-unit \</userinput>
- <userinput> --datadir /path/to/data/directory \</userinput>
- <userinput> --port NNNN</userinput>
- </screen>
- <para>
- Replace the "/path/to/data/directory" path and NNNN port with
- appropriate settings that don't conflict with any other PostgreSQL
- setup. Make sure that the parent directory of specified path has
- appropriate ownership and permissions. Note the SELinux issues
- mentioned below.
- </para>
- </listitem>
- <listitem>
- <para>
- Edit postgresql.conf in the target 'datadir' directory to change
- settings as needed.
- </para>
- </listitem>
- <listitem>
- <para>
- Start the new service with this command:
- PGSETUP_ROOT_COMMAND(PGSETUP_SERVICE_START(@NAME_SERVICE@@secondary))
- You will probably also want to run the command
- PGSETUP_ROOT_COMMAND(PGSETUP_SERVICE_ENABLE(@NAME_SERVICE@@secondary))
- so that the new service is automatically started in future reboots.
- </para>
- </listitem>
- </orderedlist>
- <para>
- When doing a major-version upgrade of a secondary service, add the service
- name to the @NAME_BINARYBASE@-setup command, for example:
- PGSETUP_ROOT_COMMAND(@NAME_BINARYBASE@-setup --upgrade --unit @NAME_SERVICE@@secondary)
- This will let @NAME_BINARYBASE@-setup find the correct data directory from
- the proper configuration file.
- </para>
- <para>
- If you are running SELinux in enforcing mode (which is highly recommended,
- particularly for network-exposed services like PostgreSQL) you will need to
- adjust SELinux policy to allow the secondary server to use non-default
- PGPORT or PGDATA settings. To allow use of a non-default port, say 5433, do
- this as root:
- PGSETUP_ROOT_COMMAND(semanage port -a -t postgresql_port_t -p tcp 5433)
- To allow use of a non-default data directory, say /special/pgdata, do:
- PGSETUP_ROOT_COMMAND(semanage fcontext -a -t postgresql_db_t "/special/pgdata(/.*)?")
- If you already created the directory, follow that with:
- PGSETUP_ROOT_COMMAND(restorecon -R /special/pgdata)
- These settings are persistent across reboots. For more information see "man
- semanage".
- </para>
-
-])
-</sect1>
-
-<sect1>
- <title>REGRESSION TESTING</title>
- <para>
- If you install the @NAME_PACKAGE@-test RPM then you can run the PostgreSQL
- regression tests. These tests stress your database installation and produce
- results that give you assurances that the installation is complete, and that
- your database machine is up to the task.
- </para>
- <para>
- To run the regression tests under the RPM installation, make sure that the
- PostgreSQL server has been started (if not, su to root and do
- PGSETUP_ROOT_COMMAND(PGSETUP_SERVICE_START(@NAME_SERVICE@))
- su to postgres, cd to @libdir@/pgsql/test/regress and execute "make check".
- This command will start the regression tests and will both show the results
- to the screen and store the results in the file regress.out.
- </para>
- <para>
- If any tests fail, see the file regression.diffs in that directory for
- details, and read the "Regression Tests" section of the PostgreSQL
- documentation to find out whether the differences are actually significant.
- If you need help interpreting the results, contact the pgsql-general list at
- postgresql.org.
- </para>
- <para>
- After testing, run "make clean" to remove the files generated by the test
- script. Then you can remove the @NAME_PACKAGE@-test RPM, if you wish.
- </para>
-</sect1>
-
-<sect1>
- <title>STARTING POSTMASTER AUTOMATICALLY AT SYSTEM STARTUP</title>
- <para>
- Fedora / Red Hat / CentOS use the systemd package to manage server startup.
- A systemd unit file for PostgreSQL is provided in the server package, as
- @systemdunitsdir@/@NAME_SERVICE@.service. To start the postmaster manually,
- as root run
- PGSETUP_ROOT_COMMAND(PGSETUP_SERVICE_START(@NAME_SERVICE@))
- To shut the postmaster down,
- PGSETUP_ROOT_COMMAND(PGSETUP_SERVICE_STOP(@NAME_SERVICE@))
- These two commands only change the postmaster's current status. If you want
- the postmaster to be started automatically during future system startups,
- run
- PGSETUP_ROOT_COMMAND(PGSETUP_SERVICE_ENABLE(@NAME_SERVICE@))
- To undo that again,
- PGSETUP_ROOT_COMMAND(PGSETUP_SERVICE_DISABLE(@NAME_SERVICE@))
-m4_ifelse([@WANT_SYSVINIT@], [1], m4_dnl
-[See "man chkconfig" and "man service" for other possible subcommands.],m4_dnl
-[See "man systemctl" for other possible subcommands.]))
- </para>
-</sect1>
-
-<sect1>
- <title>GRAND UNIFIED CONFIGURATION (GUC) FILE</title>
- <para>
- The PostgreSQL server has many tunable parameters -- the file
- @PGDATADIR@/postgresql.conf is the master configuration file for the
- whole system.
- </para>
- <para>
- The RPM ships with a mostly-default file -- you will need to tune the
- parameters for your installation. In particular, you might want to allow
- nonlocal TCP/IP socket connections -- in order to allow these, you will need
- to edit the postgresql.conf file. The line in question contains the string
- 'listen_addresses' -- you need to both uncomment the line and set the value
- to '*' to get the postmaster to accept nonlocal connections. You'll also
- need to adjust pg_hba.conf appropriately.
- </para>
-</sect1>
-
-<sect1>
- <title>LOGGING SET UP</title>
- <para>
- By default, the postmaster's stderr log is directed into files placed in a
- pg_log subdirectory of the data directory (ie, @PGDATADIR@/pg_log).
- The out-of-the-box configuration rotates among seven files, one for each
- day of the week. You can adjust this by changing postgresql.conf settings.
- </para>
-</sect1>
-
-<sect1>
- <title>REBUILDING FROM SOURCE RPM</title>
- <para>
- If your distribution is not supported by the binary RPMs from
- PostgreSQL.org, you will need to rebuild from the source RPM.
- </para>
- <para>
- If you have not previously rebuilt any RPMs, set up the required environment:
- make a work directory, say ~/rpmwork, then cd into it and do
- PGSETUP_ROOT_COMMAND(mkdir BUILD BUILDROOT RPMS SOURCES SPECS SRPMS)
- Then make a file ~/.rpmmacros containing
- <screen><userinput>%_topdir full_path_to_work_directory_here</userinput></screen>
- </para>
- <para>
- Download the postgresql .src.rpm for the release you want and place it in
- the SRPMS subdirectory, then cd there and execute
- PGSETUP_COMMAND(rpmbuild --rebuild postgresql-nnn.src.rpm)
- The results will appear under the RPMS subdirectory.
- </para>
- <para>
- You will have to have a full development environment to rebuild the RPM set.
- If rpmbuild complains of lack of certain packages, install them and try
- again. In some cases, you can disable features to avoid needing some
- development packages, as detailed next.
- </para>
- <para>
- This release of the RPMset includes the ability to conditionally build sets
- of packages. The parameters, their defaults, and the meanings are:
- </para>
-
- <table>
- <title>SRPM configuration options</title>
- <tgroup cols='3' align='left' colsep='0' rowsep='0'>
- <thead>
- <row><entry>Variable</entry><entry>Default</entry><entry>Comment</entry></row>
- </thead>
- <tbody>
- <row><entry>beta</entry><entry>0</entry><entry>build with cassert and do not strip the binaries</entry></row>
- <row><entry>runselftest</entry><entry>1</entry><entry>do "make check" during the build</entry></row>
- <row><entry>test</entry><entry>1</entry><entry>build the postgresql-test package</entry></row>
- <row><entry>upgrade</entry><entry>1</entry><entry>build the postgresql-upgrade package</entry></row>
- <row><entry>plpython</entry><entry>1</entry><entry>build the PL/Python procedural language package</entry></row>
- <row><entry>plpython3</entry><entry>1</entry><entry>build the PL/Python3 procedural language package</entry></row>
- <row><entry>pltcl</entry><entry>1</entry><entry>build the PL/Tcl procedural language package</entry></row>
- <row><entry>plperl</entry><entry>1</entry><entry>build the PL/Perl procedural language package</entry></row>
- <row><entry>ssl</entry><entry>1</entry><entry>build with OpenSSL support</entry></row>
- <row><entry>kerberos</entry><entry>1</entry><entry>build with Kerberos 5 support</entry></row>
- <row><entry>ldap</entry><entry>1</entry><entry>build with LDAP support</entry></row>
- <row><entry>nls</entry><entry>1</entry><entry>build with national language support</entry></row>
- <row><entry>pam</entry><entry>1</entry><entry>build with PAM support</entry></row>
- <row><entry>sdt</entry><entry>1</entry><entry>build with SystemTap support</entry></row>
- <row><entry>xml</entry><entry>1</entry><entry>build with XML support</entry></row>
- <row><entry>pgfts</entry><entry>1</entry><entry>build with --enable-thread-safety</entry></row>
- <row><entry>selinux</entry><entry>1</entry><entry>build contrib/selinux</entry></row>
- <row><entry>uuid</entry><entry>1</entry><entry>build contrib/uuid-ossp</entry></row>
- </tbody>
- </tgroup>
- </table>
-
- <para>
- To use these defines, invoke a rebuild like this:
- <screen>
- <prompt>$ </prompt><userinput>rpmbuild --rebuild \
- --define 'plpython 0' \
- --define 'pltcl 0' \
- --define 'test 0' \
- --define 'runselftest 0' \
- --define 'kerberos 0' \
- postgresql-9.2.0-1.src.rpm
- </userinput></screen>
- This command would disable the plpython, pltcl, and test subpackages,
- disable the regression test run during build, and disable kerberos support.
- </para>
- <para>
- You might need to disable runselftest if there is an installed version of
- PostgreSQL that is a different major version from what you are trying to
- build. The self test tends to pick up the installed libpq.so shared library
- in place of the one being built :-(, so if that isn't compatible the test
- will fail. Also, you can't use runselftest when doing the build as root.
- </para>
- <para>
- More of these conditionals will be added in the future.
- </para>
-</sect1>
-
-<sect1>
- <title>CONTRIB FILES</title>
- <para>
- The contents of the contrib tree are packaged into the -contrib subpackage
- and are processed with make and make install. There is documentation in
- @pgcontribdocdir@ for these modules. Most of the modules are in
- @libdir@/pgsql for loadable modules, and binaries are in @bindir@. In the
- future these files may be split out, depending upon function and
- dependencies.
- </para>
-</sect1>
-
-<sect1>
- <title>MORE INFORMATION</title>
- <para>
- You can get more information at http://www.postgresql.org and
- http://yum.postgresql.org
- </para>
- <para>
- Please help make this packaging better -- let us know if you find problems,
- or better ways of doing things. You can reach us by e-mail at
- pgsql-pkg-yum@postgresql.org or fail a bug against postgresql component on
- bugzilla.redhat.com.
- </para>
-</sect1>
-
-</article>
diff --git a/THANKS b/THANKS
deleted file mode 100644
index 5048ee2..0000000
--- a/THANKS
+++ /dev/null
@@ -1,3 +0,0 @@
-Dietmar Kling
-Miroslav Suchý
-Pavel Kajaba
diff --git a/TODO b/TODO
deleted file mode 100644
index f4e16e8..0000000
--- a/TODO
+++ /dev/null
@@ -1,35 +0,0 @@
-* testsuite
- - check bash "static" analysis
-
-* root-testsuite (future)
- - check that --port is required for @ units
- - check that the --port option in '--{initdb,upgrade} --port XXX' is ignored
- (and user warned) when port is already specified somewhere else (systemd
- or postgresql.conf)
-
-* warn about privileged port usage
-
-* bash-completion script
-
-* coloring?
-
-* make the README.rpm-dist manual page as it allows user showing the content
- in formatting based on its own preference. It allows also easier templating
- (too-long lines, etc).
-
-* build system
- - generate the binary scripts outside '$(srcdir)' as maintainer tends to
- edit generated file instead its '*.in' parent
-
-* Allow guys from KDE upgrade the PG stack somehow.
-
-* stylesheets & html version for README.rpm-dist
-
-* option for admin-defined configuration file
-
-* old stack breakage after pg_upgrade (check whats going on?)
-
-* check for running postmaster! (even running postgresql92 server breaks
- upgrade from postgresql to rh-postgresql94-postgresql on RHEL6)
-
-* SELinux advice (if selinux is not disabled)
diff --git a/auxdir/install_local b/auxdir/install_local
deleted file mode 100755
index 1c06a6e..0000000
--- a/auxdir/install_local
+++ /dev/null
@@ -1,10 +0,0 @@
-#! /bin/bash
-
-source <(cat config.status | grep ^ac_cs_config)
-
-./configure --prefix=/usr --with-upgrade-config=upgrade_config.template \
- && make clean \
- && make \
- && sudo make install
-
-eval "./configure $ac_cs_config"
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 655eb6e..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,186 +0,0 @@
-# Use the MAJ.MIN[~SUFF]. Note that X.X > X.X~SUFF!
-AC_INIT([postgresql-setup], [4.0], [praiskup@redhat.com])
-AC_CONFIG_AUX_DIR(auxdir)
-config_aux_dir=auxdir
-AC_SUBST([config_aux_dir])
-
-AM_INIT_AUTOMAKE([-Wall])
-AC_CONFIG_FILES([Makefile doc/Makefile])
-AC_CONFIG_MACRO_DIR([m4])
-AM_SILENT_RULES([yes])
-
-# Initialize the test suite.
-AC_CONFIG_TESTDIR(tests)
-AC_CONFIG_FILES([tests/Makefile])
-AM_MISSING_PROG([AUTOM4TE], [autom4te])
-
-_AX_TEXT_TPL_INIT
-
-_AX_TEXT_TPL_SUBST([TEST_GEN_FILES_LIST], [.generated_files])
-
-# TODO: detect systemd/sysvinit. Also, we should probably be able to install
-# both configuration at once when needed.
-AC_ARG_WITH([sysvinit],
- AS_HELP_STRING([--with-sysvinit],
- [prepares sys v init script]),
- [WANT_SYSVINIT=0
- test x"$withval" = xyes && WANT_SYSVINIT=1]
-)
-
-if test x = x"$WANT_SYSVINIT"
-then
- WANT_SYSVINIT=0
- # Try to detect system running systemd
- AC_PATH_PROG([SYSTEMCTL], [systemctl])
- test -z "$ac_cv_path_SYSTEMCTL" && WANT_SYSVINIT=1
-fi
-
-INIT_SYSTEM=systemd
-test x"$WANT_SYSVINIT" = x1 && INIT_SYSTEM=sysvinit
-
-AM_CONDITIONAL([WANT_SYSVINIT], [test "$WANT_SYSVINIT" -eq 1])
-_AX_TEXT_TPL_SUBST([WANT_SYSVINIT])
-
-m4_define([conf_dir], [dnl
-test -z "$$1" && $1=$2
-_AX_TEXT_TPL_SUBST([$1])
-])
-
-SED_CALL="\$(SED) \$(SED_RULES)"
-m4_pattern_allow(AM_V_GEN)
-
-conf_dir([systemdunitsdir], ['${prefix}/lib/systemd/system'])
-conf_dir([systemduserunitsdir], ['${prefix}/etc/systemd/system'])
-conf_dir([systemdlegacyscriptsdir], ['${libexecdir}/initscripts/legacy-actions'])
-conf_dir([initscriptsdir], ['${sysconfdir}/rc.d/init.d'])
-conf_dir([initscriptsconfdir], ['/etc/sysconfig/pgsql'])
-conf_dir([rawpkgdatadir], ['${datadir}/postgresql-setup'])
-# Those two should be specified explicitly.
-conf_dir([pgdocdir], ['${datarootdir}/doc/${NAME_PACKAGE}'])
-conf_dir([pgcontribdocdir], ['${datarootdir}/doc/${NAME_PACKAGE}-contrib'])
-
-INSTANTIATE_CONV="\$(AM_V_GEN)rm -rf \$@; \$(MKDIR_P) \$(@D)"
-INSTANTIATE="\$(INSTANTIATE_CONV) && \$(SED_CALL) \$< > \$@ && chmod -w \$@"
-INSTANTIATE_SCRIPT="\$(INSTANTIATE) && chmod +x \$@"
-c_s='$(top_builddir)/config.status'
-
-AC_PATH_PROG([SED], [sed])
-test -z "$ac_cv_path_SED" &&
- AC_MSG_ERROR([Sed is needed but not found.])
-
-AC_PATH_PROGS([SU], [runuser su])
-test -z "$ac_cv_path_SU" &&
- AC_MSG_ERROR([Neither 'runuser' nor 'su' program found])
-SU_POSTGRES="$SU -s /bin/sh -l postgres"
-_AX_TEXT_TPL_SUBST([SU_POSTGRES])
-
-AC_PATH_PROG([MOUNTPOINT], [mountpoint], [false])
-_AX_TEXT_TPL_SUBST([MOUNTPOINT])
-
-PGSETUP_PACKAGING_INIT
-
-# check for main PostgreSQL binaries
-AC_ARG_VAR([POSTGRES_BIN], [Full path to postgres binary. Note that based on
- package ownership of this file the package names (like
- postgresql-server, postgresql, ..) are detected.])
-AC_PATH_PROG([POSTGRES_BIN], [postgres])
-
-# check for PGVERSION & PGMAJORVERSION, if needed
-if test -z "$PGVERSION" -a -z "$PGMAJORVERSION"; then
- test -z "$ac_cv_path_POSTGRES_BIN" &&
- AC_MSG_ERROR([no postgres binary, can not detect version])
-
- AC_MSG_CHECKING([for full version PostgreSQL server])
- raw_version=$("$POSTGRES_BIN" --version) ||
- AC_MSG_ERROR([command $POSTGRES_BIN --version failed])
-
- PGVERSION=${raw_version##* }
- AC_MSG_RESULT($PGVERSION)
-
- PGMAJORVERSION=`echo $PGVERSION | sed 's/\.[0-9]\+$//'`
-fi
-
-AX_COMPARE_VERSION([9.4], [le], [$PGVERSION],
- [PG_UPGRADE_BIN_USER_OPT="--username"],
- [PG_UPGRADE_BIN_USER_OPT="--user"])
-_AX_TEXT_TPL_SUBST([PG_UPGRADE_BIN_USER_OPT])
-
-AC_PATH_PROG([PG_UPGRADE_BIN], [pg_upgrade])
-
-if test -z "$PKGCONFIG_DIR" -a "$pgsetup_cv_os_family" = redhat; then
- PKGCONFIG_DIR=/etc/postgresql
-fi
-
-if test -z "$POSTGRES_HOMEDIR" -a "$pgsetup_cv_os_family" = redhat; then
- POSTGRES_HOMEDIR=/var/lib/pgsql
-fi
-
-if test -z "$PGDATADIR" -a "$pgsetup_cv_os_family" = redhat; then
- # This is based on Red Hat's packaging.
- PGDATADIR='${localstatedir}/lib/pgsql/data'
-fi
-
-README_DIST_BASENAME=README.rpm-dist
-README_DIST="\${pgdocdir}/$README_DIST_BASENAME"
-
-_AX_TEXT_TPL_SUBST([README_DIST])
-_AX_TEXT_TPL_SUBST([README_DIST_BASENAME])
-
-PGSETUP_SUBST_REQ([PGVERSION], [full PG version])
-PGSETUP_SUBST_REQ([PGMAJORVERSION], [major PG version])
-PGSETUP_SUBST_REQ([PKGCONFIG_DIR], [where configuration should be stored])
-PGSETUP_SUBST_REQ([POSTGRES_HOMEDIR], [full path to postgres home dir])
-PGSETUP_SUBST_REQ([PGDATADIR], [full path to postgres data dir])
-
-PGSETUP_SUBST_OPT([NAME_SRV_PFX], [],
- [service name prefix, like (PFX)postgresql.service])
-PGSETUP_SUBST_OPT([NAME_SRV_SFX], [],
- [service name suffix, like postgresql(SFX).service ])
-PGSETUP_SUBST_OPT([NAME_BIN_SFX], [],
- [binary name prefix, like (PFX)postgresql-setup])
-PGSETUP_SUBST_OPT([NAME_BIN_SFX], [],
- [binary name suffix, like postgresql(SFX)-setup])
-PGSETUP_SUBST_OPT([NAME_PKG_PFX], [],
- [package name prefix, like (PFX)postgresql.rpm])
-PGSETUP_SUBST_OPT([NAME_PKG_SFX], [],
- [package name suffix, like postgresql(SFX).rpm])
-PGSETUP_SUBST_OPT([NAME_DEFAULT_PREV_SERVICE], [postgresql],
- [name of service to upgrade from by default (defaults to
- 'postgresql'])
-
-PGSETUP_SUBST_OPT([SCLS], [],
- [mention software collections which should be enabled
- for all binaries from ${bindir}])
-
-SCL_BINDIR=/usr/bin
-SCL_BINARY=scl
-SCL_SOURCE=
-SCL_SHELL_WRAPPER=
-if test -n "$SCLS"
-then
- SCL_SHELL_WRAPPER="$SCL_BINDIR/$SCL_BINARY enable $SCLS -- "
- SCL_SOURCE="source scl_source enable $SCLS ;"
-fi
-
-_AX_TEXT_TPL_SUBST([SCL_SHELL_WRAPPER])
-_AX_TEXT_TPL_SUBST([SCL_SOURCE])
-
-NAME_BINARYBASE="$NAME_BIN_PFX""postgresql$NAME_BIN_SFX"
-NAME_PACKAGE="$NAME_PKG_PFX""postgresql$NAME_PKG_SFX"
-NAME_SERVICE="$NAME_SRV_PFX""postgresql$NAME_SRV_SFX"
-
-_AX_TEXT_TPL_SUBST([NAME_BINARYBASE])
-_AX_TEXT_TPL_SUBST([NAME_PACKAGE])
-_AX_TEXT_TPL_SUBST([NAME_SERVICE])
-
-AC_OUTPUT
-
-AC_MSG_NOTICE([Configured the folowing way:
-
- PostgreSQL version: $PGVERSION
- PGDATADIR: $PGDATADIR
- PostgreSQL service: $NAME_SERVICE
- PostgreSQL package: $NAME_PACKAGE
- PostgreSQL bin_pfx: $NAME_BINARYBASE
- Init system: $INIT_SYSTEM
-])
diff --git a/doc/.gitignore b/doc/.gitignore
deleted file mode 100644
index f7e585b..0000000
--- a/doc/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.1
diff --git a/doc/Makefile.am b/doc/Makefile.am
deleted file mode 100644
index 2dfd6bd..0000000
--- a/doc/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-HELP2MAN = $(SHELL) $(top_srcdir)/$(config_aux_dir)/missing --run help2man
-
-# The help2man call
-# =================
-# Make the rules always dependant on source (thus on postgresql-setup.in, not on
-# postgresql-setup), at least for distributed files. Otherwise, the '*.1'
-# manual page is regenerated even when distributed and no code change actually
-# happened. In case there exists some target generating other file directly
-# depending on the generated manual page, we would need 'touch $@'. But it
-# seems better to keep warning user about non-existing help2man when '.in'
-# changed.
-# TODO: make it non-fatal for cross-compilation case also
-# TODO: separate it to its own m4 module (for easier distribution)
-
-HELP2MAN_RUN = \
- $(HELP2MAN) --output=$@ $$input -N ; \
- rs=$$? ; \
- if test $$rs -eq 127; then \
- test -f $@ ; \
- else \
- test $$rs -eq 0 ; \
- fi
-
-setup_man = $(srcdir)/$(NAME_BINARYBASE)-setup.1
-
-dist_man_MANS = $(setup_man)
-
-$(setup_man): $(top_srcdir)/postgresql-setup
- $(AM_V_GEN)export input=$(top_srcdir)/$(NAME_BINARYBASE)-setup ; \
- $(HELP2MAN_RUN)
diff --git a/etc/postgresql-setup/upgrade/postgresql.conf b/etc/postgresql-setup/upgrade/postgresql.conf
deleted file mode 100644
index 850aa12..0000000
--- a/etc/postgresql-setup/upgrade/postgresql.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-# This is tempalte configuration for pg_upgrade via postgresql-setup. The
-# format of config-line 'key[[:space:]][[:space:]]*value'. Keys must be
-# valid shell identifiers and value should be either bare-word or string quoted
-# by double quotes (as in shell).
-
-id postgresql
-
-# Major version of the previous stack
-major 9.2
-
-# Location of default data
-data_default "/var/lib/pgsql/data"
-
-# Location of binaries
-engine /usr/bin
-
-# Just to feed ./postgresql-setup --upgrade-ids help output
-description "In-place upgrade from Fedora 19 (PostgreSQL 9.2)"
-
-# What software collections must be enabled for successful upgrade.
-scls "postgresql92"
-
-# Red Hat back-patches unix_socket_directories into major versions 9.2+, which
-# is different from upstream (9.3+). You may need to let pg_upgrade know that
-# it works against server 9.2 built by Red Hat.
-redhat_sockets_hack yes
-
-# 8.4 servers did not provide info about socket directory in pidfile (and newer
-# clients look only into /var/run/postgresql on Red Hat). Use pghost_override
-# for specifying where to look by default (optional).
-pghost_override /tmp
diff --git a/legacy-sysv-script.in b/legacy-sysv-script.in
deleted file mode 100644
index 5eaad51..0000000
--- a/legacy-sysv-script.in
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-# Legacy action script for "service postgresql --@__FILE__@"
-cmd="@bindir@/postgresql-setup --@__FILE__@ --unit @NAME_SERVICE@"
-echo "Hint: the preferred way to do this is now \"$cmd\"" >&2
-$cmd
diff --git a/m4/_ax_text_tpl.m4 b/m4/_ax_text_tpl.m4
deleted file mode 100644
index 0977c05..0000000
--- a/m4/_ax_text_tpl.m4
+++ /dev/null
@@ -1,163 +0,0 @@
-# Text templating system with autoconf
-# ====================================
-#
-# Correctly generate files based on ./configure check results. The @variable@
-# substitution is usually done by config.status from *.in files, however
-# substuing paths like @libexecdir@ can result into '${exec_prefix}/libexec'
-# which is not desired for installed scripts, for example, where we need to have
-# fully expanded paths. The aim of this script is to generalize steps users
-# usually do to perform full expansion of configure variables. Currently we use
-# sed substitution only.
-#
-# The easiest usage of this templating system is like this:
-# $ cat configure.ac | "grep interresting lines"
-# _AX_TEXT_TPL_INIT
-# some_other_var="some other var content"
-# _AX_TEXT_TPL_SUBST([some_other_var])
-#
-# $ cat Makefile (or Makefile.am):
-# generated_file: TEMPLATE.in $(text_tpl_deps)
-# <<tab>>$(text_tpl_gen)
-#
-# Limitations:
-# - this code is probably not terribly portable
-# - substitutions should not contain '|' character (because we use sed rules
-# spelled like 's|||'), you can do things like '\|', however you need to
-# take into account that substitution done by 'sed' and by 'config.status' are
-# not the same. Also be careful about escaping '\' caracter.
-# - only single-line substitutions are expected; you may use '\n' however
-# there is the same problem as with '|' and '\'.
-#
-# TODO:
-# - we should do something similar to what config.status does (awk generated
-# source code for substitutions), however even thought usually variable
-# (macro) values are defined by ./configure, some may be defined like 'make
-# VARIABLE=VALUE'.
-
-# sed_subst_var_pattern VARNAME (private macro)
-# ---------------------------------------------
-# Generate sed substitution rule to substitute @VARNAME@ with fully expaned
-# value of $VARNAME. The trick is that we use 'make' to expand the value.
-# The VARNAME must be AC_SUBST'ed (and all its sub-components like ${prefix},
-# etc.) to allow 'make' doing correct expansion.
-m4_define([sed_subst_var_pattern], [\\
- -e 's|@$1[[@]]|\$($1)|g'])
-
-# _AX_TEXT_TPL_INIT
-# -----------------
-# Initialize the templating system.
-AC_DEFUN([_AX_TEXT_TPL_INIT], [
-
-__ax_text_tpl_default_variables="\
- abs_builddir
- abs_srcdir
- abs_top_builddir
- abs_top_srcdir
- bindir
- build_alias
- builddir
- datarootdir
- datadir
- docdir
- dvidir
- exec_prefix
- host_alias
- htmldir
- includedir
- infodir
- libdir
- libexecdir
- localedir
- localstatedir
- mandir
- oldincludedir
- pdfdir
- pkgdatadir
- prefix
- psdir
- sbindir
- sharedstatedir
- srcdir
- sysconfdir
- target_alias
- top_srcdir
- PACKAGE
- PACKAGE_BUGREPORT
- PACKAGE_NAME
- PACKAGE_STRING
- PACKAGE_TARNAME
- PACKAGE_URL
- PACKAGE_VERSION
- PATH_SEPARATOR
- SHELL
- VERSION
-"
-
-__ax_text_tpl_sed_rules=""
-for i in $__ax_text_tpl_default_variables
-do
-__ax_text_tpl_sed_rules="$__ax_text_tpl_sed_rules \
-sed_subst_var_pattern($i)"
-done
-
-__ax_text_tpl_sed_rules="$__ax_text_tpl_sed_rules \\
- \$(__ax_text_tpl_user_sed_rules) \\
- \$(_AX_TEXT_ADDITIONAL_SED_SUBSTITUTIONS) \\
- \$\$ax_text_add_sed_substs \\
- -e 's|@__FILE__[[@]]|\@S|@@|g'"
-
-__ax_text_tpl_sed_call="\$(SED) \$(__ax_text_tpl_sed_rules)"
-text_tpl_sed_call=$__ax_text_tpl_sed_call
-m4_pattern_allow(AM_V_GEN)
-
-# Convenient snippet to clean & prepare for following build
-text_tpl_gen_conv_verbose="rm -rf \@S|@@; \$(MKDIR_P) \$(@D)"
-text_tpl_gen_conv="\$(AM_V_GEN)\$(text_tpl_gen_conv_verbose)"
-
-# Instantiate arbitrary data text file
-text_tpl_gen_verbose="\$(text_tpl_gen_conv_verbose) && \$(__ax_text_tpl_sed_call) \$< > \@S|@@ && chmod -w \@S|@@"
-text_tpl_gen="\$(AM_V_GEN)\$(text_tpl_gen_verbose)"
-
-# Instantiate script file
-text_tpl_gen_script_verbose="\$(text_tpl_gen_verbose) && chmod +x \@S|@@"
-text_tpl_gen_script="\$(AM_V_GEN)\$(text_tpl_gen_script_verbose) && chmod +x \@S|@@"
-
-# Make dependencies for targets of $(text_tpl_gen) and $(text_tpl_gen_script)
-text_tpl_deps='$(top_builddir)/config.status'
-
-AC_PATH_PROG([SED], [sed])
-test -z "$ac_cv_path_SED" &&
- AC_MSG_ERROR([Sed is needed but not found.])
-
-AC_SUBST([__ax_text_tpl_sed_call])
-AC_SUBST([__ax_text_tpl_sed_rules])
-AC_SUBST([__ax_text_tpl_user_sed_rules])
-AC_SUBST([text_tpl_deps])
-AC_SUBST([text_tpl_sed_call])
-AC_SUBST([text_tpl_gen])
-AC_SUBST([text_tpl_gen_verbose])
-AC_SUBST([text_tpl_gen_conv])
-AC_SUBST([text_tpl_gen_conv_verbose])
-AC_SUBST([text_tpl_gen_script])
-AC_SUBST([text_tpl_gen_script_verbose])
-])
-
-# _AX_TEXT_TPL_SUBST SHELL_VARNAME [VALUE]
-# ----------------------------------------
-# Do substitution of SHELL_VARNAME both by config.status, and by sed call
-# in instantiation rules.
-AC_DEFUN([_AX_TEXT_TPL_SUBST], [
-test x = x"$2" || $1=$2
-__ax_text_tpl_user_sed_rules="$__ax_text_tpl_user_sed_rules\
-sed_subst_var_pattern($1)"
-AC_SUBST($1)
-])
-
-
-# _AX_TEXT_TPL_ARG_VAR VARNAME DEFAULT DESCRIPTION
-# ------------------------------------------------
-AC_DEFUN([_AX_TEXT_TPL_ARG_VAR], [
-AC_ARG_VAR([$1], [$3])
-test -z "$$1" && $1=$2
-_AX_TEXT_TPL_SUBST($1)
-])
diff --git a/m4/packaging.m4 b/m4/packaging.m4
deleted file mode 100644
index 3d166d3..0000000
--- a/m4/packaging.m4
+++ /dev/null
@@ -1,44 +0,0 @@
-AC_DEFUN([PGSETUP_PACKAGING_INIT], [
- AC_CACHE_CHECK(
- [for oprating system (distribution)],
- [pgsetup_cv_os_family], [
- pgsetup_cv_os_family=
- if test -r /etc/redhat-release; then
- pgsetup_cv_os_family=redhat
- fi
- ]
- )
-
- case $pgsetup_cv_os_family in
- redhat)
- AC_PATH_PROG([RPM], [rpm])
- if test -z "$ac_cv_path_RPM"; then
- AC_MSG_ERROR("can not find RPM package manager")
- fi
- ;;
- *)
- AC_MSG_ERROR([rpm distro only ATM (todo)])
- ;;
- esac
-])
-
-# PGSETUP_SUBST_REQ(VARIABLE,DESCRIPTION)
-# ---------------------------------------
-# Make sure that the VARIABLE is mentioned in './configure --help' output and
-# that it is not empty after processing this macro. Use the DESCRIPTION as a
-# comment.
-m4_define([PGSETUP_SUBST_REQ], [
- AC_ARG_VAR([$1], [$2])
- _AX_TEXT_TPL_SUBST([$1])
- test -z "$[]$1" &&
- AC_MSG_ERROR([the \$$1 variable is not set])
-])
-
-# PGSETUP_SUBST_OPT(VARIABLE, DEFAULT, DESCRIPTION)
-# -------------------------------------------------
-m4_define([PGSETUP_SUBST_OPT], [
- AC_ARG_VAR([$1], [$3])
- test -z "$[]$1" &&
- $1=$2
- _AX_TEXT_TPL_SUBST($1)
-])
diff --git a/postgresql-check-db-dir.in b/postgresql-check-db-dir.in
deleted file mode 100644
index 496732e..0000000
--- a/postgresql-check-db-dir.in
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/bin/bash
-
-# This script verifies that the postgresql data directory has been correctly
-# initialized. We do not want to automatically initdb it, because that has
-# a risk of catastrophic failure (ie, overwriting a valuable database) in
-# corner cases, such as a remotely mounted database on a volume that's a
-# bit slow to mount. But we can at least emit a message advising newbies
-# what to do.
-
-if test -z "$1"; then
- echo "Maintainer error: $0 must be run with one argument"
- exit 1
-fi
-
-service_name="$1"
-
-if [ -z "$PGDATA" ]; then
- echo $"You try to start '$service_name' service"
- echo $"but the required \$PGDATA environment variable is not set."
-
- if test @WANT_SYSVINIT@ -eq 1; then
- echo $"You should use the @initscriptsconfdir@/$service_name"
- else
- echo $"You should use the @systemduserunitsdir@/$service_name.service.d/ANYTHING.conf"
- fi
-
- echo $"configuration file to set \$PGDATA. For more info see"
- echo $"the @README_DIST@ file."
-
- exit 1
-fi
-
-
-# Warn the user that the configuration should be adjusted via drop-in, in case
-# the $PGDATA variable is set different way (and non-default service name is
-# used, systemd systems only).
-conf_dir="@systemduserunitsdir@/$service_name.service.d"
-if test @WANT_SYSVINIT@ = 0 && [[ "$service_name" == *@* ]] && test ! -d "$conf_dir"; then
- echo >&2 $"WARNING: Note that the '$conf_dir'"
- echo >&2 $"directory does not exist while you are using non-default service"
- echo >&2 $"name '$service_name'. You are encouraged to use the"
- echo >&2 $"$conf_dir directory for systemd configuration according"
- echo >&2 $"to @README_DIST@ documentation."
-fi
-
-# Full PostgreSQL version, e.g. 9.0.2
-PGVERSION=@PGVERSION@
-
-# Major version of PostgreSQL, e.g. 9.0
-PGMAJORVERSION=@PGMAJORVERSION@
-
-# Distribution README file
-README_DIST=@README_DIST@
-
-bad_version()
-{
- local real_version="$1"
-
- . "@rawpkgdatadir@/library.sh"
-
- while read id version; do
- test "$version" = "$real_version" || continue
-
- local cmd="postgresql-setup --upgrade"
-
- test "@NAME_DEFAULT_PREV_SERVICE@" = "$id" \
- || cmd="$cmd --upgrade-from $id"
-
- echo $"An old version of the database format was found."
- echo $"Use '$cmd' to upgrade to version '$PGMAJORVERSION'"
- echo $"See $README_DIST for more information."
-
- return
- done < <(parse_upgrade_setup list)
-
- echo $"An old version '$real_version' of the database format was found."
- echo $"You need to dump and reload before using PostgreSQL $PGVERSION."
- echo $"See $README_DIST for more information."
-
- return
-}
-
-# Check for the PGDATA structure
-if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ]
-then
- real_version=`cat "$PGDATA/PG_VERSION"`
- # Check version of existing PGDATA
- if [ x"$real_version" = x"$PGMAJORVERSION" ]
- then
- : A-OK
- else
- bad_version "$real_version"
- exit 1
- fi
-else
- # No existing PGDATA! Warn the user to initdb it.
- echo $"Directory \"$PGDATA\" is missing or empty."
- echo $"Use \"@bindir@/@NAME_BINARYBASE@-setup --initdb\""
- echo $"to initialize the database cluster."
- echo $"See $README_DIST for more information."
- exit 1
-fi
-
-exit 0
diff --git a/postgresql-ctl.in b/postgresql-ctl.in
deleted file mode 100644
index 569e4d3..0000000
--- a/postgresql-ctl.in
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-# Thin wrapper arount pg_ctl.
-#
-# This file exists for the following reasons:
-#
-# * It is s compat-wrapper for the cases when PGPORT *is* set directly in
-# postgresql.service (nowadays users should configure port directly in
-# postgresql.conf). This is hack which allows us to do a conditional step
-# before running pg_ctl (which is not allowed by systemd).
-#
-# * This helper script is necessary for having proper SELinux context of daemon
-# process run in SCL environment via systemd/sysvinit service file. Without
-# this script the process looses SELinux type because /usr/bin/scl
-# has context bin_t and 'unit_t -> bin_t' results in unconfined process.
-# This file must thus have 'postgresql_exec_t' fcontext.
-
-@SCL_SOURCE@
-
-# Help users to run postgresql server extensions built against specific
-# software collection (that said, such collection is runtime dependancy of
-# such extension, not the server itself).
-test -n "$PGSCLS" && source scl_source enable $PGSCLS
-
-opts=()
-test "$1" = "start" && test -n "$PGOPTS" && opts=(-o "$PGOPTS")
-
-# cleanup possibly empty PGPORT
-test -z "$PGPORT" && unset PGPORT
-
-exec @bindir@/pg_ctl "$@" "${opts[@]}"
diff --git a/postgresql-setup.in b/postgresql-setup.in
deleted file mode 100644
index ba9def2..0000000
--- a/postgresql-setup.in
+++ /dev/null
@@ -1,826 +0,0 @@
-#!/bin/bash
-#
-# postgresql-setup - Initialization and upgrade operations for PostgreSQL
-
-test -z "$PATH" && export PATH="/sbin:/usr/sbin:/bin:/usr/bin"
-
-test x"$PGSETUP_DEBUG" != x && set -x && PS4='${LINENO}: '
-
-# Directory containing the postmaster executable
-PGENGINE=@bindir@
-
-# Distribution README file
-README_DIST=@README_DIST@
-
-# Home directory of postgres user
-POSTGRES_HOMEDIR=@POSTGRES_HOMEDIR@
-
-# Convenient tool-aliases
-SU_POSTGRES="@SU_POSTGRES@"
-
-# The where PostgreSQL server listens by default
-PGPORT_DEF=5432
-
-. "@rawpkgdatadir@/library.sh"
-
-@SCL_SOURCE@
-
-# We upgrade by default from system's default PostgreSQL installation
-option_upgradefrom="@NAME_DEFAULT_PREV_SERVICE@"
-
-srvsuff=
-test 0 -eq @WANT_SYSVINIT@ && srvsuff=".service"
-
-USAGE_STRING=$"\
-Usage: $0 MODE_OPTION [--unit=UNIT_NAME] [OPTION...]
-
-Script is aimed to help sysadmin with basic database cluster administration.
-Usually, \"@NAME_BINARYBASE@-setup --initdb\" and \"@NAME_BINARYBASE@-setup --upgrade\" is
-enough, however there are other options described below.
-
-For more info and howto/when use this script please look at the documentation
-file $README_DIST.
-
-Available operation mode:
- --initdb Initialize new PostgreSQL database cluster. This is usually the
- first action you perform after PostgreSQL server installation.
- --upgrade Upgrade database cluster for new major version of PostgreSQL
- server. See the --upgrade-from option for more info.
-
-Options:
- --unit=UNIT_NAME The UNIT_NAME is used to select proper unit
- configuration (unit == service or initscript name
- on non-systemd systems). For example, if you want
- to work with unit called
- 'postgresql@com_example.service', you should use
- 'postgresql@com_example' (without trailing .service
- string). When no UNIT_NAME is explicitly passed,
- the 'postgresql' string is used by default.
- --port=PORT port where the initialized server will listen for
- connections"
-
-test 0 -eq @WANT_SYSVINIT@ && \
-USAGE_STRING+="
- --datadir=PATH Specify absolute path to DB data directory, only
- use with --new-systemd-unit.
- --new-systemd-unit Pre-generate system'd configuration in drop-in
- directory if the unit is not yet configured,
- requires non-default --unit specified and explicit
- --datadir and --port."
-
-USAGE_STRING+="
- --upgrade-from-unit=UNIT Select proper unit name to upgrade from. This
- has similar semantics as --unit option.
- --upgrade-ids Print list of available IDs of upgrade scenarios to
- standard output.
- --upgrade-from=ID Specify id \"old\" postgresql stack to upgrade
- from. List of available IDs can be listed by
- --upgrade-ids. Default is '$option_upgradefrom'.
-
-Other options:
- --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
- initdb(1)). This variable is used also during
- 'upgrade' mode because the new cluster is actually
- re-initialized from the old one.
- PGSETUP_PGUPGRADE_OPTIONS Options in this variable are passed next to the
- subsequent call of \`pg_upgrade\`. For more info
- about possible options please look at man
- pg_upgrade(1).
- PGSETUP_DEBUG Set to '1' if you want to see very verbose shell
- debugging output."
-
-
-print_version()
-{
- echo "@NAME_BINARYBASE@-setup @VERSION@"
- echo $"Built against PostgreSQL version @PGVERSION@."
-}
-
-
-check_not_initialized()
-{
- if test -f "$pgdata/PG_VERSION"; then
- error $"Data directory $pgdata is not empty!"
- return 1
- fi
- return 0
-}
-
-
-# code shared between initdb and upgrade actions
-perform_initdb()
-{
- if [ ! -e "$pgdata" ]; then
- mkdir "$pgdata" || return 1
- chown postgres:postgres "$pgdata"
- chmod go-rwx "$pgdata"
- fi
-
- # Clean up SELinux tagging for pgdata
- [ -x /sbin/restorecon ] && /sbin/restorecon "$pgdata"
-
- # Create the initdb log file if needed
- if [ ! -e "$initdb_log" -a ! -h "$initdb_log" ]; then
- touch "$initdb_log" || return 1
- chown postgres:postgres "$initdb_log"
- chmod go-rwx "$initdb_log"
- [ -x /sbin/restorecon ] && /sbin/restorecon "$initdb_log"
- fi
-
- # Initialize the database
- initdbcmd="@SCL_SOURCE@"
- initdbcmd+=" $PGENGINE/initdb --pgdata='$pgdata' --auth='ident'"
- initdbcmd+=" $PGSETUP_INITDB_OPTIONS"
-
- $SU_POSTGRES -c "$initdbcmd" >> "$initdb_log" 2>&1 < /dev/null
-
- # Create directory for postmaster log files
- mkdir "$pgdata/pg_log"
- chown postgres:postgres "$pgdata/pg_log"
- chmod go-rwx "$pgdata/pg_log"
- [ -x /sbin/restorecon ] && /sbin/restorecon "$pgdata/pg_log"
-
- # This if-fork is just to not unnecessarily overwrite what upstream
- # generates by initdb (upstream implicitly uses PGPORT_DEF).
- if test "$pgport" != "$PGPORT_DEF"; then
- local pgconf="$pgdata/postgresql.conf"
- sed -i "s|^[[:space:]#]*port[[:space:]]=[^#]*|port = $pgport |g" \
- "$pgconf" \
- && grep "^port = " "$pgconf" >/dev/null
-
- if test $? -ne 0; then
- error "can not change port in $pgdata/postgresql.conf"
- return 1
- fi
- fi
-
- test -f "$pgdata/PG_VERSION"
-}
-
-
-initdb()
-{
- port_info=
- test "$pgport" != "$PGPORT_DEF" \
- && port_info=$", listening on port '$pgport'"
-
- info $"Initializing database in '$pgdata'$port_info"
- if check_not_initialized && perform_initdb; then
- info $"Initialized, logs are in ${initdb_log}"
- cleanup_dropin=
- else
- error $"Initializing database failed, possibly see $initdb_log"
- script_result=1
- fi
-}
-
-
-old_data_in_use()
-{
- local pidfile="$pgdataold/postmaster.pid"
- test -f "$pidfile" || return 1
- error $"The pidfile '$pidfile' exists. Verify that there is no postmaster"
- error_q $"running the $pgdataold directory."
-}
-
-
-upgrade()
-{
- local inplace=false
- test "$pgdata" = "$upgradefrom_data" && inplace=true
-
- debug "running inplace upgrade: $inplace"
-
- # must see previous version in PG_VERSION
- local old_data_version="`cat "$upgradefrom_data/PG_VERSION"`"
- if [ ! -f "$upgradefrom_data/PG_VERSION" -o \
- x"$old_data_version" != x"$upgradefrom_major" ]
- then
- error $"Cannot upgrade because the database in $upgradefrom_data is of"
- error_q $"version $old_data_version but it should be $upgradefrom_major"
- exit 1
- fi
- if [ ! -x "$upgradefrom_engine/postgres" ]; then
- error $"Please install the $upgradefrom_package package."
- exit 5
- fi
-
- # Set up log file for pg_upgrade
- rm -f "$upgrade_log"
- touch "$upgrade_log" || die "can't write into $upgrade_log file"
-
- chown postgres:postgres "$upgrade_log"
- chmod go-rwx "$upgrade_log"
- [ -x /sbin/restorecon ] && /sbin/restorecon "$upgrade_log"
-
- # Move old DB to pgdataold
-
- if $inplace; then
- pgdataold="${pgdata}-old"
- rm -rf "$pgdataold"
- mv "$pgdata" "$pgdataold" || exit 1
- else
- pgdataold="$upgradefrom_data"
- fi
-
- # Create configuration file for upgrade process
- HBA_CONF_BACKUP="$pgdataold/pg_hba.conf.@NAME_BINARYBASE@-setup.`date +%s`"
- HBA_CONF_BACKUP_EXISTS=0
-
- if [ ! -f $HBA_CONF_BACKUP ]; then
- mv "$pgdataold/pg_hba.conf" "$HBA_CONF_BACKUP"
- HBA_CONF_BACKUP_EXISTS=1
-
- # For fluent upgrade 'postgres' user should be able to connect
- # to any database without password. Temporarily, no other type
- # of connection is needed.
- echo "local all postgres ident" > "$pgdataold/pg_hba.conf"
- fi
-
- info $"Upgrading database."
-
- scls_upgrade_hacks=
- test -n "$upgradefrom_scls" && {
- debug "scls [$upgradefrom_scls] will be enabled"
- scls_upgrade_hacks="source scl_source enable $upgradefrom_scls ;"
- }
-
- test -n "$upgradefrom_redhat_sockets_hack" && {
- debug "upgrading from redhat server"
- socket_hacks="export REDHAT_PGUPGRADE_FROM_RHEL=yes ;"
- }
-
- test -n "$upgradefrom_pghost_override" && {
- pghost_override="PGHOST='$upgradefrom_pghost_override'"
- }
-
- local failure_cleanup=true
- if old_data_in_use; then
- script_result=1
- # Cleanup makes sense once perform_initdb gets called.
- failure_cleanup=false
- elif ! check_not_initialized; then
- # Don't try to re-init initialized data directory and also do not
- # remove it after this unsuccessful upgrade.
- script_result=1
- failure_cleanup=false
- elif perform_initdb; then
- $inplace && link_option=--link
-
- # After creating the empty new-format database, do the upgrade
- run_cmd_as_dbadmin "\
- $scls_upgrade_hacks \
- $socket_hacks \
- $pghost_override \
- $PGENGINE/pg_upgrade \
- '--old-bindir=$upgradefrom_engine' \
- '--new-bindir=$PGENGINE' \
- '--old-datadir=$pgdataold' \
- '--new-datadir=$pgdata' \
- $link_option \
- '--old-port=$PGPORT' '--new-port=$PGPORT' \
- @PG_UPGRADE_BIN_USER_OPT@=postgres \
- $PGSETUP_PGUPGRADE_OPTIONS" \
- "$upgrade_log" "$upgrade_log"
- if [ $? -ne 0 ]; then
- # pg_upgrade failed
- error $"pg_upgrade tool failed"
- script_result=1
- fi
- else
- error $"initdb failed"
- script_result=1
- fi
-
- # Move back the backed-up pg_hba.conf regardless of the script_result.
- if [ x$HBA_CONF_BACKUP_EXISTS = x1 ]; then
- mv -f "$HBA_CONF_BACKUP" "$pgdataold/pg_hba.conf"
- fi
-
- if [ $script_result -eq 0 ]; then
- info $"Upgraded OK."
- warn $"The configuration files were replaced by default configuration."
- warn $"The previous configuration and data are stored in folder"
- warn $pgdataold.
- else
- # Clean up after failure.
- $failure_cleanup && rm -rf "$pgdata"
- $inplace && mv "$pgdataold" "$pgdata"
- error $"Upgrade failed."
- fi
- info $"See $upgrade_log for details."
-}
-
-
-generate_systemd_dropin()
-{
- local service="$1"
- local dropindir="@systemduserunitsdir@/$service.service.d"
- local dropin="$dropindir/30-@NAME_BINARYBASE@-setup.conf"
-
- test -e "$dropindir" \
- && die "The systemd drop-in directory '$dropindir' exists already"
-
- mkdir -p "$dropindir" \
- || die "Can not create '$dropindir'"
-
- cleanup_dropin="rm -rf \"$dropindir\""
-
- cat <<EOF > "$dropin" || die "Can not write to '$dropin'"
-[Service]
-Environment=PGDATA=$pgdata
-EOF
-
- reload_systemd="systemctl daemon-reload"
- $reload_systemd || die $"Can not perform '$reload_systemd'"
-
- info $"The '$option_service' configured in '$dropindir' directory"
-}
-
-
-check_daemon_reload()
-{
- local nr_option=NeedDaemonReload
-
- test @WANT_SYSVINIT@ = 1 && return 0
-
- local nr_out="`systemctl show -p $nr_option $option_service.service 2>/dev/null`"
- if [[ "$nr_out" != "$nr_option=no" ]]; then
- error $"Note that systemd configuration for '$option_service' changed."
- error_q $"You need to perform 'systemctl daemon-reload' otherwise the"
- error_q $"results of this script can be inadequate."
- exit 1
- fi
-}
-
-
-handle_service_env()
-{
- local service="$1"
-
- local systemd_env="$(systemctl show -p Environment "${service}.service")" \
- || { return; }
-
- for env_var in `echo "$systemd_env" | sed 's/^Environment=//'`; do
- # If one variable name is defined multiple times the last definition wins.
- case "$env_var" in
- PGDATA=*)
- unit_pgdata="${env_var##PGDATA=}"
- debug "unit's datadir: '$unit_pgdata'"
- ;;
- PGPORT=*)
- unit_pgport="${env_var##PGPORT=}"
- debug "unit's pgport: $unit_pgport"
- ;;
- esac
- done
-}
-
-
-handle_envfile()
-{
- local file="$1"
-
- debug "trying to read '$file' env file"
- if test ! -r "$file"; then
- if test @WANT_SYSVINIT@ = 1; then
- return
- fi
- error "Can not read EnvironmentFile '$file' specified"
- error_q "in ${service}.service"
- fi
-
- # Note that the env file parser in systemd does not perform exactly the
- # same job.
- unset PGPORT PGDATA
- . "$file"
- envfile_pgdata="$PGDATA"
- envfile_pgport="$PGPORT"
- unset PGPORT PGDATA
-}
-
-
-handle_service_envfiles()
-{
- local mode="$1"
- local service="$2"
-
- local envfiles="$(systemctl show -p EnvironmentFiles "${service}.service")"\
- || return
-
- test -z "$envfiles" && return
-
- envfiles=$(echo $envfiles | \
- sed -e 's/^EnvironmentFile=//' \
- -e 's| ([^)]*)$||'
- )
-
- # Read the file names line-by-line (spaces may be inside)
- while read line; do
- handle_envfile "$line"
- done <<<"$envfiles"
-}
-
-
-handle_pgconf()
-{
- local datadir="$1"
- local conffile="$datadir/postgresql.conf"
-
- debug "postgresql.conf: $conffile"
-
- test -r "$conffile" || {
- error "config file $conffile is not readable or does not exist"
- die "Old cluster in '$data' does not seem to be initialized"
- }
-
- local sp='[[:space:]]'
- local sed_expr="s/^$sp*port$sp*=$sp\([0-9]\+\).*/\1/p"
-
- rv=0
- conf_pgport=`sed -n "$sed_expr" $conffile | tail -1` || rv=1
- test -n "$conf_pgport" && debug "postgresql.conf pgport: $conf_pgport"
- return $rv
-}
-
-
-service_configuration()
-{
- local data=
- local port=
- local unit_pgport=
- local unit_pgdata=
- local envfile_pgport=
- local envfile_pgdata=
-
- # 'mode' is 'initdb' or 'upgrade'. Basically, if called with mode=initdb, we
- # parse configuration of the current (maybe already configured) service.
- # When run with mode=upgrade, we try to parse the configuration of the old
- # PostgreSQL configuration that we try to upgrade from.
-
- local mode="$1" datavar="$2" portvar="$3" service="$4"
-
- debug "running service_configuration() for $service, mode: $mode"
-
- if test "@WANT_SYSVINIT@" = 1; then
- # Sysvinit has the default PGDATA (for default unit name only)
- # configured directly in the initscript, so no additional configuration
- # must exist. Set the default value of pgdata here to match whats in
- # initscript for the cases when no additional configuration file exists.
- # This is done to avoid parsing of whole initscript (for the real value)
- # and mainly to not fail in the logic following 'service_configuration'
- # call, where we usually want to error that pgdata is not defined..
- # Don't set the default pgdata for upgrade case, however, as we must
- # upgrade only from already properly configured & working stack (missing
- # pgdata here is a good reason to die later).
- test initdb = "$mode" && test "$service" = "@NAME_SERVICE@" \
- && set_var "$datavar" "@PGDATADIR@"
- handle_envfile "@initscriptsconfdir@/$service"
- else
- # We ship two service files, @NAME_SERVICE@.service and
- # @NAME_SERVICE@@.service. The former has PGDATA set by default
- # similarly to sysvinit case.
- handle_service_env "$service"
- handle_service_envfiles "$option_mode" "$service"
- fi
-
- # EnvironmentFile beats Environment configuration in systemd. In sysvinit
- # there is no "unit_pgdata". So make sure the envfile_gpdata is used later
- # than unit_pgdata.
- test -n "$unit_pgdata" && set_var "$datavar" "$unit_pgdata"
- test -n "$envfile_pgdata" && set_var "$datavar" "$envfile_pgdata"
-
- # skip for the first run
- test initdb = "$mode" && return
-
- set_var data "\$$datavar"
- handle_pgconf "$data"
-
- test -n "$conf_pgport" && set_var "$portvar" "$conf_pgport"
- test -n "$unit_pgport" && set_var "$portvar" "$unit_pgport"
- test -n "$envfile_pgport" && set_var "$portvar" "$envfile_pgport"
-}
-
-cleanup_dropin=
-exit_handler()
-{
- test -n "$cleanup_dropin" && {
- info "cleaning up created dropin directory"
- eval "$cleanup_dropin"
- }
-}
-
-trap exit_handler 0
-
-# <Compat>
-# Alow users to use the old style arguments like
-# 'postgresql-setup initdb $SERVICE_NAME'.
-case "$1" in initdb|upgrade)
- action="--$1"
- shift
-
- warn "using obsoleted argument syntax, try --help"
- old_long_args="help,usage,version,debug"
- oldargs=`getopt -o "" -l "$old_long_args" -n "old-options" -- "$@"` \
- || die "can't parse old arguments"
- eval set -- "$oldargs"
- additional_opts=
- while true; do
- case "$1" in
- --version|--help|--usage|--debug)
- additional_opts="$additional_opts $1"
- shift
- ;;
- --)
- shift
- break
- ;;
- esac
- done
-
- service="@NAME_SERVICE@"
- if test -n "$1"; then
- service=$1
- shift
- fi
-
- 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="@NAME_SERVICE@"
-option_port=
-option_pgdata=
-option_debug=0
-option_upgradefrom_unit=
-
-# Content of EnvironmentFile= files fills those:
-envfile_pgdata=
-envfile_pgport=
-
-# Configuration from (/etc/systemd/system/$option_service.service) fills those
-# variables.
-unit_pgdata=
-unit_pgport=
-
-# Configuration from postgresql.conf:
-conf_pgport=
-
-# Key variables. Try to fill them by postgresql.conf, Environment= statement in
-# service file or EnvironmentFile= content (the later mentioned has more
-# priority).
-pgdata=default
-pgport=default
-
-## PARSE SCRIPT ARGUMENTS ##
-
-short_opts=""
-long_opts="\
-initdb,upgrade,\
-new-systemd-unit,upgrade-ids,\
-unit:,service:,port:,datadir:,upgrade-from:,upgrade-from-unit:,\
-debug,\
-version,help,usage"
-
-args=`getopt -o "$short_opts" -l "$long_opts" -n "@NAME_BINARYBASE@-setup" -- "$@"` \
- || die "can't parse arguments"
-eval set -- "$args"
-parse_fail=0
-while true; do
- case "$1" in
- --initdb|--upgrade)
- if test "$option_mode" != none; then
- error "bad argument $1, mode already specified: --$option_mode"
- parse_fail=1
- else
- option_mode=${1##--}
- fi
- shift
- ;;
-
- --unit|--service)
- option_service=$2
- shift 2
- ;;
-
- --port)
- option_port=$2
- shift 2
- ;;
-
- --new-systemd-unit)
- option_systemd_config=yes
- shift
- ;;
-
- --datadir)
- option_pgdata=$2
- shift 2
- ;;
-
- --debug)
- option_debug=1
- shift
- ;;
-
- --help|--usage)
- echo "$USAGE_STRING"
- exit 0
- ;;
-
- --upgrade-from)
- option_upgradefrom="$2"
- shift 2
- ;;
-
- --upgrade-from-unit)
- option_upgradefrom_unit="$2"
- shift 2
- ;;
-
- --upgrade-ids)
- parse_upgrade_setup help
- exit 0
- ;;
-
- --version)
- print_version
- exit 0
- ;;
-
- --)
- shift
- break
- ;;
-
- *)
- die "author's fault: option $1 not handled"
- break
- ;;
- esac
-done
-
-test $parse_fail -ne 0 && die "can't parse arguments"
-
-test "$option_mode" = none \
- && die "no mode specified, use --initdb or --upgrade, or --help"
-
-if ! parse_upgrade_setup config "$option_upgradefrom"; then
- if test upgrade = "$option_mode"; then
- die $"bad --upgrade-from parameter '$option_upgradefrom'," \
- $"try --upgrade-ids"
- fi
-fi
-
-## GATHER THE SETUP FIRST ##
-
-initdb_log="$POSTGRES_HOMEDIR/initdb_${option_service}.log"
-upgrade_log="$POSTGRES_HOMEDIR/upgrade_${option_service}.log"
-
-debug "mode used: $option_mode"
-debug "service name: $option_service"
-
-root_prereq
-
-# load service's pgdata
-service_configuration initdb pgdata UNUSED "$option_service"
-
-# Check that nothing breaks --new-systemd-unit
-if test "$option_systemd_config" = yes; then
- if test "$option_service" = "@NAME_SERVICE@"; then
- die $"Default unit '@NAME_SERVICE@.service' should not need --new-systemd-unit"
- elif test "$pgdata" != default; then
- die $"Option --new-systemd-unit failed, is '$option_service.service'"\
- $"already configured to '$pgdata'?"
- elif test -z "$option_pgdata"; then
- die $"Option --new-systemd-unit requires --datadir"
- fi
-
- # pgdata == default && option_pgdata is set
- pgdata="$option_pgdata"
-
-elif test -n "$option_pgdata"; then
- warn $"--datadir option is ignored, either use --new-systemd-unit"
- warn_q $"option, or configure the systemd unit manually."
-fi
-
-test "$pgdata" = default \
- && die $"no db datadir (PGDATA) configured for '$option_service$srvsuff' unit"
-
-[[ "$pgdata" =~ ^/.* ]] \
- || die $"the PostgreSQL datadir not absolute path: '$pgdata', try --debug"
-
-test "$option_systemd_config" = yes \
- && generate_systemd_dropin "$option_service"
-
-## GATHER DATA FROM INITIALIZED DATADIR ##
-
-test -n "$option_port" && pgport=$option_port
-
-if test upgrade = "$option_mode"; then
- upgradefrom_data="$upgradefrom_data_default"
-
- if test -z "$option_upgradefrom_unit"; then
- if test "@NAME_DEFAULT_PREV_SERVICE@" = "@NAME_SERVICE@"; then
- # Fedora usecase -> upgrade while keeping the same name of
- # service/unit.
- option_upgradefrom_unit=$option_service
- else
- # PGRPMs/RHSCL usecase -> we upgrade from one service/unit name to
- # a different one, e.g. from postgresql92 to postgresql93, or from
- # postgresql (system version) to postgresql94 (scl).
- option_upgradefrom_unit=$upgradefrom_id
-
- # Try to predict situations: postgresql93@second -> postgresql94@second
- if [[ "$option_service" =~ ^@NAME_SERVICE@@(.*)$ ]]; then
- option_upgradefrom_unit="$upgradefrom_id@${BASH_REMATCH[1]}"
- fi
- fi
- fi
-
- test "$option_service" = "$option_upgradefrom_unit" \
- || info "upgrading from '$option_upgradefrom_unit$srvsuff'" \
- "to '$option_service$srvsuff'"
-
- service_configuration upgrade upgradefrom_data pgport \
- "$option_upgradefrom_unit"
- test -n "$option_port" -a "$option_port" != "$pgport" \
- && warn "Old pgport $pgport has bigger priority than --pgport value."
-fi
-
-# We expect that for upgrade - the previous stack was in working state (thus
-# running on the default port).
-test "$option_mode" = upgrade -a "$pgport" = default \
- && pgport=$PGPORT_DEF
-
-# This is mostly for 'initdb'. We assume that the default port is $PGPORT_DEF
-# if not set explicitly for default service name 'postgresql'.
-if test "$pgport" = default -a "$option_service" = "@NAME_SERVICE@"; then
- debug $"Using the default port '$PGPORT_DEF'"
- pgport=$PGPORT_DEF
-fi
-
-if test "$pgport" = default; then
- # initdb case.. Note that this may be called by initscripts. If this gets
- # called by legacy script, we can't help too much because systemd does not
- # allow passing additional arguments to 'service XX initdb' command.
- die $"For non-default unit names you must specify port by --port option."
-fi
-
-[[ "$option_port" =~ ^[0-9]*$ ]] \
- || die $"port set to '$option_port', must be integer number"
-
-## LAST CHECK THE SETUP ##
-
-check_daemon_reload
-
-# These variables are read by underlying utilites, rather export them.
-export PGDATA=$pgdata
-export PGPORT=$pgport
-
-debug "final pgdata: $pgdata"
-debug "final pgport: $pgport"
-
-script_result=0
-
-$SU_POSTGRES -c 'test -w @POSTGRES_HOMEDIR@' || {
- # pg_upgrade binary needs to have write-able $PWD (and we use 'su -')
- error $"The @POSTGRES_HOMEDIR@ directory has wrong permissions."
- error_q $"Please make sure the directory is writable by postgres."
- exit 1
-}
-
-if @MOUNTPOINT@ -q "$pgdata" || @MOUNTPOINT@ -q "$(dirname "$pgdata")"; then
- warn $"Note that either your data directory '$pgdata' or"
- warn_q $"the parent directory '$(dirname "$pgdata")'"
- warn_q $"is a direct mountpoint. This is usually a bad idea and your"
- warn_q $"filesystem layout should ideally look like:"
- warn_q $"/ROOT_OWNED_MOUNTPOINT/POSTGRES_OWNED_DIRECTORY/DATADIR."
- warn_q $"See the upstream documentation for more info:"
- warn_q $"http://www.postgresql.org/docs/@PGMAJORVERSION@/static/creating-cluster.html"
-fi
-
-# See how we were called.
-case "$option_mode" in
- initdb)
- initdb
- ;;
- upgrade)
- upgrade
- ;;
- *)
- echo >&2 "$USAGE_STRING"
- exit 2
-esac
-
-exit $script_result
diff --git a/postgresql.init.in b/postgresql.init.in
deleted file mode 100644
index a078c28..0000000
--- a/postgresql.init.in
+++ /dev/null
@@ -1,287 +0,0 @@
-#!/bin/bash
-#
-# @NAME_SERVICE@
-#
-# This is the init script for starting up the PostgreSQL server.
-#
-# This script is slightly unusual in that the name of the daemon (postmaster)
-# is not the same as the name of the subsystem (postgresql)
-#
-# chkconfig: - 64 36
-# description: PostgreSQL database server.
-# processname: postmaster
-# pidfile: /var/run/postmaster.PORT.pid
-
-### BEGIN INIT INFO
-# Provides: @NAME_SERVICE@
-# Required-Start: $local_fs $remote_fs $network $named $syslog $time
-# Required-Stop: $local_fs $remote_fs $network $named $syslog $time
-# Short-Description: start and stop PostgreSQL @PGVERSION@ server
-# Description: PostgreSQL database server
-### END INIT INFO
-
-# PGVERSION is the full package version, e.g., 9.0.2
-# Note: the specfile inserts the correct value during package build
-PGVERSION=@PGVERSION@
-
-# PGMAJORVERSION is major version, e.g., 9.0 (this should match PG_VERSION)
-PGMAJORVERSION=@PGMAJORVERSION@
-
-# PGDOCDIR is the directory containing the package's documentation
-# Note: the specfile inserts the correct value during package build
-
-# Distribution README file
-README_DIST=@README_DIST@
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-# Get network config.
-. /etc/sysconfig/network
-
-# postgresql-setup library
-. "@rawpkgdatadir@/library.sh"
-
-@SCL_SOURCE@
-
-# Find the name of the script
-NAME=`basename $0`
-if [ ${NAME:0:1} = "S" -o ${NAME:0:1} = "K" ]
-then
- NAME=${NAME:3}
-fi
-
-# Set defaults for configuration variables
-PGENGINE=@bindir@
-
-# Only default system service has default PGDATA set. This allows us to catch
-# admin's mistake of not creating /etc/sysconfig/psql/$NAME configuration file
-# and just hard/symlinking default init script. That way we can avoid (inside
-# postgresql-check-db-dir) runnnig "secondary" server against "default" data
-# directory.
-if test "@NAME_SERVICE@" = "$NAME"; then
- PGDATA=@PGDATADIR@
-fi
-
-PGLOG=@POSTGRES_HOMEDIR@/pgstartup-@NAME_SERVICE@.log
-
-# Value to set as postmaster process's oom_adj
-PG_OOM_ADJ=-17
-
-# Override defaults from /etc/sysconfig/pgsql if file is present
-[ -f /etc/sysconfig/pgsql/${NAME} ] && . /etc/sysconfig/pgsql/${NAME}
-
-export PGDATA
-export PGPORT
-export PGSTARTTIMEOUT
-export PGSCLS
-
-lockfile="/var/lock/subsys/${NAME}"
-
-# Ideally, we should use $PGDATA/postmaster.pid. It apparently works, but to
-# be honest I'm not sure about consequences. Most probably 'service status'
-# would not work for non-root/non-postgres users. TODO?
-pidfile="/var/run/${NAME}.pid"
-
-script_result=0
-
-start()
-{
- [ -x "$PGENGINE/postgres" ] || exit 5
-
- PSQL_START=$"Starting ${NAME} service: "
-
- # Make sure startup-time log file is valid
- if [ ! -e "$PGLOG" -a ! -h "$PGLOG" ]
- then
- touch "$PGLOG" || exit 4
- chown postgres:postgres "$PGLOG"
- chmod go-rwx "$PGLOG"
- [ -x /sbin/restorecon ] && /sbin/restorecon "$PGLOG"
- fi
-
- @libexecdir@/postgresql-check-db-dir "$NAME" || {
- echo_failure
- echo
- exit 1
- }
-
- echo -n "$PSQL_START"
- test x"$PG_OOM_ADJ" != x && echo "$PG_OOM_ADJ" > /proc/self/oom_adj
-
- # Note that this does not fail/exit the 'service start' if the postmaster
- # is already running. We should probably 'status' first and start only if
- # postmaster is down. This just unnecessarily wastes time and generates
- # too much (false) rush in $PGLOG.
- #
- # The maximum waiting time PGSTARTTIMEOUT is set to 30 second to not hold
- # the system too long. See `man pg_ctl & -w option`. This is not issue in
- # case of systemd.
- #
- # PGSTARTWAIT turns on waiting for server to become fully ready to accept
- # connection.
-
- # clean the variable if not set to 1
- test x1 != x"$PGSTARTWAIT" && PGSTARTWAIT=
-
- # success if already started (pg_ctl -w could fail later)
- status -p "$pidfile" postgres &>/dev/null && {
- success "$PSQL_START"
- echo
- exit 0
- }
-
- run_cmd_as_dbadmin "\
- PGSCLS=$(printf %q "$PGSCLS") \
- PGOPTS=$(printf %q "$PGOPTS") \
- PGPORT=$(printf %q "$PGPORT") \
- @libexecdir@/postgresql-ctl start -D $(printf %q "$PGDATA") -s \
- ${PGSTARTWAIT:+-w -t ${PGSTARTTIMEOUT:-30}}" \
- "$PGLOG" "$PGLOG"
-
- if test $? -ne 0; then
- failure "$PSQL_START"
- echo
- script_result=1
- return
- fi
-
- # pg_ctl succeed, now recognize the pid number
-
- pid=
- if test x1 != x"$PGSTARTWAIT" ; then
- # We don't wait for the full postgresql server start. In this case,
- # wait for pidfile creation only. This should take _very_ short time in
- # most cases but on highly overloaded machines - several seconds may
- # not be enough. See rhbz#800534 and rhbz#1188942 for more info.
- # Original waiting implementation by Jozef Mlích.
-
- decounter=${PGSTARTTIMEOUT:-30}
- while test "$decounter" -ge 0; do
- pid=$(head -n 1 "$PGDATA/postmaster.pid" 2>/dev/null)
-
- test "x$pid" != x && break
-
- # pidfile does not exist yet, wait a sec more
- decounter=$(( decounter - 1 ))
- sleep 1
- done
- else
- # pg_ctl -w succeed, pidfile must exist if everything is OK
- pid=$(head -n 1 "$PGDATA/postmaster.pid" 2>/dev/null)
- fi
-
- if test "x$pid" != x; then
- success "$PSQL_START"
- touch "$lockfile"
- echo "$pid" > "$pidfile"
- echo
- else
- failure "$PSQL_START"
- echo
- script_result=1
- fi
-}
-
-stop()
-{
- echo -n $"Stopping ${NAME} service: "
- if [ -e "$lockfile" ]
- then
- run_cmd_as_dbadmin \
- "$PGENGINE/pg_ctl stop -D '$PGDATA' -s -m fast" \
- /dev/null /dev/null
- ret=$?
- if [ $ret -eq 0 ]
- then
- echo_success
- rm -f "$pidfile"
- rm -f "$lockfile"
- else
- echo_failure
- script_result=1
- fi
- else
- # not running; per LSB standards this is "ok"
- echo_success
- fi
- echo
-}
-
-restart(){
- stop
- start
-}
-
-condrestart(){
- [ -e "$lockfile" ] && restart || :
-}
-
-reload()
-{
- run_cmd_as_dbadmin "$PGENGINE/pg_ctl reload -D '$PGDATA' -s" \
- /dev/null /dev/null
-}
-
-__single_comand()
-{
- local msg="$1"
- shift
- echo $"$msg ($@)"
- "$@" && success || failure || script_result=1
- echo
-}
-
-
-initdb()
-{
- __single_comand $"Initializing database" \
- @bindir@/@NAME_BINARYBASE@-setup --initdb --unit "$NAME" "$@"
-}
-
-
-upgrade()
-{
- __single_comand $"Upgrading database" \
- @bindir@/@NAME_BINARYBASE@-setup --upgrade --unit "$NAME" "$@"
-}
-
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- status -p "$pidfile" postgres
- script_result=$?
- ;;
- restart)
- restart
- ;;
- condrestart|try-restart)
- condrestart
- ;;
- reload)
- reload
- ;;
- force-reload)
- restart
- ;;
- initdb)
- shift
- initdb "$@"
- ;;
- upgrade)
- shift
- upgrade "$@"
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|initdb|upgrade}"
- exit 2
-esac
-
-exit $script_result
diff --git a/postgresql.service.in b/postgresql.service.in
deleted file mode 100644
index aac0054..0000000
--- a/postgresql.service.in
+++ /dev/null
@@ -1,50 +0,0 @@
-# It's not recommended to modify this file in-place, because it will be
-# overwritten during package upgrades. It is recommended to use systemd
-# "dropin" feature; i.e. create file with suffix .conf under
-# @systemduserunitsdir@/UNITNAME.service.d directory overriding the
-# unit's defaults. Look at systemd.unit(5) manual page for more info.
-
-[Unit]
-Description=PostgreSQL database server
-After=network.target
-
-[Service]
-Type=forking
-
-User=postgres
-Group=postgres
-
-# Where to send early-startup messages from the server (before the logging
-# options of postgresql.conf take effect)
-# This is normally controlled by the global default set by systemd
-# StandardOutput=syslog
-
-# Disable OOM kill on the postmaster
-OOMScoreAdjust=-1000
-# ... but allow it still to be effective for child processes
-# (note that these settings are ignored by Postgres releases before 9.5)
-Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
-Environment=PG_OOM_ADJUST_VALUE=0
-
-# Maximum number of seconds pg_ctl will wait for postgres to start. Note that
-# PGSTARTTIMEOUT should be less than TimeoutSec value.
-Environment=PGSTARTTIMEOUT=270
-
-@PGDATA_ENVIRONMENT@
-
-ExecStartPre=@libexecdir@/postgresql-check-db-dir %N
-
-# Use convenient postgresql-ctl wrapper instead of directly pg_ctl. See the
-# postgresql-ctl file itself for more info.
-
-ExecStart=@libexecdir@/postgresql-ctl start -D ${PGDATA} -s -w -t ${PGSTARTTIMEOUT}
-ExecStop=@libexecdir@/postgresql-ctl stop -D ${PGDATA} -s -m fast
-ExecReload=@libexecdir@/postgresql-ctl reload -D ${PGDATA} -s
-
-# Give a reasonable amount of time for the server to start up/shut down.
-# Ideally, the timeout for starting PostgreSQL server should be handled more
-# nicely by pg_ctl in ExecStart, so keep its timeout smaller than this value.
-TimeoutSec=300
-
-[Install]
-WantedBy=multi-user.target
diff --git a/share/postgresql-setup/.gitignore b/share/postgresql-setup/.gitignore
deleted file mode 100644
index 64c0145..0000000
--- a/share/postgresql-setup/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-upgrade.conf
-library.sh
diff --git a/share/postgresql-setup/Makefile.inc b/share/postgresql-setup/Makefile.inc
deleted file mode 100644
index 23c07d8..0000000
--- a/share/postgresql-setup/Makefile.inc
+++ /dev/null
@@ -1,21 +0,0 @@
-lib = %D%/library.sh
-lib_in = $(srcdir)/$(lib).in
-
-rawdata_generated_files = \
- $(lib)
-
-rawdata_template_files = \
- $(lib_in)
-
-rawdata_static_files =
-
-rawpkgdata_DATA = \
- $(rawdata_generated_files)
-
-GENERATED_FILES += $(rawdata_generated_files)
-EXTRA_DIST += $(rawdata_static_files) $(rawdata_template_files)
-
-$(lib): $(lib_in) $(c_s)
- $(text_tpl_gen)
-
-# vim: ft=automake noet
diff --git a/share/postgresql-setup/library.sh.in b/share/postgresql-setup/library.sh.in
deleted file mode 100644
index 9835029..0000000
--- a/share/postgresql-setup/library.sh.in
+++ /dev/null
@@ -1,139 +0,0 @@
-die() { echo >&2 $"FATAL: $@" ; exit 1 ; }
-error() { echo >&2 $"ERROR: $@" ; }
-error_q() { echo >&2 $" $@" ; }
-warn() { echo >&2 $"WARNING: $@" ; }
-warn_q() { echo >&2 $" $@" ; }
-info() { echo >&2 $" * $@" ; }
-info_q() { echo >&2 $" $@" ; }
-debug() { test "$option_debug" = "1" && echo >&2 $"DEBUG: $@"; }
-
-
-set_var()
-{
- eval "$1=\"$2\""
-}
-
-
-root_prereq()
-{
- test "$(id -u)" -eq 0 || die "$0 requires root access for this action"
-}
-
-
-read_config_file()
-{
- local key="" val=""
-
- test -r "$1" || die "can't read file '$1'"
-
- for i in $2; do
- eval "unset __pg_conf_$i"
- done
-
- # No easy (and secure) way to read configuration files from bash script,
- # sorry.
- while read key val; do
- [[ $key =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]] || return 1
-
- case " $2 " in
- *" $key "*)
- ;;
- *)
- warn "config file '$1': unknown key '$key'"
- continue
- ;;
- esac
-
- # Strip double quotes
- case "$val" in
- \"*\")
- val=${val##\"}
- val=${val%%\"}
- ;;
- esac
-
- # Make it reasonably safe. Keep dolar-sign escaped.
- eval "__pg_conf_$key=\$val"
-
- done < <(grep -v -e "^$" -e "^#" < "$1")
-}
-
-
-parse_upgrade_setup()
-{
- local action="$1"
- local expected_id="$2"
- local id temp_major temp_engine temp_data_default temp_description
-
- local upgrade_confdir="@sysconfdir@/@NAME_BINARYBASE@-setup/upgrade"
-
- debug "using 'upgrade' confdir $upgrade_confdir"
- test -d "$upgrade_confdir" || die "can't read confdir $upgrade_confdir"
-
- local my_vars="id comment data_default engine description major scls \
- redhat_sockets_hack pghost_override package"
- while read conffile
- do
- read_config_file "$conffile" "$my_vars"
-
- if test help = "$action"; then
- echo "$__pg_conf_id - $__pg_conf_description"
- elif test list = "$action"; then
- echo "$__pg_conf_id $__pg_conf_major"
- elif test config = "$action"; then
- test "$__pg_conf_id" = "$expected_id" || continue
- debug "reading config $conffile"
- for i in $my_vars; do
- set_var "upgradefrom_$i" "\$__pg_conf_$i"
-
- local cm="config file '$conffile'"
- # 'scls' and 'redhat_sockets_hack' are used to adjust
- # environment and could be bash-injected.
- case "$i" in
- scls)
- test -z "$upgrade_from_scls" \
- || [[ $upgrade_from_scls =~ ^[-a-zA-Z0-9_\ ]+$ ]] \
- || die "$cm: bad '$i' value '$upgrade_from_scls'"
- ;;
- redhat_sockets_hack)
- case "$upgradefrom_redhat_sockets_hack" in
- yes|no|'')
- ;;
- *)
- die "$cm: bad '$i' value"
- ;;
- esac
- ;;
- esac
- done
- return 0
- fi
- done < <(find "$upgrade_confdir" -maxdepth 1 -type f -name '*.conf')
-
- case "$action" in
- help|list)
- return 0
- ;;
- esac
- return 1
-}
-
-
-# run_cmd_as_dbadmin COMMAND STDOUT STDERR
-run_cmd_as_dbadmin()
-{
- # Convenient tool-aliases
- local SU_POSTGRES="@SU_POSTGRES@"
-
- local cmd="@SCL_SOURCE@$1"
- local stdout="$2" stderr="$3"
-
- # don't print additional spaces
- set -- $cmd
- debug "running command under postgres user: $@"
- (
- test -n "$stdout" && exec >>"$stdout"
- test -n "$stderr" && exec 2>>"$stderr"
- $SU_POSTGRES -c "$cmd" < /dev/null
- )
-}
diff --git a/style.dsl b/style.dsl
deleted file mode 100644
index 85197f8..0000000
--- a/style.dsl
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
-<!ENTITY dbstyle PUBLIC "-//Norman Walsh//DOCUMENT DocBook HTML Stylesheet//EN" CDATA DSSSL>
-]>
-
-<style-sheet>
-<style-specification use="docbook">
-<style-specification-body>
-
-;; your stuff goes here...
-;; (element structname ($mono-seq$))
-
-</style-specification-body>
-</style-specification>
-<external-specification id="docbook" document="dbstyle">
-</style-sheet>
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index 8f6f5a5..0000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-EXTRA_DIST = testsuite.at \
- package.m4 \
- $(TESTSUITE) \
- atlocal.in
-
-$(srcdir)/package.m4: $(top_srcdir)/configure.ac
- $(AM_V_GEN):;{ \
- echo '# Signature of the current package.' && \
- echo 'm4_define([AT_PACKAGE_NAME],' && \
- echo ' [$(PACKAGE_NAME)])' && \
- echo 'm4_define([AT_PACKAGE_TARNAME],' && \
- echo ' [$(PACKAGE_TARNAME)])' && \
- echo 'm4_define([AT_PACKAGE_VERSION],' && \
- echo ' [$(PACKAGE_VERSION)])' && \
- echo 'm4_define([AT_PACKAGE_STRING],' && \
- echo ' [$(PACKAGE_STRING)])' && \
- echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \
- echo ' [$(PACKAGE_BUGREPORT)])'; \
- echo 'm4_define([AT_PACKAGE_URL],' && \
- echo ' [$(PACKAGE_URL)])'; \
- } >'$(srcdir)/package.m4'
-
-TESTSUITE = $(srcdir)/testsuite
-CHECK_DEPS = atconfig atlocal $(TESTSUITE) $(top_builddir)/$(TEST_GEN_FILES_LIST)
-
-atlocal: atlocal.in $(c_s)
- $(text_tpl_gen)
-
-check-local: $(CHECK_DEPS)
- $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
-
-installcheck-local: $(CHECK_DEPS)
- $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' $(TESTSUITEFLAGS)
-
-clean-local:
- test ! -f '$(TESTSUITE)' || \
- $(SHELL) '$(TESTSUITE)' --clean
-
-AUTOTEST = $(AUTOM4TE) --language=autotest
-
-$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4
- $(AM_V_GEN)$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at && \
- mv $@.tmp $@
-
-DISTCLEANFILES = atconfig atlocal
diff --git a/tests/atlocal.in b/tests/atlocal.in
deleted file mode 100644
index 6015f6b..0000000
--- a/tests/atlocal.in
+++ /dev/null
@@ -1 +0,0 @@
-TEST_GEN_FILES_LIST=@TEST_GEN_FILES_LIST@
diff --git a/tests/testsuite.at b/tests/testsuite.at
deleted file mode 100644
index 970a414..0000000
--- a/tests/testsuite.at
+++ /dev/null
@@ -1,36 +0,0 @@
-AT_INIT
-AT_COLOR_TESTS
-
-m4_define([gen_file_list], [$abs_top_builddir/$TEST_GEN_FILES_LIST])
-
-AT_SETUP([Files instantiated correctly])
-AT_CHECK([
-test -f "gen_file_list" || { echo "no such file 'gen_file_list'" ; exit 1 ; }
-
-pattern='@[[a-zA-Z0-9_]]*@'
-
-while read file; do
- file=$abs_top_builddir/$file
- grep $pattern $file && echo "file $file is incomplete" && exit 1
-done < gen_file_list
-
-exit 0
-])
-AT_CLEANUP
-
-AT_SETUP([Basic bash syntax check])
-AT_CHECK([file_list=$abs_top_builddir/$TEST_GEN_FILES_LIST
-while read file; do
- file=$abs_top_builddir/$file
- line="`head -1 $file`"
- case "$line" in
- "#!/bin/bash")
- bash -n $file || exit 1
- ;;
- "#!/bin/sh")
- sh -n $file || exit 1
- ;;
- esac
-done < gen_file_list
-])
-AT_CLEANUP