[scripts] Update ssh-add
change
commit 116d970791857c1c93ee31f5791c9c655542e921
author Alpha Chen <alpha.chen@gmail.com>
date
parent 4e440614
diff --git a/scripts/ssh-add b/scripts/ssh-add
index 13d260d1..10a39ed4 100755
--- a/scripts/ssh-add
+++ b/scripts/ssh-add
@@ -2,9 +2,9 @@
 
 require 'optparse'
 
-# Default to a five minute timeout
-timeout = 5
-unit = ?M
+# Default to a one hour timeout
+timeout = 1
+unit = ?H
 
 OptionParser.new do |opts|
   opts.banner = "Usage: #{__FILE__} [options]"
@@ -12,7 +12,7 @@ OptionParser.new do |opts|
   opts.on("-tTIMEOUT", "--t=TIMEOUT",
           "Default timeout: #{timeout}") { |t| timeout = t.to_i }
   opts.on("-uUNIT", "--u=UNIT",
-         "Default unit: #{unit}") { |u| unit = u }
+          "Default unit: #{unit}") { |u| unit = u }
 end.parse!
 
 def with_mount(image)
@@ -20,10 +20,11 @@ def with_mount(image)
   mountpoint = out.split(/\s+/).last
   yield mountpoint
 ensure
-  puts `hdiutil unmount "#{mountpoint}"`
+  puts `hdiutil detach "#{mountpoint}"`
 end
 
 keyz = File.expand_path("../keyz.sparsebundle", __FILE__)
 with_mount(keyz) do |mountpoint|
   `ssh-add -t #{timeout}#{unit} "#{File.join(mountpoint, "id_rsa")}"`
 end
+# `hdiutil eject "#{File.dirname(__FILE__)}"`