-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·59 lines (50 loc) · 1.59 KB
/
install.sh
File metadata and controls
executable file
·59 lines (50 loc) · 1.59 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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT_DIR"
PYTHON_BIN="${PYTHON_BIN:-python3}"
VENV_DIR="${VENV_DIR:-venv}"
echo "turing-smart-screen-python-HIDdev installer"
echo "==========================================="
if ! command -v "$PYTHON_BIN" >/dev/null 2>&1; then
echo "Error: $PYTHON_BIN was not found." >&2
exit 1
fi
if [ ! -d "$VENV_DIR" ]; then
echo "Creating virtual environment: $VENV_DIR"
"$PYTHON_BIN" -m venv "$VENV_DIR"
fi
echo "Installing Python requirements..."
"$VENV_DIR/bin/python" -m pip install --upgrade pip
"$VENV_DIR/bin/pip" install -r requirements.txt
echo
echo "Optional HID permission setup"
echo "-----------------------------"
if [ -f "tools/99-smartmonitor-hiddev.rules" ]; then
if command -v sudo >/dev/null 2>&1; then
read -r -p "Install udev rule for SmartMonitor HID access? [y/N] " answer
case "$answer" in
[yY]|[yY][eE][sS])
sudo cp tools/99-smartmonitor-hiddev.rules /etc/udev/rules.d/99-smartmonitor-hiddev.rules
sudo udevadm control --reload-rules
sudo udevadm trigger
echo "udev rule installed. Replug the monitor before running the app."
;;
*)
echo "Skipped udev rule installation."
;;
esac
else
echo "sudo not found; skipping udev rule installation."
fi
fi
echo
echo "Running doctor..."
"$VENV_DIR/bin/python" tools/smartmonitor-theme-manager.py doctor || true
echo
echo "Install complete."
echo "Start configuration with:"
echo " ./run-configure.sh"
echo
echo "Start the monitor runtime with:"
echo " ./run-monitor.sh"