dms-opt-in.sh RawHistoryFolder
1#!/bin/bash
2# dms-opt-in.sh — Optional Dank Linux full suite installation prompt
3# Runs at end of first-boot setup. Asks user if they want the full
4# Dank Linux desktop (compositor + DMS shell + terminal + all tools).
5set -euo pipefail
6
7LOG_FILE="$HOME/archup-first-boot.log"
8
9log() { echo "[dms-opt-in] $*" | tee -a "$LOG_FILE"; }
10
11FLAG_FILE="/var/lib/archup-install-danklinux"
12
13# Resolve the target user — must not run the installer as root
14INSTALL_USER="${ARCHUP_USERNAME:-}"
15if [ -z "$INSTALL_USER" ]; then
16 log "ARCHUP_USERNAME not set — skipping Dank Linux installation."
17 exit 0
18fi
19
20run_as_user() {
21 sudo -u "$INSTALL_USER" env HOME="/home/$INSTALL_USER" "$@"
22}
23
24# Auto-install if flag was set during installation
25if [ -f "$FLAG_FILE" ]; then
26 log "Dank Linux install flag detected — running installer automatically."
27 echo ""
28 echo "Installing Dank Linux (selected during system installation)..."
29 if run_as_user bash -c 'curl -fsSL https://install.danklinux.com | sh'; then
30 rm -f "$FLAG_FILE"
31 log "Dank Linux installation complete."
32 else
33 log "Dank Linux installer failed — flag preserved at $FLAG_FILE for retry."
34 exit 1
35 fi
36 exit 0
37fi
38
39# Skip if not running in an interactive terminal
40if [ ! -t 0 ]; then
41 log "Not running in interactive terminal — skipping Dank Linux opt-in."
42 exit 0
43fi
44
45# Manual prompt fallback (for reinstall / re-run scenarios)
46echo ""
47echo "=============================================="
48echo " Dank Linux — Optional Install"
49echo "=============================================="
50echo ""
51echo " Dank Linux is a full Wayland desktop suite:"
52echo " - Compositor: niri or Hyprland (your choice)"
53echo " - Shell: DankMaterialShell (Quickshell/Go)"
54echo " - Terminal: Ghostty"
55echo " - Auto-theming, notifications, app launcher,"
56echo " lock screen, system tray, search — all"
57echo " integrated. One install. Everything works."
58echo ""
59echo " Install: curl -fsSL https://install.danklinux.com | sh"
60echo " Note: This runs the official Dank Linux installer. Review at:"
61echo " https://github.com/AvengeMedia/DankMaterialShell"
62echo ""
63
64read -r -p " Do you want to run the Dank Linux installer? [y/N] " REPLY || true
65echo ""
66
67case "$REPLY" in
68 [yY][eE][sS]|[yY])
69 log "User opted in — starting Dank Linux installer."
70 echo "Starting Dank Linux installer..."
71 if run_as_user bash -c 'curl -fsSL https://install.danklinux.com | sh'; then
72 log "Dank Linux installation complete."
73 else
74 log "ERROR: Dank Linux installer failed (exit code $?)."
75 exit 1
76 fi
77 ;;
78 *)
79 log "User skipped Dank Linux installation."
80 echo "Skipping. Install later with:"
81 echo " curl -fsSL https://install.danklinux.com | sh"
82 echo ""
83 ;;
84esac