- Remove defaults/user/ and the user-defaults copy loop from post-install.sh and transform.sh — Waybar falls back to /etc/xdg/waybar/ via XDG spec, no provisioning needed. - Remove USER_DEFAULTS constant from lib.sh. - Clean up style.css: remove dead selectors (#net, #cava, #custom-updates, #custom-notification), commented-out blocks, empty rules, duplicate properties, and hardcoded hex color. - Restructure module styling: generic top-level box via > widget > *, group children reset via widget widget > *, explicit exceptions for workspaces/taskbar/window. - Normalize section comments and whitespace. - Update README to remove user/waybar/ from project structure.
46 lines
1.1 KiB
Bash
Executable File
46 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# ABOUTME: Shared helper functions and constants for Moonarch scripts.
|
|
# ABOUTME: Sourced by post-install.sh, update.sh and transform.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*$'
|
|
}
|
|
|
|
confirm() {
|
|
read -r -p "$1 [y/N] " response
|
|
[[ "$response" =~ ^[yY]$ ]]
|
|
}
|
|
|
|
# --- 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
|
|
}
|