Files
moonarch/scripts/lib.sh
T
nevaforget 1e8b0d4ab0 cleanup: remove invented zsh override layer, harden moondoc
Earlier ClaudeCode sessions had wired a `~/.zshrc.d/*.zsh` snippet loop
plus a `~/.zshrc.local` fallback into defaults/shell/zshrc and made
post-install.sh create the directory unconditionally — neither is a zsh
convention nor documented anywhere. Remove both, simplify post-install
to write only `source /etc/zsh/zshrc.moonarch`, drop stale rustup
next-step hint, drop dead `confirm()` in lib.sh (orphan since
transform.sh deletion 2026-04-21).

moonarch-doctor: replace useless existence checks (zshrc.moonarch,
/usr/share/moonarch/) with real signal. User-service and helper-script
lists now derive from `pacman -Qql moonarch-git` (drift-proof) plus an
explicit list of post-install-enabled externals (currently `stasis`).
New udev-effectiveness check for charge_control_end_threshold —
verifies group=wheel + group-writable, surfaces broken rules instead
of staying silent.

Translate two German ABOUTME comments (moonarch-waybar-cpugov,
moonarch-waybar-gpustat) to English for consistency.
2026-05-04 11:09:45 +02:00

41 lines
975 B
Bash
Executable File

#!/bin/bash
# ABOUTME: Shared helper functions and constants for Moonarch scripts.
# ABOUTME: Sourced by post-install.sh.
# Path constants — BASH_SOURCE[1] resolves to the calling script, not lib.sh itself.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[1]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
OFFICIAL_PACKAGES="$PROJECT_DIR/packages/official.txt"
AUR_PACKAGES="$PROJECT_DIR/packages/aur.txt"
DEFAULTS_DIR="$PROJECT_DIR/defaults"
# --- Helper functions ---
log() {
echo -e "\e[1;34m[Moonarch]\e[0m $*"
}
err() {
echo -e "\e[1;31m[Moonarch ERROR]\e[0m $*" >&2
}
read_packages() {
grep -v '^\s*#' "$1" | grep -v '^\s*$'
}
# --- Prerequisite checks ---
check_not_root() {
if [[ $EUID -eq 0 ]]; then
err "Do NOT run as root. The script uses sudo where needed."
exit 1
fi
}
check_pacman() {
if ! command -v pacman &>/dev/null; then
err "pacman not found — is this really Arch Linux?"
exit 1
fi
}