Re: [capistrano] sudo echo and double quote hell

106 views
Skip to first unread message

Rafa García

unread,
Oct 18, 2012, 6:50:32 AM10/18/12
to capis...@googlegroups.com
Hi Nam-Luc,

Why not use this simplified command-line?

# Note: I replaced %Q{ by %Q[ for readability  
task :set_apt_cache, :roles => :arom_slaves do
  run %Q[ #{sudo} echo 'Acquire::http { Proxy "http://192.168.0.210:3142;" };' >> /etc/apt/apt.conf.d/90-apt-proxy.conf ]
end

As usually... not tested :)

Regards


2012/10/16 Nam-Luc Tran <namlu...@euranova.eu>
Hello,

I need to set up a very simple task which involves writing a line in a file with su permissions. So far, I have managed to write something like this:

task :set_apt_cache, :roles => :arom_slaves do
  run %Q{#{sudo} sh -c %Q{echo 'Acquire::http { Proxy "http://192.168.0.210:3142;" };' >> /etc/apt/apt.conf.d/90-apt-proxy.conf}}
end

but I keep on getting the following error: 
"sh: 1: cannot create /etc/apt/apt.conf.d/90-apt-proxy.conf}: Permission denied"

Could you help me point out what is wrong in my task?

Cheers,

--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en

Reply all
Reply to author
Forward
0 new messages