-
Notifications
You must be signed in to change notification settings - Fork 0
/
02-env-restore.sh
executable file
·58 lines (42 loc) · 1.46 KB
/
02-env-restore.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env zsh
# get scripts absolute directory path (compatible for symlink)
SCRIPT_PATH=$(dirname "$(readlink -f "$0")")
# include common functions
source $SCRIPT_PATH/common.sh
# load custom pre-restore scripts
trigger-phase-script "pre-restore"
echo "\n${BIWhite}Running environment restore${NC}"
# vim
copy-file $BACKUP_DIR_CLI/vimrc $HOME/.vimrc
copy-dir $BACKUP_DIR_CLI/vim/bundle/ $HOME/.vim/bundle/
# zshrc and oh-my-zsh
copy-file $BACKUP_DIR_CLI/zshrc $HOME/.zshrc
copy-dir $BACKUP_DIR_CLI/oh-my-zsh/ $HOME/.oh-my-zsh/
copy-dir $BACKUP_DIR_CLI/zfunc/ $HOME/.zfunc/
# backup zprofile for a reference, do not restore by default
# copy-file $BACKUP_DIR_CLI/zprofile $HOME/.zprofile
# ssh
copy-dir $BACKUP_DIR_CLI/ssh/ $HOME/.ssh/
# gitconfig
copy-file $BACKUP_DIR_CLI/gitconfig $HOME/.gitconfig
# npmrc
copy-file $BACKUP_DIR_CLI/npmrc $HOME/.npmrc
# aws
copy-dir $BACKUP_DIR_CLI/aws/ $HOME/.aws/
# pip
copy-dir $BACKUP_DIR_CLI/config/pip/ $HOME/.config/pip/
# podman
copy-dir $BACKUP_DIR_CLI/config/containers/ $HOME/.config/containers/
# ossutil
copy-file $BACKUP_DIR_CLI/ossutilconfig $HOME/.ossutilconfig
# custom scripts
copy-dir $BACKUP_ARCHIVE/custom-scripts/ $SCRIPT_PATH/custom-scripts/
# homebrew formula
if [[ $OS_TYPE == "MACOS" ]]; then
if [[ -f $BACKUP_DIR_CLI/Brewfile ]]; then
echo "\n${BIWhite}Restore homebrew formula${NC}"
brew bundle --file $BACKUP_DIR_CLI/Brewfile
fi
fi
# load custom post-restore scripts
trigger-phase-script "post-restore"