From 4cffd9c9e107f39b18c24934c4093dfea8876e20 Mon Sep 17 00:00:00 2001 From: Alexander Weidinger Date: Thu, 15 Mar 2018 22:12:48 +0100 Subject: [PATCH] composer update: date works differently on FreeBSD --- php/composer.sls | 4 ++++ php/ng/composer.sls | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/php/composer.sls b/php/composer.sls index b316f0d..935508e 100644 --- a/php/composer.sls +++ b/php/composer.sls @@ -41,7 +41,11 @@ install-composer: update-composer: cmd.run: - name: "{{ install_file }} selfupdate" +{% if grains['os_family'] == 'FreeBSD' %} + - unless: test $(date -v+60d -j -f "%Y-%m-%d %H:%M:%S" "$({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s") +{% else %} - unless: test $(date -d "60 days $({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s") +{% endif %} - cwd: {{ php.local_bin }} - env: - HOME: {{ salt_user_home }} diff --git a/php/ng/composer.sls b/php/ng/composer.sls index a4b7442..8f6221d 100644 --- a/php/ng/composer.sls +++ b/php/ng/composer.sls @@ -49,7 +49,11 @@ install-composer: update-composer: cmd.run: - name: "{{ install_file }} selfupdate" +{% if grains['os_family'] == 'FreeBSD' %} + - unless: test $(date -v+60d -j -f "%Y-%m-%d %H:%M:%S" "$({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s") +{% else %} - unless: test $(date -d "60 days $({{ install_file }} --version | cut -d ' ' -f 4,5)" "+%s") -gt $(date "+%s") +{% endif %} - cwd: {{ php.lookup.pkgs.local_bin }} - env: - HOME: {{ salt_user_home }}