From: Samir Benmendil Date: Sun, 5 Jan 2014 23:32:46 +0000 (+0100) Subject: add script used to refactor password-store X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/b4eef8499c2723701e4843a58ab2d883e466d2ac?ds=inline add script used to refactor password-store --- diff --git a/bin/old/refactor_password-store.sh b/bin/old/refactor_password-store.sh new file mode 100755 index 0000000..699488a --- /dev/null +++ b/bin/old/refactor_password-store.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +while read p; do + multi="$(pass "$p")" + username=$(echo -e "$multi" | sed -n 's/username: //p') + url=$(echo -e "$multi" | sed -n -e 's/url: //p') + urlstrip=$(echo "$url" | sed -re "s,([^/]*//)?([^@]*@)?(www\.)?([^:/]*).*,\4,") + if [[ -n "$url" && -n "$username" ]]; then + newfile="$urlstrip/$username.gpg" + if [[ -f "$newfile" ]]; then + echo "$newfile" already exists... skipping "$p" + else + mkdir "$urlstrip" + git mv "$p.gpg" "$newfile" + fi + fi +done < list