Files
ubicloud/prog/install_dnsmasq.rb
Daniel Farina 9ba88bff16 Update dnsmasq to v2.89
I previously used a semi-arbitrary commit to pick up some recent IPv6
related changes.  I am not sure it was relevant: it was a long time
ago, with the service in a more primitive state.

But it's a reasonable time to use a dnsmasq release, now that one is
newer than the hash I previously recorded.

You can verify this at hash and tag at:

https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=5dc14b6e05f39a5ab0dc02e376b1d7da2fda5bc1
2023-12-15 13:56:09 -08:00

42 lines
1.2 KiB
Ruby

# frozen_string_literal: true
class Prog::InstallDnsmasq < Prog::Base
subject_is :sshable
label def start
# Handle some short, non-dependent steps concurrently, keeping
# overall code compact by self-budding and starting at a different
# label.
bud self.class, frame, :install_build_dependencies
bud self.class, frame, :git_clone_dnsmasq
hop_wait_downloads
end
label def wait_downloads
reap
hop_compile_and_install if leaf?
donate
end
label def compile_and_install
sshable.cmd("(cd dnsmasq && make -sj$(nproc) && sudo make install)")
pop "compiled and installed dnsmasq"
end
label def install_build_dependencies
sshable.cmd("sudo apt-get -y install make gcc")
pop "installed build dependencies"
end
label def git_clone_dnsmasq
q_commit = "5dc14b6e05f39a5ab0dc02e376b1d7da2fda5bc1".shellescape
sshable.cmd("git init dnsmasq && " \
"(cd dnsmasq && " \
" git fetch https://github.com/fdr/dnsmasq.git #{q_commit} --depth=1 &&" \
" git checkout #{q_commit} &&" \
" git fsck --full)")
pop "downloaded and verified dnsmasq successfully"
end
end