forked from ZhongXiLu/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
executable file
·44 lines (31 loc) · 1.14 KB
/
init.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
#!/bin/bash
set -eu
SYSTEM_TYPE=$(uname -s)
USER=$(id -un)
if [[ "$SYSTEM_TYPE" = "Darwin" || "$SYSTEM_TYPE" = "Linux" ]]; then
if [ "$SYSTEM_TYPE" = "Linux" ]; then
sudo apt update && sudo apt -y upgrade && sudo apt install -y build-essential procps curl file git && sudo apt -y autoremove
fi
if [ ! command -v brew >/dev/null 2>&1 ]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "Homebrew ✅"
fi
if [[ "$SYSTEM_TYPE" = "Darwin" ]] && [ ! xcode-select --print-path &>/dev/null ]; then
xcode-select --install
echo "Xcode cli tools ✅"
fi
if ! brew list yadm >/dev/null; then
brew install yadm
echo "yadm ✅"
fi
if [ ! -f "$HOME/.config/yadm/bootstrap" ]; then
yadm clone https://github.com/brra/dotfiles-1.git --no-bootstrap
fi
yadm bootstrap
if [ $USER == "brra" ]; then
yadm decrypt --yadm-archive "$HOME/.config/yadm/archive"
fi
if git config remote.faraway.url > /dev/null; then
yadm remote add origin https://github.com/brra/dotfiles-1.git
fi
fi