Refactor bitcoind recipe

Fixes various issues, like compilation not starting on subsequent
version updates, service not restarting after compilation, and a TODO
note on the compilation script itself.
This commit is contained in:
Basti 2021-01-26 12:45:28 +01:00
parent 152edbc958
commit 0d2a04f8ba
Signed by untrusted user: basti
GPG Key ID: 9F88009D31D99C72

View File

@ -37,23 +37,25 @@ ark 'bitcoind' do
url "https://bitcoincore.org/bin/bitcoin-core-#{node['bitcoin']['version']}/bitcoin-#{node['bitcoin']['version']}.tar.gz"
checksum node['bitcoin']['checksum']
action :put
notifies :run, 'execute[compile_bitcoin-core_dependencies]', :immediately
end
execute "Compile bitcoin-core dependencies" do
execute "compile_bitcoin-core_dependencies" do
cwd "/usr/local/bitcoind/depends"
command "make NO_QT=1"
not_if { ::File.directory?("/usr/local/bitcoind/depends/x86_64-pc-linux-gnu") }
action :nothing
notifies :run, 'bash[compile_bitcoin-core]', :immediately
end
execute "Configure, compile bitcoin-core" do
bash "compile_bitcoin-core" do
cwd "/usr/local/bitcoind"
# FIXME only executes first array item?
command [
"./autogen.sh",
"./configure --prefix=$PWD/depends/x86_64-pc-linux-gnu",
"make"
]
not_if { ::File.exist?("/usr/local/bitcoind/src/bitcoind") }
code <<-EOH
./autogen.sh
./configure --prefix=$PWD/depends/x86_64-pc-linux-gnu
make
EOH
action :nothing
notifies :restart, "systemd_unit[bitcoind.service]", :delayed
end
link "/usr/local/bin/bitcoind" do