Files
games/deploy/setup.sh
Ryan Hamamura 6d43bdea16
All checks were successful
CI / Deploy / test (pull_request) Successful in 16s
CI / Deploy / lint (pull_request) Successful in 25s
CI / Deploy / deploy (pull_request) Has been skipped
refactor: rename remaining c4 references to games
Update binary name, DB path, session cookie, deploy scripts, systemd
service, Docker config, CI workflow, and .dockerignore. Remove stale
Claude command and settings files.
2026-03-02 21:16:12 -10:00

30 lines
880 B
Bash
Executable File

#!/usr/bin/env bash
# One-time setup: create the games user, install directory, and systemd unit.
# Run as root (or with sudo).
set -euo pipefail
if [[ $EUID -ne 0 ]]; then
echo "Run as root: sudo $0" >&2
exit 1
fi
# Create system user if it doesn't exist
if ! id -u games &>/dev/null; then
useradd --system --shell /usr/sbin/nologin --home-dir /opt/games --create-home games
echo "Created system user: games"
else
echo "User 'games' already exists"
fi
# Ensure install directory exists with correct ownership
install -d -o games -g games -m 755 /opt/games
install -d -o games -g games -m 755 /opt/games/data
# Install systemd unit
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cp "$SCRIPT_DIR/games.service" /etc/systemd/system/games.service
systemctl daemon-reload
systemctl enable games.service
echo "Setup complete. Run deploy.sh to build and start the service."