diff --git a/postgres/client/init.sls b/postgres/client/init.sls index 473f3c6..d315ea1 100644 --- a/postgres/client/init.sls +++ b/postgres/client/init.sls @@ -27,8 +27,9 @@ postgresql-client-libs: {%- for bin in postgres.client_bins %} {%- set path = salt['file.join'](postgres.bin_dir, bin) %} -{{ bin }}: +postgresql-{{ bin }}-altinstall: alternatives.install: + - name: {{ bin }} - link: {{ salt['file.join']('/usr/bin', bin) }} - path: {{ path }} - priority: {{ postgres.linux.altpriority }} diff --git a/postgres/dev.sls b/postgres/dev.sls index c757ad5..7473171 100644 --- a/postgres/dev.sls +++ b/postgres/dev.sls @@ -20,10 +20,23 @@ install-postgres-libpq-dev: {% endif %} {% endif %} -{% endif %} +# Alternatives system. Make devclient binaries available in $PATH + {%- if 'bin_dir' in postgres and postgres.linux.altpriority %} + {%- for bin in postgres.dev_bins %} + {%- set path = salt['file.join'](postgres.bin_dir, bin) %} +postgresql-{{ bin }}-altinstall: + alternatives.install: + - name: {{ bin }} + - link: {{ salt['file.join']('/usr/bin', bin) }} + - path: {{ path }} + - priority: {{ postgres.linux.altpriority }} + - onlyif: test -f {{ path }} -{% if grains.os == 'MacOS' %} + {%- endfor %} + {%- endif %} + +{% elif grains.os == 'MacOS' %} # Darwin maxfiles limits {% if postgres.limits.soft or postgres.limits.hard %} diff --git a/postgres/osfamilymap.yaml b/postgres/osfamilymap.yaml index dbb3a28..2a57781 100644 --- a/postgres/osfamilymap.yaml +++ b/postgres/osfamilymap.yaml @@ -57,6 +57,8 @@ RedHat: # directory containing PostgreSQL client executables bin_dir: /usr/pgsql-{{ repo.version }}/bin + dev_bins: + - ecg client_bins: - clusterdb - createdb @@ -131,6 +133,8 @@ Suse: # directory containing PostgreSQL client executables bin_dir: /usr/pgsql-{{ repo.version }}/bin + dev_bins: + - ecg client_bins: - pg_archivecleanup - pg_config diff --git a/postgres/server/init.sls b/postgres/server/init.sls index 29ca4f5..60934c3 100644 --- a/postgres/server/init.sls +++ b/postgres/server/init.sls @@ -43,8 +43,9 @@ postgresql-server: {%- for bin in postgres.server_bins %} {%- set path = salt['file.join'](postgres.bin_dir, bin) %} -{{ bin }}: +postgresql-{{ bin }}-altinstall: alternatives.install: + - name: {{ bin }} - link: {{ salt['file.join']('/usr/bin', bin) }} - path: {{ path }} - priority: {{ postgres.linux.altpriority }}