From 4f2aeaac41febbcb58c9fbf8525b5e28673b3311 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Mon, 10 Jun 2024 11:44:07 +0900 Subject: [PATCH] Check whether `eget` is installed or not, before the actual installation. --- cookbooks/base/eget.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/cookbooks/base/eget.rb b/cookbooks/base/eget.rb index a168e56..a70978a 100644 --- a/cookbooks/base/eget.rb +++ b/cookbooks/base/eget.rb @@ -1,7 +1,14 @@ -execute 'curl https://zyedidia.github.io/eget.sh | sh' do - not_if 'which eget' - cwd '/usr/local/bin/' +result = run_command('which eget', error: false) +if result.exit_status != 0 + # Install eget + execute 'curl https://zyedidia.github.io/eget.sh | sh' do + cwd '/usr/local/bin/' + end + + execute 'chown root:root /usr/local/bin/eget' + execute 'chmod 755 /usr/local/bin/eget' end -execute 'chown root:root /usr/local/bin/eget' -execute 'chmod 755 /usr/local/bin/eget' +%w( zyedidia/eget mgdm/htmlq ).each do |p| + execute "eget #{p} --to /usr/local/bin/ --upgrade-only" +end