Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

oneconf: ask for sudo password in system-wide installations

  • Loading branch information...
commit 0e72a65df042aec5755063bf66b86ba82d570205 1 parent d80f7f2
@carlosms authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 oneconf
View
9 oneconf
@@ -4,6 +4,13 @@
require "fileutils"
+# Taken from: http://jimeh.me/blog/2010/02/22/built-in-sudo-for-ruby-command-line-tools/
+def sudome
+ if ENV["USER"] != "root"
+ exec("sudo #{ENV['_']} #{ARGV.join(' ')}")
+ end
+end
+
class String
def uncomment(string)
self.gsub!(string) do |m|
@@ -16,6 +23,8 @@ if ONE_LOCATION = ENV['ONE_LOCATION']
oned_conf = ONE_LOCATION + '/etc/oned.conf'
sched_conf = ONE_LOCATION + '/etc/sched.conf'
else
+ sudome()
+
oned_conf = '/etc/one/oned.conf'
sched_conf = '/etc/one/sched.conf'
end
Please sign in to comment.
Something went wrong with that request. Please try again.