-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·25 lines (21 loc) · 830 Bytes
/
Copy pathinstall.sh
File metadata and controls
executable file
·25 lines (21 loc) · 830 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT"
if ! command -v python3 >/dev/null; then
echo "python3 required" >&2
exit 1
fi
if [[ ! -x "${ROOT}/.venv/bin/python" ]]; then
if ! python3 -m venv "${ROOT}/.venv" 2>/dev/null; then
ver="$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')"
if command -v nala >/dev/null; then
sudo nala install -y "python${ver}-venv" || sudo nala install -y python3-venv
elif command -v apt >/dev/null; then
sudo apt install -y "python${ver}-venv" || sudo apt install -y python3-venv
fi
python3 -m venv "${ROOT}/.venv"
fi
"${ROOT}/.venv/bin/pip" install -q -e "${ROOT}"
fi
exec "${ROOT}/.venv/bin/python" -m sysdash.setup