-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.dotfiles
executable file
·41 lines (30 loc) · 1.66 KB
/
.dotfiles
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
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
# exit if any command has a non-zero exit status
set -euxo pipefail
echo "Clone bare repo using https (to avoid requiring .ssh key)"
cd $HOME && git clone --bare https://github.com/zigotica/tilde.git $HOME/._dotfiles.git
echo "Hide untracked files"
cd $HOME && git --git-dir=$HOME/._dotfiles.git/ --work-tree=$HOME config status.showUntrackedFiles no
echo "Add bare repo to .gitignore"
echo ._dotfiles.git >> $HOME/.gitignore
echo "backup current dotfiles"
mv $HOME/.config $HOME/.config.bk
mv $HOME/.bash_profile $HOME/.bash_profile.bk
mv $HOME/.bashrc $HOME/.bashrc.bk
mv $HOME/.gitconfig $HOME/.gitconfig.bk
mv $HOME/.gitignore $HOME/.gitignore.bk
mv $HOME/.gitignore_global $HOME/.gitignore_global.bk
mv $HOME/.tmux.conf $HOME/.tmux.conf.bk
mv $HOME/readme.md $HOME/readme.md.bk
echo "Checkout"
cd $HOME && git --git-dir=$HOME/._dotfiles.git/ --work-tree=$HOME checkout
echo "update remote url to use ssh"
git --git-dir=$HOME/._dotfiles.git/ --work-tree=$HOME remote set-url origin [email protected]:zigotica/tilde.git
echo "copy .ssh_bk encrypted files into .ssh and decrypt them"
mkdir $HOME/.ssh && cp $HOME/.ssh_bk/* $HOME/.ssh/ && ansible-vault decrypt $HOME/.ssh/*
echo "copy $HOME/.gitconfig-work-hanzo.bk encrypted file into $HOME/.gitconfig-work-hanzo and decrypt it"
cp $HOME/.gitconfig-work-hanzo.bk $HOME/.gitconfig-work-hanzo && ansible-vault decrypt $HOME/.gitconfig-work-hanzo
echo "copy $HOME/.bash_env_vars.bk encrypted file into $HOME/.bash_env_vars and decrypt it"
cp $HOME/.bash_env_vars.bk $HOME/.bash_env_vars && ansible-vault decrypt $HOME/.bash_env_vars
echo "DONE"
echo "Note that some of these changes require a logout/restart to take effect"