From 40e7c266567e29727529a4cb9133dde37cec81ce Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Fri, 8 Nov 2019 00:27:53 +0800 Subject: [PATCH] Install `nginx-build` when finding a newer version. --- cookbooks/nginx/build.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cookbooks/nginx/build.rb b/cookbooks/nginx/build.rb index 8ec162c..0851101 100644 --- a/cookbooks/nginx/build.rb +++ b/cookbooks/nginx/build.rb @@ -50,12 +50,17 @@ rescue raise 'Cannot connect to http://github.com.' end -# Download `nginx-build`: -execute "wget #{nginxbuild} -O #{TARBALL}" -execute "tar xf #{TARBALL} && chown webadm:webadm #{NGINXBUILD}" do - user USER - cwd WORKDIR +# バージョン確認して、アップデート必要かどうか確認 +result = run_command("/home/webadm/nginx-build/nginx-build --version | grep #{tag_version}", error: false) +if result.exit_status != 0 + # Download `nginx-build`: + execute "wget #{nginxbuild} -O #{TARBALL}" + + execute "tar xf #{TARBALL} && chown webadm:webadm #{NGINXBUILD}" do + user USER + cwd WORKDIR + end end # Deploy `configure.sh`: