Bladeren bron

Merge pull request #64 from devaos/master

Facilitate active nginx development
susefix
Nitin Madhok 10 jaren geleden
bovenliggende
commit
f057d70190
1 gewijzigde bestanden met toevoegingen van 40 en 1 verwijderingen
  1. +40
    -1
      nginx/source.sls

+ 40
- 1
nginx/source.sls Bestand weergeven

@@ -6,6 +6,7 @@
{% set nginx = pillar.get('nginx', {}) -%}
{% set use_sysvinit = nginx.get('use_sysvinit', nginx_map['use_sysvinit']) %}
{% set version = nginx.get('version', '1.6.2') -%}
{% set tarball_url = nginx.get('tarball_url', 'http://nginx.org/download/nginx-' + version + '.tar.gz') -%}
{% set checksum = nginx.get('checksum', 'sha256=b5608c2959d3e7ad09b20fc8f9e5bd4bc87b3bc8ba5936a513c04ed8f1391a18') -%}
{% set home = nginx.get('home', nginx_map['home']) -%}
{% set base_temp_dir = nginx.get('base_temp_dir', '/tmp') -%}
@@ -71,7 +72,7 @@ get-nginx:
- libssl-dev
file.managed:
- name: {{ nginx_package }}
- source: http://nginx.org/download/nginx-{{ version }}.tar.gz
- source: {{ tarball_url }}
- source_hash: {{ checksum }}
- require:
- file: {{ nginx_modules_dir }}
@@ -113,6 +114,42 @@ get-ngx_devel_kit:
- file: get-ngx_devel_kit
{% endif %}

nginx-source-modified:
cmd.run:
- cwd: {{ nginx_source }}
- stateful: True
- names:
- m=$(find . \! -name "build.*" -newer {{ sbin_dir }}/nginx -print -quit);
r=$?;
if [ x$r != x0 ]; then
echo "changed=yes comment='binary file does not exist or other find error'";
exit 0;
fi;
if [ x$m != "x" ]; then
echo "changed=yes comment='source files are newer than binary'";
exit 0;
fi;
echo "changed=no comment='source files are older than binary'"

{% for name, module in nginx.get('modules', {}).items() -%}
nginx-module-modified-{{name}}:
cmd.run:
- cwd: {{ nginx_modules_dir }}/{{name}}
- stateful: True
- names:
- m=$(find . \! -name "build.*" -newer {{ sbin_dir }}/nginx -print -quit);
r=$?;
if [ x$r != x0 ]; then
echo "changed=yes comment='binary file does not exist or other find error'";
exit 0;
fi;
if [ x$m != "x" ]; then
echo "changed=yes comment='module source files are newer than binary'";
exit 0;
fi;
echo "changed=no comment='module source files are older than binary'"
{% endfor -%}

nginx:
cmd.wait:
- cwd: {{ nginx_source }}
@@ -156,7 +193,9 @@ nginx:
{% endif %}
- watch:
- cmd: get-nginx
- cmd: nginx-source-modified
{% for name, module in nginx.get('modules', {}).items() -%}
- cmd: nginx-module-modified-{{name}}
- file: get-nginx-{{name}}
{% endfor %}
{% if use_sysvinit %}

Laden…
Annuleren
Opslaan