-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·57 lines (48 loc) · 1.66 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
#!/bin/bash
echo
echo "░█▀▀░█░█░█▀▀░█░░░█░░░░░▀█▀░█▀█░▀█▀░▀█▀"
echo "░▀▀█░█▀█░█▀▀░█░░░█░░░░░░█░░█░█░░█░░░█░"
echo "░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀░░░▀▀▀░▀░▀░▀▀▀░░▀░"
echo
if [[ "$(uname)" != "Darwin" ]]; then
echo "This setup is for MacOS only! Exitting..."
exit 0
fi
DEV_TOOLS=$HOME/Development/tools
echo "Creating Development (and tools) folder under $HOME..."
if [ -d "$DEV_TOOLS" ];
then
echo "Directory already exists."
else
mkdir -p $DEV_TOOLS
mkdir $DEV_TOOLS/bin
mkdir $DEV_TOOLS/go
fi
echo "Checking for prerequisites..."
xcode-select -p > /dev/null # run and save return value in next step
RETURN_VALUE=$?
if [ $RETURN_VALUE -ne 0 ];
then
xcode-select --install # prerequisitexcode-select -p
else
echo "Xcode command line tools are installed."
fi
echo "Installing Brew..."
if ! command -v brew &> /dev/null
then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
else
echo "Brew is already installed. Skipping..."
fi
echo "Installing chezmoi..."
if ! command -v chezmoi &> /dev/null
then
brew install chezmoi
else
echo "Chezmoi already installed. Attempting upgrade..."
brew upgrade chezmoi
fi
echo "Initializing and applying chezmoi over SSH..."
# chezmoi init martinnirtl/dotfiles --apply --source $DEV/chezmoi --ssh # wait for https://github.com/twpayne/chezmoi/issues/2771
chezmoi init github.com/martinnirtl/dotfiles --branch main --apply