update put.bash
[martlubbers.net.git] / put.bash
index 665e574..80770f6 100644 (file)
--- a/put.bash
+++ b/put.bash
@@ -1,8 +1,7 @@
 #!/bin/bash
 set -e
 files=$(find . -type f -not -iwholename "*.git*")
-user=$(gpg -q --use-agent -d ~/pw/general.asc | grep ftpmartlubbers.net -A3 | grep -Po "(?<=user: ).*")
-pass=$(gpg -q --use-agent -d ~/pw/general.asc | grep ftpmartlubbers.net -A3 | grep -Po "(?<=pass: ).*")
+user=$(gpg -q --use-agent -d ~/pw/general.asc | grep ftpmartlubbers.net -A3 | head -3 | tail -2 | sed 's/\s\+\(user\|pass\):\s\+//g' | head -c -1 | tr '\n' ':')
 
 for f in $files
 do
@@ -13,7 +12,7 @@ do
                echo "$f is not changed"
        else
                echo "$f is changed"
-               curl -u "$user:$pass" -T $f ftp://martlubbers.net/public_html/$f
+               curl -u "$user" -T $f ftp://martlubbers.net/public_html/$f
        fi
 done
-md5sum ./*{,/*} > ./hashes.txt
+md5sum ./*{,/*} > ./hashes.txt || true