-
Notifications
You must be signed in to change notification settings - Fork 105
/
ubuntu-setup.sh
executable file
·60 lines (49 loc) · 1.47 KB
/
ubuntu-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
#!/bin/bash
COLOR_NONE="\033[0m"
COLOR_RED="\033[0;31m"
COLOR_GREEN="\033[0;32m"
COLOR_YELLOW="\033[0;33m"
COLOR_WHITE="\033[1;37m"
_version_check() {
curver="${1/v/}"; targetver="$2";
[ "$targetver" = "$(echo -e "$curver\n$targetver" | sort -V | head -n1)" ]
}
install_essential_packages() {
local -a packages; packages=( \
build-essential \
vim zsh curl \
software-properties-common \
cmake cmake-data universal-ctags autoconf pkg-config \
terminator htop iotop iftop \
unzip bzip2 gzip tar \
silversearcher-ag \
openssh-server mosh rdate \
)
sudo apt-get install -y ${packages[@]}
# python
sudo apt-get install -y python-dev virtualenv virtualenvwrapper
sudo apt-get install -y python-pip python3-pip
}
install_ppa_git() {
# https://launchpad.net/~git-core/+archive/ubuntu/ppa
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install -y git-all git-extras
}
install_ppa_nginx() {
sudo service apache2 stop || true;
# https://launchpad.net/~nginx/+archive/ubuntu/stable
sudo add-apt-repository -y ppa:nginx/stable
sudo apt-get update
sudo apt-get install -y nginx-full
}
# entrypoint script
if [ `uname` != "Linux" ]; then
echo "Run on Linux (not on Mac OS X)"; exit 1
fi
if [ -n "$1" ]; then
$1
else
echo "Usage: $0 [command], where command is one of the following:"
declare -F | cut -d" " -f3 | grep -v '^_'
fi