-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathpackages.sh
executable file
·105 lines (92 loc) · 2.44 KB
/
packages.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
#!/bin/bash
## =================================================================
## BUSTUB PACKAGE INSTALLATION
##
## This script will install all the packages that are needed to
## build and run the DBMS.
##
## Supported environments:
## * Ubuntu 18.04 (x86-64)
## * Ubuntu 20.04 (x86-64)
## * Ubuntu 22.04 (x86-64)
## * macOS 11 Big Sur (x86-64 or ARM)
## * macOS 12 Monterey (x86-64 or ARM)
## =================================================================
main() {
set -o errexit
if [ "$1" == "-y" ]
then
install
else
echo "PACKAGES WILL BE INSTALLED. THIS MAY BREAK YOUR EXISTING TOOLCHAIN."
echo "YOU ACCEPT ALL RESPONSIBILITY BY PROCEEDING."
read -p "Proceed? [Y/n] : " yn
case $yn in
Y|y) install;;
*) ;;
esac
fi
echo "Script complete."
}
install() {
set -x
UNAME=$(uname | tr "[:lower:]" "[:upper:]" )
case $UNAME in
DARWIN) install_mac ;;
LINUX)
version=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f 2)
case $version in
18.04) install_linux ;;
20.04) install_linux ;;
22.04) install_linux ;;
*) give_up ;;
esac
;;
*) give_up ;;
esac
}
give_up() {
set +x
echo "Unsupported distribution '$UNAME'"
echo "Please contact our support team for additional help."
echo "Be sure to include the contents of this message."
echo "Platform: $(uname -a)"
echo
echo "https://github.com/cmu-db/bustub/issues"
echo
exit 1
}
install_mac() {
# Install Homebrew.
if test ! $(which brew); then
echo "Installing Homebrew (https://brew.sh/)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# Update Homebrew.
brew update
# Install packages.
brew ls --versions cmake || brew install cmake
brew ls --versions coreutils || brew install coreutils
brew ls --versions doxygen || brew install doxygen
brew ls --versions git || brew install git
(brew ls --versions llvm | grep 12) || brew install llvm@12
}
install_linux() {
# Update apt-get.
apt-get -y update
# Install packages.
apt-get -y install \
build-essential \
clang-12 \
clang-format-12 \
clang-tidy-12 \
cmake \
doxygen \
git \
g++-12 \
pkg-config \
zlib1g-dev
}
main "$@"