In the lastpass2pass.rb import script bundled with password-store 1.6.3
(Jessie) has some troubles.

1) password whose url didn't match ^http were ignored. But lastpass is
   scheme-independant. At least I added ssh:// and ftp://
   (I don't know the point of this check)

2) Existing entries were reinserted and recommited (eg: by running twice
   the script) even without using the -force flag of the script.
   Reason is that the -f flags of `pass insert` isn't effective when
   using the -m[ultiline] flag at the same time.

3) The check on error was always true (ruby 2.1.5p273)

Please note that lastpass exported file does not show all entries.
Although missing are accessible using the web-UI or lastpass-cli.
Maybe worth a notice somewhere.


best regards
--- /usr/share/pass/lastpass2pass.rb.orig	2015-04-07 23:58:12.833822830 -0300
+++ /usr/share/pass/lastpass2pass.rb	2015-04-07 23:51:30.239826514 -0300
@@ -76,7 +76,7 @@
 begin
   file = File.open(filename)
   file.each do |line|
-    if line =~ /^http/
+    if line =~ /^(http|ftp|ssh)/
       entries.push(entry)
       entry = ""
     end
@@ -110,8 +110,11 @@
 successful = 0
 errors = []
 records.each do |r|
-  print "Creating record #{r.name}..."
-  IO.popen("pass insert -m#{"f" if FORCE} '#{r.name}' > /dev/null", 'w') do |io|
+  if File.exist?("#{r.name}.gpg") and FORCE == false
+    puts "skipped #{r.name}: already exists"
+    next
+  end
+  IO.popen("pass insert -m '#{r.name}' > /dev/null", 'w') do |io|
     io.puts r
   end
   if $? == 0
@@ -124,7 +127,7 @@
 end
 puts "#{successful} records successfully imported!"
 
-if errors
+if errors.length > 0
   puts "There were #{errors.length} errors:"
   errors.each { |e| print e.name + (e == errors.last ? ".\n" : ", ")}
   puts "These probably occurred because an identically-named record already existed, or because there were multiple entries with the same name in the csv file."

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to