-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·64 lines (51 loc) · 1.72 KB
/
install.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
#!/bin/bash
function install_packages () {
if [ "$INSTALL_PACKAGES_AS_ROOT" = true ]; then
echo "Installing: ${1} as root!"
sudo $PACKAGE_MANAGER install ${1}
else
echo "Installing: ${1}!"
$PACKAGE_MANAGER install ${1}
fi
}
THIS_SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# get the package manager
if [ -n "$1" ]; then
PACKAGE_MANAGER=$1
echo "Package manager set to $PACKAGE_MANAGER."
else
echo "Usage: sudo ./install PACKAGE_MANAGER"
exit 1
fi
# if package manager should be run as root (defaults to true)
# this is here to add support for homebrew which no longer supports being
# run as root
INSTALL_PACKAGES_AS_ROOT=true
if [ -n "$2" ]; then
INSTALL_PACKAGES_AS_ROOT=$2
fi
# some essential packages to get started
PACKAGES="git make gcc wget curl tmux zsh vim llvm ruby"
install_packages "$PACKAGES"
# oh my zsh!
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
# syntax highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
echo "plugins=( [plugins...] zsh-syntax-highlighting)" >> $HOME/.zshrc
# change shell to zsh
chsh -s $(which zsh)
# detect os
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
esac
# install go (only supporting linux here)
if [[ "$machine" == "Linux" ]]; then
wget https://golang.org/dl/go1.17.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.17.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.zshrc
rm go1.17.linux-amd64.tar.gz
source $HOME/.zshrc
fi
echo "Setup complete!"