Add install.sh web installer bootstrap script for curl one-liner execution
Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
@@ -20,6 +20,7 @@ Dieses Repository ist ein modulares, automatisiertes Setup- und Konfigurations-F
|
||||
|
||||
```
|
||||
.
|
||||
├── install.sh # Web-Installer & Bootstrap-Skript (curl | bash, klont nach /tmp)
|
||||
├── setup.sh # Zentraler Orchestrator (CLI Flags & whiptail TUI)
|
||||
├── lib/ # Wiederverwendbare Funktionsbibliotheken
|
||||
│ ├── utils.sh # Logging, Error-Traps, Benutzer- und Pfadermittlung, Backups
|
||||
|
||||
@@ -6,8 +6,22 @@ Ein modulares, sicheres und erweiterbares Framework zur automatisierten Einricht
|
||||
|
||||
## 🚀 Schnellstart
|
||||
|
||||
### 1. One-Liner (Klonen & Starten)
|
||||
Klonen des Repositories und direkter Start des Setups in einem einzigen Befehl:
|
||||
### 1. Web-Installer (Curl One-Liner)
|
||||
Das Setup kann direkt ohne vorheriges manuelles Klonen via `curl` gestartet werden. Das Installationsskript (`install.sh`) installiert bei Bedarf `git`, klont das Repository automatisch in ein temporäres Verzeichnis (`/tmp`), startet den Orchestrator und räumt nach Abschluss sauber auf:
|
||||
|
||||
```bash
|
||||
# Interaktiver Modus (whiptail Menü)
|
||||
curl -fsSL https://gitea.creative-dragonslayer.de/Scripts/Setup/raw/branch/main/install.sh | bash
|
||||
|
||||
# Vollautomatischer Modus (alle Stages 00 bis 10)
|
||||
curl -fsSL https://gitea.creative-dragonslayer.de/Scripts/Setup/raw/branch/main/install.sh | bash -s -- --all
|
||||
|
||||
# Gezielte Modulauswahl (z. B. Paketlisten und Schriften)
|
||||
curl -fsSL https://gitea.creative-dragonslayer.de/Scripts/Setup/raw/branch/main/install.sh | bash -s -- --stages 04,05
|
||||
```
|
||||
|
||||
### 2. Manuelles Klonen & Starten
|
||||
Alternativ kann das Repository manuell geklont und ausgeführt werden:
|
||||
```bash
|
||||
git clone https://gitea.creative-dragonslayer.de/Scripts/Setup.git && cd Setup && sudo ./setup.sh
|
||||
```
|
||||
@@ -16,25 +30,25 @@ Oder direkt vollautomatisch alle Stages (`00` bis `10`) ausführen:
|
||||
git clone https://gitea.creative-dragonslayer.de/Scripts/Setup.git && cd Setup && sudo ./setup.sh --all
|
||||
```
|
||||
|
||||
### 2. Interaktiver TUI-Modus (Empfohlen)
|
||||
### 3. Interaktiver TUI-Modus
|
||||
Starte das grafische Terminal-Menü (`whiptail`) zur flexiblen Auswahl einzelner Module:
|
||||
```bash
|
||||
sudo ./setup.sh
|
||||
```
|
||||
|
||||
### 3. Vollautomatischer CLI-Modus
|
||||
### 4. Vollautomatischer CLI-Modus
|
||||
Führe alle Phasen (`00` bis `10`) ohne Interaktion aus:
|
||||
```bash
|
||||
sudo ./setup.sh --all
|
||||
```
|
||||
|
||||
### 4. Gezielte Modulauswahl
|
||||
### 5. Gezielte Modulauswahl
|
||||
Installiere nur bestimmte Phasen (z. B. nur Paketlisten und Schriften):
|
||||
```bash
|
||||
sudo ./setup.sh --stages 04,05
|
||||
```
|
||||
|
||||
### 5. Simulationslauf (Dry-Run)
|
||||
### 6. Simulationslauf (Dry-Run)
|
||||
Überprüfe geplante Aktionen, ohne Änderungen am System vorzunehmen:
|
||||
```bash
|
||||
./setup.sh --dry-run --stages 01,02,04
|
||||
@@ -58,6 +72,7 @@ sudo ./setup.sh --stages 04,05
|
||||
|
||||
```
|
||||
.
|
||||
├── install.sh # Web-Installer & Bootstrap-Skript (curl | bash, klont nach /tmp)
|
||||
├── setup.sh # Zentraler Orchestrator (CLI Flags & whiptail TUI)
|
||||
├── lib/ # Wiederverwendbare Hilfsbibliotheken
|
||||
│ ├── utils.sh # Logging, Error-Traps (set -euo pipefail), Root/User-Erkennung & Abfrage
|
||||
|
||||
Executable
+134
@@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env bash
|
||||
# ==============================================================================
|
||||
# install.sh - Web installer and bootstrap script for Debian Setup Framework
|
||||
# ==============================================================================
|
||||
# Usage:
|
||||
# curl -fsSL https://gitea.creative-dragonslayer.de/Scripts/Setup/raw/branch/main/install.sh | bash
|
||||
# curl -fsSL https://gitea.creative-dragonslayer.de/Scripts/Setup/raw/branch/main/install.sh | bash -s -- --all
|
||||
# ==============================================================================
|
||||
set -euo pipefail
|
||||
|
||||
# ANSI Color Codes
|
||||
CLR_RESET='\033[0m'
|
||||
CLR_BOLD='\033[1m'
|
||||
CLR_RED='\033[0;31m'
|
||||
CLR_GREEN='\033[0;32m'
|
||||
CLR_YELLOW='\033[0;33m'
|
||||
CLR_BLUE='\033[0;34m'
|
||||
CLR_CYAN='\033[0;36m'
|
||||
|
||||
if [[ ! -t 1 ]]; then
|
||||
CLR_RESET=""
|
||||
CLR_BOLD=""
|
||||
CLR_RED=""
|
||||
CLR_GREEN=""
|
||||
CLR_YELLOW=""
|
||||
CLR_BLUE=""
|
||||
CLR_CYAN=""
|
||||
fi
|
||||
|
||||
log_info() {
|
||||
printf "${CLR_BLUE}[INFO]${CLR_RESET} %s\n" "$*"
|
||||
}
|
||||
|
||||
log_success() {
|
||||
printf "${CLR_GREEN}[✓]${CLR_RESET} %s\n" "$*"
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
printf "${CLR_YELLOW}[WARN]${CLR_RESET} %s\n" "$*" >&2
|
||||
}
|
||||
|
||||
log_error() {
|
||||
printf "${CLR_RED}[ERROR]${CLR_RESET} %s\n" "$*" >&2
|
||||
}
|
||||
|
||||
log_step() {
|
||||
printf "\n${CLR_BOLD}${CLR_CYAN}==>${CLR_RESET} ${CLR_BOLD}%s${CLR_RESET}\n" "$*"
|
||||
}
|
||||
|
||||
# If stdin is a pipe (e.g. curl ... | bash), reconnect to /dev/tty if available for interactive prompts & TUI
|
||||
if [[ ! -t 0 ]]; then
|
||||
if (exec < /dev/tty) 2>/dev/null; then
|
||||
exec < /dev/tty
|
||||
fi
|
||||
fi
|
||||
|
||||
REPO_URL="${REPO_URL:-https://gitea.creative-dragonslayer.de/Scripts/Setup.git}"
|
||||
REPO_BRANCH="${REPO_BRANCH:-}"
|
||||
|
||||
log_step "Debian Unstable & Hyprland Setup Framework Installer"
|
||||
log_info "Repository: $REPO_URL ${REPO_BRANCH:+(Branch: $REPO_BRANCH)}"
|
||||
|
||||
# Ensure git is available
|
||||
if ! command -v git >/dev/null 2>&1; then
|
||||
log_info "Installing git..."
|
||||
if [[ "$(id -u)" -eq 0 ]]; then
|
||||
DEBIAN_FRONTEND=noninteractive apt-get update -y
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates
|
||||
else
|
||||
if ! command -v sudo >/dev/null 2>&1; then
|
||||
log_error "sudo is required to install prerequisites. Please run as root or install sudo."
|
||||
exit 1
|
||||
fi
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create temporary directory
|
||||
TMP_DIR="$(mktemp -d /tmp/debian-setup-XXXXXX)"
|
||||
cleanup() {
|
||||
if [[ -d "$TMP_DIR" ]]; then
|
||||
log_info "Cleaning up temporary installation files..."
|
||||
rm -rf "$TMP_DIR"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
log_info "Cloning repository into temporary directory: $TMP_DIR..."
|
||||
CLONE_SUCCESS=0
|
||||
if [[ -n "$REPO_BRANCH" ]]; then
|
||||
if git clone --depth 1 -b "$REPO_BRANCH" "$REPO_URL" "$TMP_DIR" 2>/dev/null; then
|
||||
CLONE_SUCCESS=1
|
||||
else
|
||||
log_warn "Failed to clone branch '$REPO_BRANCH', falling back to default branch..."
|
||||
rm -rf "${TMP_DIR:?}"/* "${TMP_DIR:?}"/.* 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$CLONE_SUCCESS" -eq 0 ]]; then
|
||||
if git clone --depth 1 "$REPO_URL" "$TMP_DIR"; then
|
||||
CLONE_SUCCESS=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$CLONE_SUCCESS" -eq 0 ]]; then
|
||||
log_error "Failed to clone repository from $REPO_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$TMP_DIR"
|
||||
chmod +x setup.sh
|
||||
|
||||
log_success "Repository cloned successfully. Starting setup orchestrator..."
|
||||
|
||||
# Check if dry-run flag is requested
|
||||
is_dry_run=0
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" == "-d" || "$arg" == "--dry-run" ]]; then
|
||||
is_dry_run=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Execute setup.sh with root privileges (or directly if dry-run) while preserving arguments
|
||||
if [[ "$(id -u)" -eq 0 ]] || [[ "$is_dry_run" -eq 1 ]]; then
|
||||
./setup.sh "$@"
|
||||
else
|
||||
if ! command -v sudo >/dev/null 2>&1; then
|
||||
log_error "sudo is required to run setup.sh. Please install sudo or run as root."
|
||||
exit 1
|
||||
fi
|
||||
sudo ./setup.sh "$@"
|
||||
fi
|
||||
Reference in New Issue
Block a user