#!/usr/bin/env bash # Atlus installer — targets DietPi, Armbian, Debian, Ubuntu # Usage: curl -sSL https://git.bytestud.io/roberts/atlus/raw/branch/main/install.sh | sudo bash set -euo pipefail INSTALL_DIR="/opt/atlus" CONFIG_DIR="/etc/atlus" DATA_DIR="/var/lib/atlus" SERVICE_FILE="/etc/systemd/system/atlus.service" REPO_URL="https://git.bytestud.io/roberts/atlus.git" # --------------------------------------------------------------------------- # Helpers # --------------------------------------------------------------------------- info() { echo -e "\033[1;34m[atlus]\033[0m $*"; } ok() { echo -e "\033[1;32m[atlus]\033[0m $*"; } err() { echo -e "\033[1;31m[atlus]\033[0m $*" >&2; } require_root() { if [[ $EUID -ne 0 ]]; then err "This installer must be run as root." exit 1 fi } detect_os() { if [ -f /etc/os-release ]; then . /etc/os-release OS_ID="${ID:-unknown}" OS_NAME="${PRETTY_NAME:-Linux}" else OS_ID="unknown" OS_NAME="Linux" fi info "Detected OS: $OS_NAME" } # --------------------------------------------------------------------------- # Install # --------------------------------------------------------------------------- install_deps() { info "Installing system dependencies..." apt-get update -qq apt-get install -y -qq \ python3 python3-venv python3-dev python3-pip \ libpam0g-dev \ git \ cifs-utils \ > /dev/null 2>&1 ok "System dependencies installed." } install_atlus() { info "Installing Atlus to $INSTALL_DIR..." if [ -d "$INSTALL_DIR/.git" ]; then info "Existing installation found — pulling latest..." cd "$INSTALL_DIR" git pull --ff-only else rm -rf "$INSTALL_DIR" git clone "$REPO_URL" "$INSTALL_DIR" cd "$INSTALL_DIR" fi # Python virtual environment info "Setting up Python venv..." python3 -m venv venv venv/bin/pip install --upgrade pip -q venv/bin/pip install -r backend/requirements.txt -q ok "Python dependencies installed." } setup_dirs() { mkdir -p "$CONFIG_DIR" "$DATA_DIR" chmod 700 "$DATA_DIR" } install_service() { info "Installing systemd service..." cp "$INSTALL_DIR/atlus.service" "$SERVICE_FILE" systemctl daemon-reload systemctl enable atlus.service systemctl restart atlus.service ok "Atlus service installed and started." } show_status() { echo "" ok "=============================" ok " Atlus installed!" ok "=============================" echo "" # Get primary IP IP=$(hostname -I 2>/dev/null | awk '{print $1}') if [ -n "$IP" ]; then info "Access Atlus at: http://$IP:7779" else info "Access Atlus at: http://$(hostname):7779" fi info "Log in with any system user (PAM authentication)." echo "" info "Manage the service:" info " systemctl status atlus" info " systemctl restart atlus" info " journalctl -u atlus -f" echo "" } # --------------------------------------------------------------------------- # Main # --------------------------------------------------------------------------- main() { echo "" echo " _ _ _" echo " /_\ | |_| |_ _ ___" echo " / _ \| _| | | | (_-<" echo " /_/ \_\\\\__|_| \\_,_/__/" echo "" echo " Web Desktop Environment for SBCs" echo "" require_root detect_os install_deps install_atlus setup_dirs install_service show_status } main "$@"