postgres-formula/postgres/macos/postgresapp.sls

53 lines
1.5 KiB
Text
Raw Normal View History

{%- from salt.file.dirname(tpldir) ~ "/map.jinja" import postgres as pg with context -%}
2018-03-08 11:41:19 +00:00
pg-extract-dirs:
file.directory:
- names:
- '{{ pg.macos.tmpdir }}'
- makedirs: True
- require_in:
- pg-download-archive
pg-download-archive:
pkg.installed:
- name: curl
cmd.run:
2019-01-27 20:51:01 +00:00
- name: curl {{ pg.macos.dl.opts }} -o {{ pg.macos.tmpdir }}/{{ pg.macos.archive }} {{ pg.macos.postgresapp.url }}
- unless: test -f {{ pg.macos.tmpdir }}/{{ pg.macos.archive }}
2018-03-08 11:41:19 +00:00
{% if grains['saltversioninfo'] >= [2017, 7, 0] %}
- retry:
attempts: {{ pg.macos.dl.retries }}
interval: {{ pg.macos.dl.interval }}
2019-01-27 20:51:01 +00:00
until: True
splay: 10
2018-03-08 11:41:19 +00:00
{% endif %}
2018-03-08 12:30:25 +00:00
{%- if pg.macos.postgresapp.sum %}
2018-03-08 11:41:19 +00:00
pg-check-archive-hash:
module.run:
- name: file.check_hash
- path: '{{ pg.macos.tmpdir }}/{{ pg.macos.archive }}'
- file_hash: {{ pg.macos.postgresapp.sum }}
2019-01-27 20:51:01 +00:00
- require:
2018-03-08 11:41:19 +00:00
- cmd: pg-download-archive
- require_in:
- archive: pg-package-install
{%- endif %}
pg-package-install:
macpackage.installed:
- name: '{{ pg.macos.tmpdir }}/{{ pg.macos.archive }}'
- store: True
- dmg: True
- app: True
- force: True
- allow_untrusted: True
- onchanges:
- cmd: pg-download-archive
- require_in:
- file: pg-package-install
file.append:
2018-03-08 12:30:25 +00:00
- name: {{ pg.userhomes }}/{{ pg.user }}/.bash_profile
2018-03-08 11:41:19 +00:00
- text: 'export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin'