macbook-setup/setup-base-asahi.sh
rene b4a0f27b7b asciiquarium: Python-Port statt Perl (asciiquarium-ng von git.motocamp.de)
Ersetzt den Perl-tar.gz-Download mit sed-Patches durch den Python-Port.
Keine externen Perl-Abhängigkeiten mehr (Term::Animation, libcurses-perl).
2026-03-29 10:00:45 +02:00

139 lines
6.1 KiB
Bash

#!/bin/bash
# macbook-setup/setup-base-asahi.sh
# Basis-Setup fuer Asahi Linux (Fedora Remix) auf Apple Silicon M1
# Fokus: Terminal-Umgebung (zsh, Tools, Screensaver)
# System-spezifisches (HiDPI, Energie) wird vor Ort gemacht
# Verwendung: sudo bash setup-base-asahi.sh
# Kann mehrfach ausgefuehrt werden (idempotent)
# ── Farben ──────────────────────────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; NC='\033[0m'
ok() { echo -e "${GREEN}[OK] $*${NC}"; }
warn() { echo -e "${YELLOW}[!!] $*${NC}"; }
fail() { echo -e "${RED}[FAIL] $*${NC}"; }
# ── Root-Check ─────────────────────────────────────────────────────────
[[ $EUID -ne 0 ]] && { fail "Bitte als root ausfuehren (sudo)"; exit 1; }
echo ""
echo "============================================"
echo " setup-base-asahi.sh fuer M1 (Asahi Linux)"
echo " Terminal-Grundsetup"
echo "============================================"
# ── 1. sudoers ───────────────────────────────────────────────────────────
echo -e "\n=== 1/8 sudoers ==="
cat > /etc/sudoers <<'SUDOEOF'
Defaults env_reset
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
root ALL=(ALL:ALL) ALL
%wheel ALL=(ALL:ALL) ALL
@includedir /etc/sudoers.d
SUDOEOF
chmod 440 /etc/sudoers
echo "rene ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/rene
chmod 440 /etc/sudoers.d/rene
ok "sudoers: Linux-Standard + NOPASSWD fuer rene"
# ── 2. Locale & Timezone ────────────────────────────────────────────────
echo -e "\n=== 2/8 Locale & Timezone ==="
dnf install -y glibc-langpack-de 2>/dev/null || true
localectl set-locale LANG=de_DE.UTF-8
timedatectl set-timezone Europe/Berlin 2>/dev/null || true
ok "Locale: de_DE.UTF-8, Timezone: Europe/Berlin"
# ── 3. Sleep verhindern waehrend Installation ───────────────────────────
echo -e "\n=== 3/8 Sleep verhindern ==="
systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target 2>/dev/null || true
ok "Sleep/Suspend deaktiviert (fuer Installation)"
# ── 4. System aktualisieren ─────────────────────────────────────────────
echo -e "\n=== 4/8 System aktualisieren ==="
dnf upgrade -y || warn "dnf upgrade hatte Probleme"
ok "System aktuell"
# ── 5. Pakete installieren ──────────────────────────────────────────────
echo -e "\n=== 5/8 Pakete installieren ==="
# Basis-Tools
dnf install -y \
git curl wget \
zsh neovim micro \
python3 python3-pip pipx \
nodejs npm \
openssh-server \
bc \
|| warn "Einige Basis-Pakete konnten nicht installiert werden"
# Terminal-Tools
dnf install -y \
bat eza fd-find fzf ripgrep tldr ncdu duf \
zoxide \
htop btop \
fastfetch \
gammastep \
|| warn "Einige Terminal-Tools konnten nicht installiert werden"
# Spass-Tools
dnf install -y \
cowsay fortune-mod \
cmatrix \
perl-Curses \
|| warn "Einige Spass-Tools konnten nicht installiert werden"
ok "Pakete installiert"
# asciiquarium-ng (Python-Port, von git.motocamp.de)
if ! command -v asciiquarium &>/dev/null; then
curl -fsSL "https://git.motocamp.de/rene/asciiquarium/raw/branch/main/asciiquarium_ng.py" \
-o /usr/local/bin/asciiquarium \
&& chmod +x /usr/local/bin/asciiquarium \
&& ok "asciiquarium-ng installiert" \
|| warn "asciiquarium-ng uebersprungen"
fi
# ── 6. WireGuard VPN ──────────────────────────────────────────────────────
echo -e "\n=== 6/8 WireGuard VPN ==="
dnf install -y wireguard-tools 2>/dev/null || true
if [[ -f /etc/wireguard/m1.conf ]] || nmcli connection show m1 &>/dev/null; then
ok "WireGuard m1 bereits konfiguriert"
else
warn "WireGuard: m1.conf nach /etc/wireguard/ kopieren, dann: nmcli connection import type wireguard file /etc/wireguard/m1.conf"
fi
# ── 7. /etc/hosts ───────────────────────────────────────────────────────
echo -e "\n=== 7/8 /etc/hosts ==="
for entry in "10.47.11.10 dsm.motocamp.de" "10.47.11.23 git.motocamp.de"; do
host="${entry##* }"
if ! grep -q "$host" /etc/hosts; then
echo "$entry" >> /etc/hosts
ok "/etc/hosts: $host"
else
ok "/etc/hosts: $host (bereits vorhanden)"
fi
done
# ── 8. Services & Shell ─────────────────────────────────────────────────
echo -e "\n=== 8/8 Services & Shell ==="
systemctl enable sshd 2>/dev/null || true
systemctl start sshd 2>/dev/null || true
# zsh als Standard-Shell
chsh -s /bin/zsh rene 2>/dev/null || true
ok "sshd aktiviert, zsh als Standard-Shell"
# Sleep wieder erlauben
systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target 2>/dev/null || true
# ── Zusammenfassung ──────────────────────────────────────────────────────
echo ""
echo "============================================"
echo -e " ${GREEN}Terminal-Grundsetup abgeschlossen!${NC}"
echo "============================================"
echo ""
echo "Naechste Schritte:"
echo " 1. Ausloggen und als rene mit zsh neu einloggen"
echo " 2. setup-desktop-asahi.sh ausfuehren (oh-my-zsh, Dotfiles, p10k)"
echo " 3. WireGuard: m1.conf einrichten (falls noch nicht importiert)"