#!/usr/bin/env bash # veilor-os — v0.3 theme polish: Plymouth, SDDM, Konsole, wallpaper, Breeze # Idempotent. Run as root during %post (chroot) or post-install. # Tools missing in the build chroot (e.g. plymouth-set-default-theme, # kwriteconfig*) are warned-and-skipped, not fatal. set -uo pipefail GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m' ok() { echo -e "${GREEN}[OK]${NC} $*"; } info() { echo -e "${YELLOW}[INFO]${NC} $*"; } warn() { echo -e "${YELLOW}[WARN]${NC} $*"; } err() { echo -e "${RED}[ERR]${NC} $*"; } [[ $EUID -eq 0 ]] || { err "Must run as root"; exit 1; } REPO="${VEILOR_REPO:-/usr/share/veilor-os}" ASSETS="$REPO/assets" if [[ ! -d $ASSETS ]]; then err "asset tree not found at $ASSETS — aborting" exit 1 fi echo "════════════════════════════════════════════════════════" echo " veilor-os :: 30-apply-v03-theme" echo "════════════════════════════════════════════════════════" # ───────────────────────────────────────────────────────────────────── # 1. Plymouth boot splash # ───────────────────────────────────────────────────────────────────── info "Plymouth: installing veilor theme" PLY_SRC="$ASSETS/plymouth/veilor" PLY_DST="/usr/share/plymouth/themes/veilor" if [[ -d $PLY_SRC ]]; then install -d -m 0755 "$PLY_DST" cp -af "$PLY_SRC/." "$PLY_DST/" chmod 0644 "$PLY_DST/"* ok "plymouth files copied to $PLY_DST" if command -v plymouth-set-default-theme &>/dev/null; then plymouth-set-default-theme -R veilor 2>/dev/null \ && ok "plymouth default theme = veilor (initramfs rebuilt)" \ || warn "plymouth-set-default-theme failed — set manually post-install" else warn "plymouth-set-default-theme not present (build chroot?) — skipping default-theme set" # Fall back: write theme name to plymouth config so dracut picks it up # next time initramfs is regenerated. if [[ -f /etc/plymouth/plymouthd.conf ]]; then sed -i 's/^Theme=.*/Theme=veilor/' /etc/plymouth/plymouthd.conf else install -d -m 0755 /etc/plymouth cat > /etc/plymouth/plymouthd.conf << 'EOF' [Daemon] Theme=veilor EOF fi ok "plymouth Theme= written to /etc/plymouth/plymouthd.conf" fi else warn "plymouth source dir missing at $PLY_SRC — skipping" fi # ───────────────────────────────────────────────────────────────────── # 2. SDDM theme # ───────────────────────────────────────────────────────────────────── info "SDDM: installing veilor-black theme" SDDM_SRC="$ASSETS/sddm/veilor-black" SDDM_DST="/usr/share/sddm/themes/veilor-black" if [[ -d $SDDM_SRC ]]; then install -d -m 0755 "$SDDM_DST" cp -af "$SDDM_SRC/." "$SDDM_DST/" chmod 0644 "$SDDM_DST/"* ok "sddm theme copied to $SDDM_DST" install -d -m 0755 /etc/sddm.conf.d # Preserve other sddm.conf.d/*.conf entries; this file owns [Theme] only. cat > /etc/sddm.conf.d/veilor-theme.conf << 'EOF' # veilor-os v0.3 — set veilor-black SDDM theme as default (matches reference system) [Theme] Current=veilor-black CursorTheme=Breeze_Light Font=Fira Code EOF ok "sddm theme set in /etc/sddm.conf.d/veilor-theme.conf" else warn "sddm source dir missing at $SDDM_SRC — skipping" fi # ───────────────────────────────────────────────────────────────────── # 3. Konsole profile + colorscheme # ───────────────────────────────────────────────────────────────────── info "Konsole: installing Veilor profile + colorscheme" KONS_SRC="$ASSETS/konsole" if [[ -d $KONS_SRC ]]; then install -d -m 0755 /usr/share/konsole install -m 0644 "$KONS_SRC/veilor.profile" /usr/share/konsole/Veilor.profile install -m 0644 "$KONS_SRC/veilor.colorscheme" /usr/share/konsole/Veilor.colorscheme ok "konsole profile + colorscheme installed" # Set as default in /etc/xdg/konsolerc (system-wide). Idempotent rewrite # of the [Desktop Entry] section's DefaultProfile key. install -d -m 0755 /etc/xdg if [[ -f /etc/xdg/konsolerc ]]; then # Remove any existing DefaultProfile= line, then re-add under [Desktop Entry]. if grep -q '^\[Desktop Entry\]' /etc/xdg/konsolerc; then sed -i '/^DefaultProfile=/d' /etc/xdg/konsolerc sed -i '/^\[Desktop Entry\]/a DefaultProfile=Veilor.profile' /etc/xdg/konsolerc else printf '\n[Desktop Entry]\nDefaultProfile=Veilor.profile\n' >> /etc/xdg/konsolerc fi else cat > /etc/xdg/konsolerc << 'EOF' [Desktop Entry] DefaultProfile=Veilor.profile [KonsoleWindow] ShowMenuBarByDefault=false ShowWindowTitleOnTitleBar=true [TabBar] TabBarVisibility=AlwaysHideTabBar EOF fi ok "konsole default profile set in /etc/xdg/konsolerc" else warn "konsole source dir missing at $KONS_SRC — skipping" fi # ───────────────────────────────────────────────────────────────────── # 4. Wallpaper — solid black (matches reference system, no SVG asset) # ───────────────────────────────────────────────────────────────────── info "Wallpaper: setting Plasma default to org.kde.color (solid black)" # reference system uses `wallpaperplugin=org.kde.color` + `Color=0,0,0` — pure black # rendered by Plasma's color plugin, no image asset needed. # Apply via system-wide kdedefaults so new users inherit. KDD=/etc/xdg/kdedefaults install -d -m 0755 "$KDD" cat > "$KDD/plasma-org.kde.plasma.desktop-appletsrc" << 'EOF' [Containments][1] plugin=org.kde.desktopcontainment wallpaperplugin=org.kde.color [Containments][1][Wallpaper][org.kde.color][General] Color=0,0,0 EOF ok "default wallpaper = solid #000000 (Plasma color plugin)" # ───────────────────────────────────────────────────────────────────── # 5. Breeze decoration override # ───────────────────────────────────────────────────────────────────── info "Breeze: installing veilor decoration override" BRZ_SRC="$ASSETS/kde/breezerc" BRZ_DST="/etc/xdg/breezerc" if [[ -f $BRZ_SRC ]]; then install -d -m 0755 /etc/xdg install -m 0644 "$BRZ_SRC" "$BRZ_DST" ok "breezerc installed at $BRZ_DST" # Also reflect title bar / button settings into kdeglobals so KWin # picks up the same values without users running kde-theme-apply.sh. KDG="/etc/xdg/kdedefaults/kdeglobals" if [[ -f $KDG ]]; then if ! grep -q '^\[KDE\]' "$KDG"; then echo -e '\n[KDE]\nSingleClick=false' >> "$KDG" fi ok "kdeglobals already present at $KDG (no overwrite)" else warn "kdeglobals not found at $KDG — kde-theme-apply.sh runs separately" fi else warn "breezerc source missing at $BRZ_SRC — skipping" fi # ───────────────────────────────────────────────────────────────────── # 6. Sanity: brand leak check (mirrors kickstart %post sanity) # ───────────────────────────────────────────────────────────────────── info "Sanity: scanning installed v0.3 paths for brand leaks" LEAK_PATHS=( "/usr/share/plymouth/themes/veilor" "/usr/share/sddm/themes/veilor-black" "/usr/share/konsole/Veilor.profile" "/usr/share/konsole/Veilor.colorscheme" "/etc/xdg/breezerc" "/etc/sddm.conf.d/veilor-theme.conf" "/etc/xdg/konsolerc" "/etc/xdg/kdedefaults/plasma-org.kde.plasma.desktop-appletsrc" ) LEAK=0 for p in "${LEAK_PATHS[@]}"; do [[ -e $p ]] || continue if grep -rqi 'onyx\|192\.168\.0\.\|fedora\.local\|admin@gmail' "$p" 2>/dev/null; then err "brand leak detected in $p" LEAK=1 fi done if [[ $LEAK -eq 0 ]]; then ok "no brand leaks in v0.3 theme assets" else warn "brand leaks present — review and rebuild" fi echo "════════════════════════════════════════════════════════" echo " 30-apply-v03-theme complete" echo "════════════════════════════════════════════════════════"