Deal with wait more sensibly

unstable
Tod Beardsley 2012-10-01 12:41:36 -05:00
parent 2b44cd0322
commit ee4c6bb976
1 changed files with 10 additions and 5 deletions

View File

@ -23,14 +23,20 @@ if not (Process.uid == 0 or File.stat(msfbase).owned?)
$stderr.puts "Please run msfupdate as the same user who installed metasploit."
end
wait = (@args.shift.to_s == "wait")
have_configdir = false
@args.each do |arg|
wait_index = nil
@args.each_with_index do |arg,i|
if arg == "wait"
wait_index = i
end
next unless arg =~ /--config-dir/
have_configdir = true
end
if wait_index
@args.delete_at wait_index
end
unless have_configdir
configdir = File.join(File.dirname(msfbase), "data", "svn")
# Spaces in the directory should be fine since this whole thing is passed
@ -49,11 +55,10 @@ if res.nil?
$stderr.puts "[-] to ensure a proper environment."
else
# Cleanup worked, go ahead and update
$stderr.puts "DEBUG: Going with *@args: #{@args.inspect}"
system("svn", "update", *@args)
end
if wait
if wait_index
$stderr.puts ""
$stderr.puts "[*] Please hit enter to exit"
$stderr.puts ""