bin/d3 in depot3-3.0.8 vs bin/d3 in depot3-3.0.9
- old
+ new
@@ -57,10 +57,13 @@
ACTIONS_NEEDING_ADMIN = D3::Client::ACTIONS.select{|k,v| v[:needs_admin] }
# the following d3 commands need a connection to the server
ACTIONS_NEEDING_SERVER = D3::Client::ACTIONS.select{|k,v| v[:needs_connection] }
+ # these actions can be done w/o being root, by default, actions need root
+ ACTIONS_OK_WO_ROOT = D3::Client::ACTIONS.select{|k,v| v[:needs_root] == false }
+
### set up
###
def initialize(args)
D3::LOG.progname = File.basename __FILE__
@@ -87,11 +90,11 @@
D3::SUPPORT_DIR.mkpath unless D3::SUPPORT_DIR.directory?
D3::SUPPORT_DIR.chmod 0755
# otherwise, yell if we need to be root.
else
- raise D3::PermissionError, "You must be root to use d3." unless [:help, :version].include? @action
+ raise D3::PermissionError, "You must be root to do that with d3." unless ACTIONS_OK_WO_ROOT.include? @action
end #if root
# bail if the jamf binary isn't installed
unless D3::Client::JAMF_BINARY.executable?
raise JSS::NoSuchItemError, "The jamf binary isn't installed properly."
@@ -146,9 +149,12 @@
end # init
### Parse the command line - fill @options with our options.
###
def parse_cli
+
+ # Debugging file? if so, always set debug.
+ ARGV << "--debug" if D3::DEBUG_FILE.exist?
# when finished, this leaves the d3 command and its arg in ARGV
opts = GetoptLong.new( *D3::Client::OPTIONS.values.map{|opt| opt[:cli]} )
opts.each do |opt, arg|