-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·74 lines (64 loc) · 1.7 KB
/
install.sh
File metadata and controls
executable file
·74 lines (64 loc) · 1.7 KB
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
#!/bin/bash
set -e
export DEBIAN_FRONTEND=noninteractive
export TZ=Etc/UTC
REPO_URL="https://github.com/SRA-VJTI/Pixels.git"
REPO_NAME="Pixels"
command_exists() {
command -v "$1" &>/dev/null
}
#detect os
OS=""
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
. /etc/os-release
if [[ "$ID_LIKE" == *"debian"* ]] || [[ "$ID" == "debian" ]] || [[ "$ID" == "ubuntu" ]]; then
OS="debian"
elif [[ "$ID_LIKE" == *"arch"* ]] || [[ "$ID" == "arch" ]]; then
OS="arch"
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS="macos"
elif grep -q "WSL" /proc/version &>/dev/null; then
OS="wsl"
fi
#updates
if ! command_exists sudo; then
case "$OS" in
debian|wsl) su -c "apt update && apt install -y sudo tzdata";;
arch)su -c "pacman -Sy --noconfirm sudo";;
*)echo "Install sudo manually"
exit 1;;
esac
fi
# Ensure Git is installed
if ! command_exists git; then
echo "Installing git..."
case "$OS" in
debian|wsl) sudo apt update && sudo apt install -y git tzdata ;;
arch) sudo pacman -Sy --noconfirm git ;;
macos) brew install git ;;
esac
fi
#checking if repo is present or not
if [ -f "Makefile" ]; then
echo "Running inside Pixels repository"
else
echo "Pixels repo not found, cloning"
git clone "$REPO_URL"
cd "$REPO_NAME"
fi
#make installation
if ! command_exists make; then
echo "Installing make..."
case "$OS" in
debian|wsl) sudo apt install -y make ;;
arch) sudo pacman -Sy --noconfirm make ;;
macos) brew install make ;;
esac
fi
if [[ "$OS" == "arch" ]]; then
export PACMAN="pacman -S --noconfirm"
fi
echo "Installing dependencies via make"
make install
echo "Setup complete"