From 49b4326aa1768c11cc085304c76389c7f6688a27 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 1 Nov 2020 14:31:00 +0900 Subject: [PATCH] Install `go-mmproxy`. --- cookbooks/gitea/attributes.rb | 6 ++++++ cookbooks/gitea/default.rb | 2 ++ cookbooks/gitea/install-go-mmproxy.rb | 29 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 cookbooks/gitea/install-go-mmproxy.rb diff --git a/cookbooks/gitea/attributes.rb b/cookbooks/gitea/attributes.rb index 15f3148..618852a 100644 --- a/cookbooks/gitea/attributes.rb +++ b/cookbooks/gitea/attributes.rb @@ -9,4 +9,10 @@ node.reverse_merge!({ 'storage' => '/opt/gitea/', 'location' => '/usr/local/bin/' }, + 'go-mmproxy' => { + 'url' => 'https://github.com/path-network/go-mmproxy/releases/', + 'bin_url' => 'https://github.com/path-network/go-mmproxy/releases/download/2.0/go-mmproxy-2.0-centos8-x86_64', + 'storage' => '/opt/go-mmproxy/', + 'location' => '/usr/local/bin/' + }, }) diff --git a/cookbooks/gitea/default.rb b/cookbooks/gitea/default.rb index 4798ef2..c7465cf 100644 --- a/cookbooks/gitea/default.rb +++ b/cookbooks/gitea/default.rb @@ -3,6 +3,8 @@ include_recipe './attributes.rb' # Install: include_recipe './install.rb' +include_recipe './install-go-mmproxy.rb' # Setup: include_recipe './setup.rb' +include_recipe './setup-go-mmproxy.rb' diff --git a/cookbooks/gitea/install-go-mmproxy.rb b/cookbooks/gitea/install-go-mmproxy.rb new file mode 100644 index 0000000..5ccf64c --- /dev/null +++ b/cookbooks/gitea/install-go-mmproxy.rb @@ -0,0 +1,29 @@ +# Download: +TMP = "/tmp/go-mmproxy" + +execute "wget #{node['go-mmproxy']['bin_url']} -O #{TMP}" do + not_if "test -e #{node['go-mmproxy']['storage']}/go-mmproxy" +end + +# Install: +directory node['go-mmproxy']['storage'] do + owner 'root' + group 'root' + mode '755' +end + +execute "mv #{TMP} #{node['go-mmproxy']['storage']}/go-mmproxy" do + not_if "test -e #{node['go-mmproxy']['storage']}/go-mmproxy" +end + +# Change Owner and Permissions: +file "#{node['go-mmproxy']['storage']}/go-mmproxy" do + owner 'root' + group 'root' + mode '755' +end + +# Create Link +link "#{node['go-mmproxy']['location']}/go-mmproxy" do + to "#{node['go-mmproxy']['storage']}/go-mmproxy" +end