summaryrefslogtreecommitdiffstats
path: root/postgresql-check-db-dir.in
Commit message (Collapse)AuthorAgeFilesLines
* sysvinit: transform for SCL & RHEL6 usagePavel Raiskup2015-03-171-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mostly about simplification of intiscript and postgresql-setup script reuse. Still WIP, however (some options are not applicable for sysvinit system). * share/postgresql-setup/library.sh.in (parse_upgrade_setup): Parse new variable "pghost_override". (run_cmd_as_dbadmin): New wrapper function to run something under "postgres" user. Cut from postgresql-setup. * postgresql-setup.in: Optionally source software collections. Call new check_daemon_reload instead of in-place checking. (upgrade): Use new library function run_cmd_as_dbadmin. Add new hack for $PGHOST overriding via $pghost_override. Add more verbose output to make clear what tool failed. (check_daemon_reload): New function to make the systemd daemon reload conditionally on one dedicated place. (handle_envfile): New function to abstract environment file parsing, works both for systemd & sysvinit env-files. (handle_service_envfiles): Use handle_envfile instead of in-place parsing. (service_configuration): For sysvinit supported configuration, we support only one env file per service - take this into account and don't try to detect many from systemctl output. * postgresql.init.in: Switch to bash script. Parametrize metadata by configure results. Source software collections when needed. Source project library. Don't set PGDATA if admin uses non-default service naem. Do not define PGPORT as PGPORT should be defined in postgresql.conf. Allow passing parameters into initdb/upgrade targets. ($PREVMAJORVERSION, $PREVPGENGINE): Remove unused variables. ($PGENGINE): This is @bindir@ equivalent. ($PGLOG): Spell it so it will not clash with system default PostgreSQL installation. ($pidfile): Use $NAME instead of $PID to distinguish multiple postmaster scenarios (mainly because we do not know the PGPORT yet). (start): Drop the checking logic and use postgresql-check-db-dir instead. Reuse run_cmd_as_dbadmin instead of $SU_POSTGRES. (stop): Use run_cmd_as_dbadmin instead of $SU_POSTGRES. (reload): Just coding style fix. (perform_initdb): Drop unused function, done in postgresql-setup. (__single_comand): Mostly postgresql-setup wrapper with success/failure sugar around the call itself. (initdb): Substitute the function body with postgresql-setup call. (upgrade): Likewise. * postgresql-check-db-dir.in: Fix the hint for admin about where the service should be initialized. Do not warn about systemd-only unsupported configuration. Add @bindir@ into "you need --initdb" hint. Re-style the warning a bit. * etc/postgresql-setup/upgrade/postgresql.conf: Mention new configuration option pghost_override. * configure.ac (initscriptsconfdir): New configuration directory. (PGMAJORVERSION): Use sed and regexp for MAJOR version mining. It failed for micro versions of length >= 2. (SCL_SOURCE): Define to be empty by default. * README: Document what's needed to bootstrap from git source. WIP. * Makefile.am (initscripts_DATA): Use noinst_DATA. Firstly, having initscripts_DATA installs only non-executable files. So we needed something with _SCRIPTS primary. But initscripts_SCRIPTS would face the automake's limitation that it must be "static" list of files. So make the installation of initscript (of dynamically generated name) via automake's install/uninstall. ($(initscript)): Use $(INSTANTIATE_SCRIPT) instead of $(INSTANTIATE). (install-data-hook): Call 'systemctl daemon-reload' only for non-sysvinit systems. * .gitignore: Ignore 'initscript' filename.
* postgresql-check-db-dir: match configuration approachPavel Raiskup2015-03-021-14/+32
| | | | | | | | | | | | | | | | | | | * configure.ac (PGDATADIR): Use /var/lib/pgsql/data when prefix is set to /usr. (rawpkgdatadir): New directory. Its different from pkgdatadir, because thats often set to /usr/share/postgresql. * Makefile.am: Include new rawpkgdatadir Makefile.inc. Fix distcheck by mentioning legacyscripts_SCRIPTS in GENERATED_FILES. * postgresql-check-db-dir.in: Use library.sh to give user better advice. Use @NAME_BINARYBASE@ prefix. (bad_version): New function. (PREVMAJORVERSION): Removed unused variable. * postgresql-setup.in: Cut out the config-parsing routines into library.sh. * share/postgresql-setup/library.sh.in: New library file. Added new option 'list' for parse_upgrade_setup. * share/postgresql-setup/Makefile.inc: New file. * share/postgresql-setup/.gitignore: Ignore library.sh.
* configury: another scl-izing commitPavel Raiskup2015-02-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | * Makefile.am: Move systemd directory definitions into configure.ac. This is then easily configurable via config.site. * configure.ac (PGENGINE, PG_CTL_BIN): Remove, bindir is sufficient. (PREVMAJORVERSION, PREVPGENGINE): Removed. It si configurable now. (INIDB_SCLS): Generalize into SCLS variable. (SCLS): Moved from INIDB_SCLS. (PGDATADIR): Default changed to have ${prefix} inside. (SED_RULES): Remove unused variables (or to not be used, TODO for next commit). (conf_dir): New macro to define config.site friendly directory variable. (SCL_SHELL_WRAPPER): Convenient macro to generate appropriate call to scl binary (only when building for software collections). * postgresql-check-db-dir.in: Use new variable layout. * postgresql-ctl.in: Likewise. * postgresql-setup.in: Likewise. * postgresql.service.in: Likewise. This fixes regression of not using ${bindir} properly.
* buildsystem: better handle distro-READMEPavel Raiskup2014-10-021-5/+5
| | | | | | | | | | Avoid detecting README.rpm-dist as we generate this file and we know the best where the file is. * configure.ac: Avoid detecting README path. Also substitute new variable README_DIST_BASENAME. * Makefile.am: Use the new $(README_DIST_BASENAME). * postgres-check-db-dir.in: Use README_DIST instead of PGDOCDIR.
* postgresql-check-db-dir: fix drop-in directory detectionPavel Raiskup2014-09-231-1/+1
| | | | | | | Backpatch to REL_001. * postgresql-check-db-dir.in: Fix drop-in directory to contain the 'service' string.
* docs: adjust --help output and warning hintsPavel Raiskup2014-09-191-3/+3
| | | | | | * postgresql-check-db-dir.in: Just fix typos. * postgresql-setup.in: Reorganize --help. * TODO: Adjust after some time.
* postgresql-check-db-dir: migrate from /etc/postgresql/*Pavel Raiskup2014-09-161-9/+12
|
* service: avoid cryptic failure with old configPavel Raiskup2014-07-041-4/+22
| | | | | | | | | | | | | | | If user removes currently provided /etc/postgresql/postgresql configuration file, PGDATA env variable is not set. The `systemctl start postgresql` would fail similarly to `systemctl start postgresql@NOTCONFIGURED` when the configuration file was not created yet with cryptic message "Usage: ... " Stop this behavior rather explicitly with proper error in check-db-dir script. Warn also user in similar fashion that the configuration should be adjusted in case the PGDATA was set directly in service file.
* postgresql-check-db-dir generated alsoPavel Raiskup2014-07-011-0/+57
Also generate files using sed as is suggested by autoconf manual (and the autoconf project does so internally).