Created
January 6, 2021 10:56
-
-
Save wouterd/965bee44de6df42ce2864cbdbf74cd78 to your computer and use it in GitHub Desktop.
Password-store scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
TMP_DIR="$(mktemp -d)" | |
gpg --export-ownertrust > "${TMP_DIR}/gpg-ownertrust.txt" | |
gpg --export-secret-key -a "MY EMAIL HERE" > "${TMP_DIR}/private-key.txt" || true | |
cp -r ~/.ssh "${TMP_DIR}/" | |
cd "${TMP_DIR}" | |
tar cf keys.tar * .ssh | |
gpg -c "${TMP_DIR}/keys.tar" | |
rm "${TMP_DIR}/keys.tar" | |
mv "${TMP_DIR}/keys.tar.gpg" ~/"Google Drive/keys.tar.gpg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
cd | |
[ -f "Google Drive/keys.tar.gpg" ] || exit 0 | |
[ -f .keys.tar.gpg.sha ] && sha512sum --status -c .keys.tar.gpg.sha && exit 0 | |
echo Updated keys available, decrypting... | |
sha=$(sha512sum "Google Drive/keys.tar.gpg") | |
gpg -o - "Google Drive/keys.tar.gpg" | tar x | |
gpg --import-ownertrust gpg-ownertrust.txt | |
echo "$sha" > .keys.tar.gpg.sha | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment