44 lines
1.7 KiB
Bash
Executable File
44 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# One-time setup: backone group membership + backone-webhub install/start.
|
|
# Run: sudo ./scripts/linux-setup-backone-access.sh
|
|
set -euo pipefail
|
|
|
|
TARGET_USER="${SUDO_USER:-${USER}}"
|
|
BACKONE_REPO="${BACKONE_REPO:-/home/ariska/git/BackOne}"
|
|
|
|
if [[ "${EUID}" -ne 0 ]]; then
|
|
echo "Run with sudo: sudo $0" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Adding ${TARGET_USER} to group backone..."
|
|
usermod -aG backone "${TARGET_USER}"
|
|
|
|
echo "Installing python3-websockets if needed..."
|
|
apt-get install -y python3-websockets 2>/dev/null || pip3 install websockets --break-system-packages 2>/dev/null || true
|
|
|
|
mkdir -p /usr/lib/backone/addons/webhub
|
|
if [[ -f "${BACKONE_REPO}/addons/webhub/backone-webhub" ]]; then
|
|
install -m 755 "${BACKONE_REPO}/addons/webhub/backone-webhub" /usr/lib/backone/addons/webhub/backone-webhub
|
|
else
|
|
echo "Missing ${BACKONE_REPO}/addons/webhub/backone-webhub" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -f "${BACKONE_REPO}/addons/webhub/backone-webhub.service" ]]; then
|
|
install -m 644 "${BACKONE_REPO}/addons/webhub/backone-webhub.service" /lib/systemd/system/backone-webhub.service
|
|
systemctl daemon-reload
|
|
systemctl enable backone-webhub.service
|
|
systemctl restart backone-webhub.service
|
|
systemctl --no-pager status backone-webhub.service || true
|
|
else
|
|
echo "No systemd unit; starting webhub in background..."
|
|
nohup /usr/lib/backone/addons/webhub/backone-webhub >/var/log/backone-webhub.log 2>&1 &
|
|
fi
|
|
|
|
echo ""
|
|
echo "Done. ${TARGET_USER} must log out and back in (or: newgrp backone) for group membership."
|
|
echo "Then run BackOneUI:"
|
|
echo " export LD_LIBRARY_PATH=\"\$HOME/backone-ui-build-deps/usr/lib/x86_64-linux-gnu:\$LD_LIBRARY_PATH\""
|
|
echo " ~/git/BackOneUI/target/debug/backone_desktop_ui"
|