summaryrefslogtreecommitdiffstats
path: root/vagrant-lxc-sudo-wrapper.patch
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2015-01-26 18:35:28 +0100
committerMichael Adam <obnox@samba.org>2015-01-26 18:35:28 +0100
commitf65a67ce5f393491819c85ff2a1665f3850ddb21 (patch)
tree3625f0b2e7f415488341b5d1f8f74214bfac3616 /vagrant-lxc-sudo-wrapper.patch
parentd3755879bde1aa5bd84fb9cd233880a6ab06f7e6 (diff)
downloadfedora-vagrant-lxc-f65a67ce5f393491819c85ff2a1665f3850ddb21.tar.gz
fedora-vagrant-lxc-f65a67ce5f393491819c85ff2a1665f3850ddb21.tar.xz
fedora-vagrant-lxc-f65a67ce5f393491819c85ff2a1665f3850ddb21.zip
Fix sudo wrapper mechanism for fedora
Diffstat (limited to 'vagrant-lxc-sudo-wrapper.patch')
-rw-r--r--vagrant-lxc-sudo-wrapper.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/vagrant-lxc-sudo-wrapper.patch b/vagrant-lxc-sudo-wrapper.patch
new file mode 100644
index 0000000..925832a
--- /dev/null
+++ b/vagrant-lxc-sudo-wrapper.patch
@@ -0,0 +1,77 @@
+From 43f3351bb2d2c2e80c68bc5c0368c8b5c7f2f9ce Mon Sep 17 00:00:00 2001
+From: Michael Adam <obnox@samba.org>
+Date: Mon, 26 Jan 2015 16:35:34 +0100
+Subject: [PATCH] Make vagrant-lxc-wrapper sudo mechanism useful for system
+ installed vagrant (on fedora)
+
+- different path for wrapper
+- uses vagrant group instead of per-user sudo
+- prefixes PATH with /usr/bin
+- use system path for piperwork script
+...
+---
+ lib/vagrant-lxc.rb | 3 ++-
+ lib/vagrant-lxc/command/sudoers.rb | 6 ++++--
+ templates/sudoers.rb.erb | 4 ++--
+ 3 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/lib/vagrant-lxc.rb b/lib/vagrant-lxc.rb
+index 825eb18..1128549 100644
+--- a/lib/vagrant-lxc.rb
++++ b/lib/vagrant-lxc.rb
+@@ -8,7 +8,8 @@ module Vagrant
+ end
+
+ def self.sudo_wrapper_path
+- "/usr/local/bin/vagrant-lxc-wrapper"
++ #"/usr/local/bin/vagrant-lxc-wrapper"
++ "/usr/share/vagrant/gems/gems/vagrant-lxc-1.1.0/scripts/vagrant-lxc-wrapper"
+ end
+ end
+ end
+diff --git a/lib/vagrant-lxc/command/sudoers.rb b/lib/vagrant-lxc/command/sudoers.rb
+index fcb2099..d75861b 100644
+--- a/lib/vagrant-lxc/command/sudoers.rb
++++ b/lib/vagrant-lxc/command/sudoers.rb
+@@ -48,7 +48,8 @@ module Vagrant
+ 'sudoers.rb',
+ :template_root => Vagrant::LXC.source_root.join('templates').to_s,
+ :cmd_paths => build_cmd_paths_hash,
+- :pipework_regex => "#{ENV['HOME']}/\.vagrant\.d/gems/gems/vagrant-lxc.+/scripts/pipework"
++ #:pipework_regex => "#{ENV['HOME']}/\.vagrant\.d/gems/gems/vagrant-lxc.+/scripts/pipework"
++ :pipework_regex => "/usr/share/vagrant/gems/gems/vagrant-lxc.+/scripts/pipework"
+ )
+ file.puts template.render
+ end
+@@ -59,7 +60,8 @@ module Vagrant
+ def create_sudoers!(user, command)
+ sudoers = Tempfile.new('vagrant-lxc-sudoers').tap do |file|
+ file.puts "# Automatically created by vagrant-lxc"
+- file.puts "#{user} ALL=(root) NOPASSWD: #{command}"
++ #file.puts "#{user} ALL=(root) NOPASSWD: #{command}"
++ file.puts "%vagrant ALL=(root) NOPASSWD: #{command}"
+ end
+ sudoers.close
+ sudoers.path
+diff --git a/templates/sudoers.rb.erb b/templates/sudoers.rb.erb
+index 94db7f7..d7977bc 100644
+--- a/templates/sudoers.rb.erb
++++ b/templates/sudoers.rb.erb
+@@ -1,4 +1,4 @@
+-#!/opt/vagrant/embedded/bin/ruby
++#!/usr/bin/env ruby
+ # Automatically created by vagrant-lxc
+
+ class Whitelist
+@@ -31,7 +31,7 @@ class Whitelist
+
+ def run!(argv)
+ begin
+- command, args = `which #{argv.shift}`.chomp, argv || []
++ command, args = `PATH=/usr/bin:$PATH which #{argv.shift}`.chomp, argv || []
+ check!(command, args)
+ system "#{command} #{args.join(" ")}"
+
+--
+2.1.0
+