keybase to backup-only

This commit is contained in:
Noah Masur 2020-07-19 19:38:13 -04:00
parent ff6a31df9d
commit 62b1383dce
2 changed files with 42 additions and 4 deletions

40
scripts/backup_keybase Executable file
View File

@ -0,0 +1,40 @@
#!/bin/sh
setup_keybase() {
KEYBASE_USER=$(keybase whoami || (echo "Please login to keybase first"; exit 1))
keybase fs sync enable "/keybase/private/$KEYBASE_USER"
echo "keybase ✓"
}
backup_keybase_ssh() {
SSH_DIR="/Volumes/Keybase/private/$KEYBASE_USER/ssh"
if [ -d "$SSH_DIR" ]
then
rsync -a ~/.ssh/ "$SSH_DIR"/
echo " - backed up to keybase: ssh ✓"
else
echo "Directory not found: $SSH_DIR"
echo "Please check your keybase files"
exit 1
fi
}
backup_keybase_aws() {
AWS_DIR="/Volumes/Keybase/private/$KEYBASE_USER/aws"
if [ -d "$AWS_DIR" ]
then
rsync -a ~/.aws/ "$AWS_DIR"/
echo " - backed up to keybase: aws ✓"
else
echo "Directory not found: $AWS_DIR"
echo "Please check your keybase files"
exit 1
fi
}
setup_keybase
backup_keybase_ssh
backup_keybase_aws

View File

@ -11,8 +11,7 @@ setup_keybase_ssh() {
SSH_DIR="/Volumes/Keybase/private/$KEYBASE_USER/ssh" SSH_DIR="/Volumes/Keybase/private/$KEYBASE_USER/ssh"
if [ -d "$SSH_DIR" ] if [ -d "$SSH_DIR" ]
then then
rm -rf ~/.ssh rsync -a "$SSH_DIR"/ ~/.ssh/
ln -s "$SSH_DIR" ~/.ssh
echo " - keybase: ssh ✓" echo " - keybase: ssh ✓"
else else
@ -26,8 +25,7 @@ setup_keybase_aws() {
AWS_DIR="/Volumes/Keybase/private/$KEYBASE_USER/aws" AWS_DIR="/Volumes/Keybase/private/$KEYBASE_USER/aws"
if [ -d "$AWS_DIR" ] if [ -d "$AWS_DIR" ]
then then
rm -rf ~/.aws rsync -a "$AWS_DIR"/ ~/.aws/
ln -s "$AWS_DIR" ~/.aws
echo " - keybase: aws ✓" echo " - keybase: aws ✓"
else else