Skip to content

Commit ee1b69d

Browse files
committed
Merge #122: Allow build to use sudo without a password, part deux
e4b4780 Allow build to use sudo without a password, part deux (Chris Kleeschulte)
2 parents cc174d0 + e4b4780 commit ee1b69d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bin/gbuild

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def build_one_configuration(suite, arch, build_desc)
7272

7373
system! "on-target true"
7474

75+
system! "on-target -u root tee -a /etc/sudoers.d/#{ENV['DISTRO'] || 'ubuntu'} > /dev/null << EOF
76+
%#{ENV['DISTRO'] || 'ubuntu'} ALL=(ALL) NOPASSWD: ALL
77+
EOF" if build_desc["sudo"] and @options[:allow_sudo]
78+
7579
info "Preparing build environment"
7680
system! "on-target setarch #{@arches[arch]} bash < target-bin/init-build.sh"
7781

@@ -150,6 +154,9 @@ end
150154
OptionParser.new do |opts|
151155
opts.banner = "Usage: build [options] <build-description>.yml"
152156

157+
opts.on("--allow-sudo", "override SECURITY on the target VM and allow the use of sudo with no password for the default user") do |v|
158+
@options[:allow_sudo] = v
159+
end
153160
opts.on("-i", "--skip-image", "reuse current target image") do |v|
154161
@options[:skip_image] = v
155162
end

0 commit comments

Comments
 (0)