-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·122 lines (102 loc) · 4.65 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·122 lines (102 loc) · 4.65 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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env bash
# Installer for Aura — Lenovo LOQ keyboard RGB backlight control (GTK4 GUI + CLI).
#
# This is the "no .deb" install path. It copies the app to /opt/aura, wires up
# the CLI, the udev rule, the desktop entry + icons, and the systemd units.
#
# sudo ./install.sh
#
# Idempotent: safe to re-run to upgrade an existing install.
set -euo pipefail
PREFIX=/opt/aura
BIN=/usr/local/bin/aura
SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
APPID=dev.lacina.Aura
DESKTOP_DIR=/usr/share/applications
ICON_ROOT=/usr/share/icons/hicolor
METAINFO_DIR=/usr/share/metainfo
if [[ $EUID -ne 0 ]]; then
echo "Please run as root: sudo ./install.sh" >&2
exit 1
fi
# ---------------------------------------------------------------------------
echo "==> Installing application to $PREFIX"
mkdir -p "$PREFIX"
# Refresh the payload (remove stale modules first so upgrades are clean).
rm -rf "$PREFIX/aura" "$PREFIX/bin"
cp -r "$SRC/aura" "$SRC/bin" "$PREFIX/"
# Drop any bytecode carried over from the source tree.
rm -rf "$PREFIX/aura/__pycache__"
chmod +x "$PREFIX/bin/aura" "$PREFIX/bin/aura-gui"
ln -sf "$PREFIX/bin/aura" "$BIN"
# ---------------------------------------------------------------------------
echo "==> Installing udev rule"
install -m 0644 "$SRC/udev/99-aura-loq.rules" /etc/udev/rules.d/99-aura-loq.rules
udevadm control --reload-rules || true
udevadm trigger --subsystem-match=hidraw || true
# ---------------------------------------------------------------------------
echo "==> Installing desktop entry, icons and AppStream metadata"
install -D -m 0644 "$SRC/data/$APPID.desktop" "$DESKTOP_DIR/$APPID.desktop"
install -D -m 0644 "$SRC/data/icons/hicolor/scalable/apps/$APPID.svg" \
"$ICON_ROOT/scalable/apps/$APPID.svg"
install -D -m 0644 "$SRC/data/icons/hicolor/symbolic/apps/$APPID-symbolic.svg" \
"$ICON_ROOT/symbolic/apps/$APPID-symbolic.svg"
install -D -m 0644 "$SRC/data/$APPID.metainfo.xml" "$METAINFO_DIR/$APPID.metainfo.xml"
# Refresh the desktop database and icon cache (best effort).
update-desktop-database "$DESKTOP_DIR" >/dev/null 2>&1 || true
gtk-update-icon-cache -f -t "$ICON_ROOT" >/dev/null 2>&1 || true
# ---------------------------------------------------------------------------
echo "==> Installing systemd units"
# System service: static boot default (optional). Enabled for backwards compat.
install -m 0644 "$SRC/systemd/aura.service" /etc/systemd/system/aura.service
# User service: the Ctrl+Space cycle. Runs as the logged-in user, reads
# ~/.config/aura/profile.json. Installed but NOT enabled as root — the user
# enables it (or the GUI toggle does).
install -D -m 0644 "$SRC/systemd/aura-cycle.service" \
/etc/systemd/user/aura-cycle.service
systemctl daemon-reload || true
# ---------------------------------------------------------------------------
echo "==> Seeding system config (/etc/aura)"
mkdir -p /etc/aura
if [[ ! -f /etc/aura/config.json ]]; then
cat > /etc/aura/config.json <<'JSON'
{
"mode": "solid",
"color": "#ffffff",
"brightness": 100,
"speed": 1.0
}
JSON
fi
if [[ ! -f /etc/aura/cycle.conf && -f "$SRC/config/cycle.conf" ]]; then
install -m 0644 "$SRC/config/cycle.conf" /etc/aura/cycle.conf
fi
# ---------------------------------------------------------------------------
# Let the invoking user reach /dev/hidraw and /dev/input without sudo.
TARGET_USER="${SUDO_USER:-}"
if [[ -n "$TARGET_USER" && "$TARGET_USER" != "root" ]]; then
echo "==> Adding $TARGET_USER to the 'input' group"
usermod -aG input "$TARGET_USER" || true
fi
# NB: the static boot default service (aura.service) is intentionally left
# DISABLED. It re-applies a fixed colour every 30 s, which fights the Ctrl+Space
# scene cycle. Use the cycle (user service) as the default; enable aura.service
# manually only if you want a single fixed colour instead of the cycle.
systemctl disable --now aura.service >/dev/null 2>&1 || true
# ---------------------------------------------------------------------------
cat <<EOF
Aura is installed.
Launch the app:
• From your app menu: search for "Aura"
• Or from a terminal: aura gui
• CLI is available as: aura status / aura color purple -b 80 / aura off
Start-up backlight:
The Ctrl+Space scene cycle runs as a *user* service. Enable it (as your
normal user, NOT root) so it starts at every login:
systemctl --user enable --now aura-cycle
The GUI's "Spustit po startu" toggle does the same thing for you.
A simple static boot default is provided by the system service 'aura.service'
(already enabled). If you use the cycle instead, disable it:
sudo systemctl disable --now aura.service
Note: log out and back in once so your new 'input' group membership applies.
EOF