sshfs-mapper qasim-gui: Connect on click.

git-svn-id: https://websvn.glenux.net/svn/Upoc/sshfs-mapper/trunk@1707 eaee96b3-f302-0410-b096-c6cfd47f7835
This commit is contained in:
Glenn Y. Rolland 2011-07-21 15:50:57 +00:00
parent 5188ba21bb
commit 5fab5ea8b5
2 changed files with 30 additions and 4 deletions

View file

@ -79,6 +79,7 @@ module Qasim
itemx.setCheckable true;
itemx.connect(SIGNAL(:triggered)) do
puts "%s => %s" % [name, itemx.checked ]
map.connect
end
menu.addAction itemx;
end

View file

@ -12,14 +12,13 @@ module Qasim
:user,
:map
class MapParseError < RuntimeError
end
class MapParseError < RuntimeError ; end
class ConnectError < RuntimeError ; end
CYPHER_ARCFOUR = :arcfour
CYPHER_AES256CBC = "aes-256-cbc".to_sym
CYPHERS = [ CYPHER_ARCFOUR, CYPHER_AES256CBC ]
def initialize map_path
@path = map_path
@host = nil
@ -99,10 +98,36 @@ module Qasim
def connect
puts "[#{File.basename @path}] Connecting..."
puts " #{@user}@#{@host}:#{@port}"
puts " maps = %s" % @maps.map{ |k,v| "%s => %s" % [ k, v ] }.join(', ')
#puts " maps = %s" % @maps.map{ |k,v| "%s => %s" % [ k, v ] }.join(', ')
# do something
# test server connection
# mount
#
# FIXME: test connexion with Net::SSH + timeout or ask password
@maps.each do |name, remotepath|
pp map
cmd = [ "sshfs" ,
"-o allow_root" ,
"-o idmap=user" ,
"-o uid=%s" % Process.uid,
"-o gid=%s" % Process.gid,
"-o reconnect",
"-o workaround=all",
"-o cache_timeout=240",
"-o ServerAliveInterval 15",
"-o no_readahead",
"-o Ciphers=arcfour",
"-o Port=%s" % @port,
"%s@%s:%s:%s" % [@user,@host,@port,remotepath],
"$localdir" ].join(' ')
rdebug "command: %s" % cmd
=begin
system cmd
if $?.exitstatus != 0 then
raise ConnectError, self
end
=end
end
end
def disconnect