- contrib/teleportfling.service: per-user unit running the headless CLI with its own config (~/.config/teleportfling/daemon.json) - contrib/install-daemon.sh: builds the binary, installs the unit and a starter daemon config - contrib/README.md: install and management instructions - todo.md: mark --config and daemon items complete
58 lines
1.5 KiB
Bash
Executable File
58 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Install teleportfling as a per-user systemd service (daemon mode).
|
|
#
|
|
# Builds the headless binary, places it in ~/.local/bin, installs the user
|
|
# unit from contrib/teleportfling.service, and creates a starter daemon
|
|
# config. Run without sudo:
|
|
#
|
|
# ./contrib/install-daemon.sh
|
|
#
|
|
# Then start it with:
|
|
#
|
|
# systemctl --user enable --now teleportfling
|
|
set -euo pipefail
|
|
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
BIN_DIR="${HOME}/.local/bin"
|
|
SERVICE_DIR="${HOME}/.config/systemd/user"
|
|
CONFIG_DIR="${HOME}/.config/teleportfling"
|
|
CONFIG="${CONFIG_DIR}/daemon.json"
|
|
|
|
echo "Building teleportfling..."
|
|
(cd "${HERE}" && go build -o "${BIN_DIR}/teleportfling" ./cmd/teleportfling)
|
|
|
|
echo "Installing systemd user unit..."
|
|
mkdir -p "${SERVICE_DIR}"
|
|
install -m 0644 "${HERE}/contrib/teleportfling.service" "${SERVICE_DIR}/teleportfling.service"
|
|
|
|
if [[ ! -f "${CONFIG}" ]]; then
|
|
echo "Creating default daemon config at ${CONFIG}..."
|
|
mkdir -p "${CONFIG_DIR}"
|
|
cat > "${CONFIG}" <<'EOF'
|
|
{
|
|
"name": "TeleportFling Daemon",
|
|
"port": 9756,
|
|
"quality": 80,
|
|
"fps": 30,
|
|
"source": "screen",
|
|
"audio": true,
|
|
"stream_index": 0,
|
|
"announce": true
|
|
}
|
|
EOF
|
|
fi
|
|
|
|
echo "Reloading systemd and enabling the service..."
|
|
systemctl --user daemon-reload
|
|
systemctl --user enable teleportfling
|
|
|
|
cat <<EOF
|
|
|
|
Installed. Start the daemon with:
|
|
systemctl --user start teleportfling
|
|
|
|
Check status with:
|
|
systemctl --user status teleportfling
|
|
|
|
Edit settings in ${CONFIG} (the service passes it via --config).
|
|
EOF |