-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
executable file
·145 lines (121 loc) · 2.59 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
echo "Setting up a new mac book"
DOTFILES_DIR=$HOME/.dotfiles
WORK_CODE_DIR=$HOME/Work/Code
CODE_DIR=$HOME/Code
NVM_DIR=$HOME/.nvm
# Check if xcode-select —-install is installed
# Supporting Functions
brewPackageInstall() {
if brew ls --versions "$1";
then HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade "$1";
else HOMEBREW_NO_AUTO_UPDATE=1 brew install "$1";
fi
}
brewCaskInstall() {
brew install --cask $1
}
# Setup zsh as default shell
if [[ $SHELL != "/bin/zsh" ]]
then
echo "Changing default shell to zsh"
chsh -s /bin/zsh
fi
# Installing Homebrew
# Check for Homebrew and install
if test ! $(which brew);
then
echo " Installing Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/${USER}/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/${USER}/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
# Update brew
brew update
# Install required softwares
PACKAGES=(
azure-cli
coreutils
gnupg
grep
git
java
jq
kubectl
kubectx
nuget
nvm
python
python3
python@3.9
tree
vim
wget
yarn
zsh
zsh-completions
zsh-syntax-highlighting
zsh-autosuggestions
)
for package in "${PACKAGES[@]}"
do
echo "Installing package $package"
brewPackageInstall $package
done
# Install MacOs Applications
APPLICATIONS=(
adobe-acrobat-reader
dbeaver-community
docker
dotnet-sdk
github
google-chrome
iterm2
microsoft-azure-storage-explorer
pgadmin4
postman
rider
sourcetree
sublime-text
visual-studio-code
)
for application in "${APPLICATIONS[@]}"
do
echo "Installing application $application"
brewCaskInstall $application
done
brew cleanup
echo "Hombrew installation complete"
mkdir -p $WORK_CODE_DIR # Work Code
mkdir -p $CODE_DIR # Personal Code
mkdir $NVM_DIR #nvm dir
echo "Setting up dotfiles"
if [ -d "$DOTFILES_DIR" ]
then
echo "Dot files already exists, pulling in latest changes"
cd $DOTFILES_DIR
git pull origin master
cd $HOME
else
echo "Dotfiles does not exists, installing"
git clone https://github.com/ygnr/dotfiles.git $DOTFILES_DIR
fi
cd $DOTFILES_DIR
sudo /bin/bash script/bootstrap
sudo /bin/bash script/install
if [ -d "$CODE_DIR/mac-setup" ]
then
echo "Clone this repository into $CODE_DIR"
cd $CODE_DIR/mac-setup
git pull origin master
cd $HOME
else
echo "Mac setup does not exists, installing"
cd $CODE_DIR
git clone https://github.com/ygnr/mac-setup.git
cd mac-setup
echo "Change to ssh"
git remote set-url origin git@github.com:ygnr/mac-setup.git
cd $HOME
fi