Permalink
Browse files

Updated sudo_script to sudo to any user.

  • Loading branch information...
1 parent 5f4cf89 commit 288ef5daa105ee38fba16f01847a9c58d1de84ca @nirvdrum nirvdrum committed Aug 26, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/rubber/recipes/rubber/utils.rb
@@ -170,9 +170,12 @@ def run_script(name, contents, opts = {})
end
def sudo_script(name, contents, opts = {})
+ user = opts.delete(:as)
args = opts.delete(:script_args)
script = prepare_script(name, contents)
- run "#{sudo} bash -l #{script} #{args}", opts
+
+ sudo_args = user ? "-H -u #{user}" : ""
+ run "#{sudo} #{sudo_args} bash -l #{script} #{args}", opts
end
def top.rsudo(command, opts = {}, &block)

0 comments on commit 288ef5d

Please sign in to comment.