Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 19 lines (14 sloc) 481 Bytes
#!/usr/bin/env ruby
require 'keychain'
require 'pathname'
encfs = ARGV.first || 'encfs'
Keychain.generic_passwords.where(service: 'EncFS').all.each do |item|
source = File.expand_path(item.account)
dest = File.expand_path(item.comment)
raise('Paths are incorrect') unless Dir.exist?(source) && Dir.exist?(dest)
next if Pathname.new(dest).mountpoint?
mount = IO.popen "#{encfs} -S '#{source}' '#{dest}'", 'r+'
mount.puts item.password
mount.gets
mount.close
end