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:
parent
1c0cfa88e5
commit
a82eb9c82a
2 changed files with 30 additions and 4 deletions
|
@ -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
|
||||
|
|
33
qasim/map.rb
33
qasim/map.rb
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue