-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
92 lines (70 loc) · 1.87 KB
/
setup.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
cd $HOME
DOTFILES=$HOME/dotfiles
# ----- Create backup directory. -----
DATE=`date +%Y%m%d_%H%M%S`
BACKUP_DIR=$HOME/backup_home/$DATE
mkdir -p $BACKUP_DIR
echo "Created a directory: $BACKUP_DIR"
echo;
# ----- Create links with backup -----
FILES=(
Brewfile
.gitconfig
.ideavimrc
.tmux.conf
.vimrc
.zprofile
.zshrc
.asdfrc
.config/fish/config.fish
.config/fish/fish_plugins
.config/nvim
.config/powerline
.config/karabiner/assets
.config/starship.toml
)
mkdir -p $HOME/.config/{fish,nvim,karabiner}
mkdir -p $BACKUP_DIR/.config/{fish,nvim,karabiner}
for file in "${FILES[@]}"
do
if [[ -L $HOME/$file ]]; then
continue
fi
if [[ -e $HOME/$file ]]; then
cp -pr $HOME/$file $BACKUP_DIR/$file
rm -rf $HOME/$file
fi
ln -s $DOTFILES/$file $HOME/$file
done
# ----- Local settings templates -----
LOCAL_FILES=(
.local/.gitconfig
.local/.zshrc
.local/fish/config.fish
)
mkdir -p $HOME/.local/fish
for file in "${LOCAL_FILES[@]}"
do
if [[ ! -f $HOME/$file ]]; then
cp $DOTFILES/$file $HOME/$file
fi
done
# ----- Install dependencies -----
# Homebrew - https://docs.brew.sh/Installation
if ! type brew > /dev/null; then
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh
fi
PATH=$(brew --prefix)/bin:$PATH
brew bundle
# Poetry - https://python-poetry.org/docs/#installing-with-the-official-installer
if ! type poetry > /dev/null; then
curl -sSL https://install.python-poetry.org | python3 -
fi
# Fisher - https://github.com/jorgebucaran/fisher?tab=readme-ov-file#installation
if ! fish -c "type fisher > /dev/null"; then
fish -c "curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher update"
fi
echo "Setup has been done."
echo "Some manual operations are required. Please see https://github.com/masahirano/dotfiles#manual-operations"
echo;