-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssh-backup.sh
executable file
·34 lines (23 loc) · 1.1 KB
/
ssh-backup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
DOTFILES=$HOME/dotfiles
source $DOTFILES/.key.env.sh
source ~/dotfiles/function_bitwarden.sh
cd "$(dirname "${BASH_SOURCE}")";
# gpg key backup (bitwarden - gpg-password)
# 필요시 직접수행: gpg export -> bw create item
## hosts file backup
cp /etc/hosts $DOTFILES/.ssh/hosts
mkdir -p $DOTFILES/.kube
cp $HOME/.kube/config* $DOTFILES/.kube 2>/dev/null
# .ssh folder backup (gpg->bitwarden - bitwarden-password)
FOLDER=$(readlink -f .ssh)
DESC="$(date '+%Y-%m-%d %H:%M') $HOST "
echo ".ssh 폴더 백업: bw_create_securefolder $FOLDER [$DESC] $BW_FOLDER_ID $BW_SSH_ITEM"
# source ~/dotfiles/function_bitwarden.sh && bw_create_securefolder $FOLDER "$DESC" $BW_FOLDER_ID $BW_SSH_ITEM
push_folder ~/.ssh
echo -e "[.ssh backup complete.]\n"
echo "실패시, gpg --edit-key <KEY_ID> -> gpg> trust -> 5"
# icloud Documents 동기화폴더에도 복사해 주자.
rsync -avh $DOTFILES ~/Documents/$(hostname) --exclude .git --exclude log/ --delete
echo -e "[rsync to icloud documents backup Complete!]\n"
echo "$(date "+%Y-%m-%d %H:%M") Backup to https://github.com/ic4r/dotfiles Complete!"