forked from ubicloud/ubicloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_dnsmasq.rb
41 lines (34 loc) · 1.17 KB
/
install_dnsmasq.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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