xonecas.io
8058
Ir

irvc / files

irvc / deploy / install.sh

1.0 KB
1#!/usr/bin/env bash
2# Installs the IRVC + LiveKit services. Run with sudo from this directory.
3set -euo pipefail
4
5here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6caller="$(getent passwd "${SUDO_USER:-$USER}" | cut -d: -f6)"
7lk_bin_src="$caller/.local/bin/livekit-server"
8
9[[ $EUID -eq 0 ]] || { echo "run with sudo" >&2; exit 1; }
10[[ -x "$lk_bin_src" ]] || { echo "missing $lk_bin_src (download it first)" >&2; exit 1; }
11for f in livekit.yaml irvc.env livekit.service irvc.service; do
12  [[ -f "$here/$f" ]] || { echo "missing $here/$f" >&2; exit 1; }
13done
14
15install -m 755 "$lk_bin_src" /usr/local/bin/livekit-server
16install -o root -g user -m 640 "$here/livekit.yaml" /etc/livekit.yaml
17install -o root -g root -m 600 "$here/irvc.env"    /etc/irvc.env
18install -m 644 "$here/livekit.service" /etc/systemd/system/livekit.service
19install -m 644 "$here/irvc.service"    /etc/systemd/system/irvc.service
20
21systemctl daemon-reload
22systemctl enable --now livekit.service irvc.service
23
24systemctl --no-pager --full status livekit.service irvc.service || true