setup-base-asahi.sh: - WireGuard-Setup (wireguard-tools + m1.conf Hinweis) - Header bereinigt, Nummerierung auf 1-8 setup-desktop-asahi.sh: - XFCE-Block durch GNOME-Einstellungen ersetzt (Dash to Panel, Power, Uhr 24h, Batterie-%, Terminal-Font) - FreeCAD als Flatpak - Powerlevel10k Instant Prompt quiet-Fix
239 lines
10 KiB
Bash
239 lines
10 KiB
Bash
#!/bin/bash
|
|
# macbook-setup/setup-desktop-asahi.sh
|
|
# Desktop-Setup fuer Asahi Linux (Fedora Remix) auf Apple Silicon M1
|
|
# Braucht eine laufende Desktop-Session (GNOME) — NICHT in chroot ausfuehren!
|
|
# Verwendung: bash setup-desktop-asahi.sh
|
|
# Wird automatisch beim ersten Login gestartet (via Autostart)
|
|
|
|
export LANG=en_US.UTF-8
|
|
FORGEJO="https://git.motocamp.de"
|
|
DOTFILES_REPO="$FORGEJO/rene/dotfiles-rene.git"
|
|
|
|
# ── 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 -eq 0 ]] && { fail "Nicht als root ausfuehren!"; exit 1; }
|
|
|
|
echo ""
|
|
echo "============================================"
|
|
echo " setup-desktop-asahi.sh startet"
|
|
echo "============================================"
|
|
|
|
# ── 1. oh-my-zsh ────────────────────────────────────────────────────────
|
|
echo -e "\n=== 1/8 oh-my-zsh ==="
|
|
if [[ ! -d ~/.oh-my-zsh ]]; then
|
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
|
fi
|
|
ok "oh-my-zsh installiert"
|
|
|
|
# ── 2. Zsh-Plugins & Powerlevel10k ──────────────────────────────────────
|
|
echo -e "\n=== 2/8 Zsh-Plugins & Powerlevel10k ==="
|
|
|
|
# zsh-syntax-highlighting
|
|
ZSH_SHL_DIR="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting"
|
|
if [[ ! -d "$ZSH_SHL_DIR/.git" ]]; then
|
|
rm -rf "$ZSH_SHL_DIR"
|
|
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_SHL_DIR"
|
|
fi
|
|
ok "zsh-syntax-highlighting"
|
|
|
|
# Powerlevel10k
|
|
P10K_DIR="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
|
|
if [[ ! -d "$P10K_DIR/.git" ]]; then
|
|
rm -rf "$P10K_DIR"
|
|
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$P10K_DIR"
|
|
fi
|
|
ok "Powerlevel10k"
|
|
|
|
# ── 3. MesloLGS NF Font (Powerlevel10k-Icons) ───────────────────────────
|
|
echo -e "\n=== 3/8 MesloLGS NF Font ==="
|
|
FONT_DIR="$HOME/.local/share/fonts"
|
|
mkdir -p "$FONT_DIR"
|
|
FONT_BASE="https://github.com/romkatv/powerlevel10k-media/raw/master"
|
|
for font in "MesloLGS NF Regular.ttf" "MesloLGS NF Bold.ttf" \
|
|
"MesloLGS NF Italic.ttf" "MesloLGS NF Bold Italic.ttf"; do
|
|
if [[ ! -f "$FONT_DIR/$font" ]]; then
|
|
curl -fsSL -o "$FONT_DIR/$font" "$FONT_BASE/${font// /%20}"
|
|
fi
|
|
done
|
|
fc-cache -f "$FONT_DIR" 2>/dev/null || true
|
|
ok "MesloLGS NF Fonts installiert"
|
|
|
|
# ── 4. npm global + Claude Code ─────────────────────────────────────────
|
|
echo -e "\n=== 4/8 Claude Code ==="
|
|
mkdir -p ~/.npm-global
|
|
npm config set prefix '~/.npm-global'
|
|
export PATH="$HOME/.npm-global/bin:$PATH"
|
|
npm install -g @anthropic-ai/claude-code
|
|
ok "Claude Code installiert"
|
|
|
|
# ── 5. Flatpak-Apps (Brave + ggf. weitere) ──────────────────────────────
|
|
echo -e "\n=== 5/8 Flatpak-Apps ==="
|
|
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
|
|
|
# Brave Browser
|
|
flatpak install --user -y flathub com.brave.Browser
|
|
ok "Brave Browser installiert (Flatpak)"
|
|
|
|
# PrusaSlicer — ARM64-Flatpak evtl. nicht verfuegbar
|
|
if flatpak install --user -y flathub com.prusa3d.PrusaSlicer 2>/dev/null; then
|
|
ok "PrusaSlicer installiert (Flatpak)"
|
|
else
|
|
warn "PrusaSlicer Flatpak nicht verfuegbar fuer ARM64 — ggf. aus Source bauen"
|
|
fi
|
|
|
|
# FreeCAD
|
|
flatpak install --user -y flathub org.freecad.FreeCAD
|
|
ok "FreeCAD installiert (Flatpak)"
|
|
|
|
# ── 6. PlatformIO (pipx) ────────────────────────────────────────────────
|
|
echo -e "\n=== 6/8 PlatformIO ==="
|
|
if ! command -v pio &>/dev/null; then
|
|
if pipx install platformio 2>/dev/null; then
|
|
pipx ensurepath
|
|
ok "PlatformIO installiert (pipx)"
|
|
else
|
|
warn "PlatformIO: Installation fehlgeschlagen (ARM64-Toolchains evtl. nicht verfuegbar)"
|
|
fi
|
|
else
|
|
ok "PlatformIO bereits installiert"
|
|
fi
|
|
|
|
# ── 7. Dot-Files ────────────────────────────────────────────────────────
|
|
echo -e "\n=== 7/8 Dot-Files ==="
|
|
DOTFILES_DIR="$HOME/git-projekte/dotfiles-rene"
|
|
if [[ ! -d "$DOTFILES_DIR" ]]; then
|
|
mkdir -p "$HOME/git-projekte"
|
|
git clone "$DOTFILES_REPO" "$DOTFILES_DIR"
|
|
fi
|
|
|
|
# Neovim
|
|
if [[ -f "$DOTFILES_DIR/nvim/install-nvim-dotfiles.sh" ]]; then
|
|
bash "$DOTFILES_DIR/nvim/install-nvim-dotfiles.sh"
|
|
ok "Dot-Files: nvim"
|
|
fi
|
|
|
|
# Micro
|
|
if [[ -f "$DOTFILES_DIR/micro/install-micro-dotfiles.sh" ]]; then
|
|
bash "$DOTFILES_DIR/micro/install-micro-dotfiles.sh"
|
|
ok "Dot-Files: micro"
|
|
fi
|
|
|
|
# oh-my-zsh custom (platformio.zsh etc.)
|
|
if [[ -d "$DOTFILES_DIR/oh-my-zsh/custom" ]] && [[ -d ~/.oh-my-zsh/custom ]]; then
|
|
for f in "$DOTFILES_DIR/oh-my-zsh/custom"/*.zsh; do
|
|
[[ -f "$f" ]] && ln -sf "$f" ~/.oh-my-zsh/custom/
|
|
done
|
|
ok "Dot-Files: oh-my-zsh custom"
|
|
fi
|
|
|
|
# heic-scripts nach ~/bin
|
|
mkdir -p ~/bin
|
|
if [[ -d "$DOTFILES_DIR/heic-scripts" ]]; then
|
|
for script in "$DOTFILES_DIR/heic-scripts"/*; do
|
|
[[ -f "$script" ]] && chmod +x "$script" && ln -sf "$script" ~/bin/
|
|
done
|
|
ok "Dot-Files: heic-scripts -> ~/bin"
|
|
fi
|
|
|
|
# git-check-all.sh + git-update-all.sh nach ~/
|
|
if [[ -d "$DOTFILES_DIR/bin" ]]; then
|
|
for script in "$DOTFILES_DIR/bin"/*; do
|
|
[[ -f "$script" ]] && chmod +x "$script" && ln -sf "$script" ~/
|
|
done
|
|
ok "Dot-Files: git-check-all.sh, git-update-all.sh, git-sync-all.sh -> ~/"
|
|
fi
|
|
|
|
# .zshrc (Symlink aus dotfiles-rene)
|
|
if [[ -f "$DOTFILES_DIR/zsh/install-zsh-dotfiles.sh" ]]; then
|
|
bash "$DOTFILES_DIR/zsh/install-zsh-dotfiles.sh"
|
|
ok "Dot-Files: .zshrc"
|
|
fi
|
|
|
|
# Powerlevel10k Instant Prompt: quiet-Modus ganz oben in .zshrc
|
|
# Muss VOR dem oh-my-zsh source stehen, nicht in .p10k.zsh (wird dort ueberschrieben)
|
|
if [[ -f ~/.zshrc ]] && ! grep -q 'POWERLEVEL9K_INSTANT_PROMPT=quiet' ~/.zshrc; then
|
|
sed -i '1i typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet' ~/.zshrc
|
|
ok "Powerlevel10k Instant Prompt: quiet"
|
|
fi
|
|
|
|
# ~/.secrets fuer API-Keys (source in .zshrc eintragen)
|
|
if ! grep -q 'source ~/.secrets' ~/.zshrc 2>/dev/null; then
|
|
echo '' >> ~/.zshrc
|
|
echo '# API-Keys (nicht ins Repo!)' >> ~/.zshrc
|
|
echo '[[ -f ~/.secrets ]] && source ~/.secrets' >> ~/.zshrc
|
|
ok "source ~/.secrets in .zshrc eingetragen"
|
|
fi
|
|
|
|
# .p10k.zsh
|
|
if [[ -f "$DOTFILES_DIR/.p10k.zsh" ]]; then
|
|
cp "$DOTFILES_DIR/.p10k.zsh" ~/.p10k.zsh
|
|
ok "Dot-Files: .p10k.zsh"
|
|
else
|
|
warn ".p10k.zsh nicht im Dotfiles-Repo — beim ersten zsh-Start 'p10k configure' ausfuehren"
|
|
fi
|
|
|
|
# ── 8. GNOME-Einstellungen ───────────────────────────────────────────────
|
|
echo -e "\n=== 8/8 GNOME-Einstellungen ==="
|
|
|
|
# Dash to Panel aktivieren (Taskleiste oben statt Dock + Top Bar)
|
|
if gnome-extensions list 2>/dev/null | grep -q dash-to-panel; then
|
|
gnome-extensions enable dash-to-panel@jderose9.github.com 2>/dev/null || true
|
|
# Panel-Position: oben
|
|
dconf write /org/gnome/shell/extensions/dash-to-panel/panel-positions '"{\"0\":\"TOP\"}"'
|
|
dconf write /org/gnome/shell/extensions/dash-to-panel/panel-sizes '"{\"0\":32}"'
|
|
ok "Dash to Panel aktiviert (oben, 32px)"
|
|
else
|
|
warn "Dash to Panel nicht installiert — mit 'sudo dnf install gnome-shell-extension-dash-to-panel' nachinstallieren"
|
|
fi
|
|
|
|
# Energieeinstellungen: am Netzteil nicht dimmen/ausschalten
|
|
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
|
|
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 900
|
|
gsettings set org.gnome.desktop.session idle-delay 300
|
|
ok "GNOME Power: Batterie-Sleep 15min, Idle-Dimming 5min, AC kein Sleep"
|
|
|
|
# Uhr: 24h-Format mit Datum und Wochentag
|
|
gsettings set org.gnome.desktop.interface clock-format '24h'
|
|
gsettings set org.gnome.desktop.interface clock-show-date true
|
|
gsettings set org.gnome.desktop.interface clock-show-weekday true
|
|
ok "GNOME Uhr: 24h mit Datum und Wochentag"
|
|
|
|
# Batterie-Prozent anzeigen
|
|
gsettings set org.gnome.desktop.interface show-battery-percentage true
|
|
ok "GNOME Batterie-Prozent angezeigt"
|
|
|
|
# GNOME Terminal: MesloLGS NF als Schriftart setzen
|
|
GNOME_TERM_PROFILE=$(gsettings get org.gnome.Terminal.ProfilesList default 2>/dev/null | tr -d "'")
|
|
if [[ -n "$GNOME_TERM_PROFILE" ]]; then
|
|
dconf write /org/gnome/terminal/legacy/profiles:/:$GNOME_TERM_PROFILE/use-system-font false
|
|
dconf write /org/gnome/terminal/legacy/profiles:/:$GNOME_TERM_PROFILE/font "'MesloLGS NF 11'"
|
|
ok "GNOME Terminal: MesloLGS NF 11"
|
|
fi
|
|
|
|
# ── Autostart entfernen ─────────────────────────────────────────────────
|
|
AUTOSTART_FILE="$HOME/.config/autostart/macbook-setup-desktop.desktop"
|
|
if [[ -f "$AUTOSTART_FILE" ]]; then
|
|
rm "$AUTOSTART_FILE"
|
|
ok "Firstboot-Autostart entfernt"
|
|
fi
|
|
|
|
# ── Zusammenfassung ──────────────────────────────────────────────────────
|
|
echo ""
|
|
echo "============================================"
|
|
echo -e " ${GREEN}Desktop-Setup abgeschlossen!${NC}"
|
|
echo "============================================"
|
|
echo ""
|
|
warn "Noch manuell erledigen:"
|
|
echo " 1. Synology Drive Client installieren (falls ARM64-Version verfuegbar)"
|
|
echo " 2. Thunderbird starten -> Profil aus Synology Drive einbinden"
|
|
echo " 3. Brave starten -> Synchronisation einrichten"
|
|
echo " 4. API-Key aus Bitwarden in ~/.secrets eintragen:"
|
|
echo " echo 'export ANTHROPIC_API_KEY=\"sk-ant-...\"' > ~/.secrets && chmod 600 ~/.secrets"
|
|
echo " 5. Falls PrusaSlicer fehlt: aus Source bauen (kein ARM64-Flatpak)"
|
|
echo " 6. PlatformIO testen: ESP32-Toolchains evtl. nur x86 verfuegbar"
|
|
echo " 7. Dash to Panel konfigurieren: Rechtsklick auf Leiste -> Einstellungen"
|