260 lines
12 KiB
Bash
Executable file
260 lines
12 KiB
Bash
Executable file
#!/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 system default
|
|
[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 — pure black (default: org.kde.color plugin; image fallback)
|
|
# ─────────────────────────────────────────────────────────────────────
|
|
info "Wallpaper: installing veilor-black image and setting Plasma defaults"
|
|
|
|
# 4a. Install wallpaper images for users who prefer org.kde.image. The
|
|
# veilor-black asset (PNG primary, SVG fallback) is a 3840x2160 pure
|
|
# black canvas with a tiny low-opacity wordmark in the corner.
|
|
WP_SRC="$ASSETS/wallpapers"
|
|
WP_DST="/usr/share/wallpapers/veilor-black/contents/images"
|
|
WP_META="/usr/share/wallpapers/veilor-black/metadata.desktop"
|
|
if [[ -d $WP_SRC ]]; then
|
|
install -d -m 0755 "$WP_DST"
|
|
if [[ -f $WP_SRC/veilor-black.png ]]; then
|
|
install -m 0644 "$WP_SRC/veilor-black.png" "$WP_DST/veilor-black.png"
|
|
ok "wallpaper PNG installed at $WP_DST/veilor-black.png"
|
|
fi
|
|
if [[ -f $WP_SRC/veilor-black.svg ]]; then
|
|
install -m 0644 "$WP_SRC/veilor-black.svg" "$WP_DST/veilor-black.svg"
|
|
ok "wallpaper SVG installed at $WP_DST/veilor-black.svg"
|
|
fi
|
|
install -d -m 0755 "$(dirname "$WP_META")"
|
|
cat > "$WP_META" << 'EOF'
|
|
[Desktop Entry]
|
|
Name=veilor-black
|
|
X-KDE-PluginInfo-Name=veilor-black
|
|
X-KDE-PluginInfo-Author=veilor-os
|
|
X-KDE-PluginInfo-License=MIT
|
|
X-KDE-PluginInfo-Version=0.3
|
|
EOF
|
|
ok "wallpaper metadata installed at $WP_META"
|
|
else
|
|
warn "wallpaper source dir missing at $WP_SRC — skipping image install"
|
|
fi
|
|
|
|
# 4b. Default wallpaper plugin: org.kde.color with Color=0,0,0 (pure black).
|
|
# This is the lowest-overhead path — Plasma renders the colour without
|
|
# loading an image. Users may switch to org.kde.image and pick the
|
|
# veilor-black wallpaper installed above if they prefer.
|
|
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
|
|
|
|
[Containments][1][Wallpaper][org.kde.image][General]
|
|
Image=/usr/share/wallpapers/veilor-black/contents/images/veilor-black.png
|
|
EOF
|
|
ok "default wallpaper plugin = org.kde.color (#000000); image fallback wired"
|
|
|
|
# ─────────────────────────────────────────────────────────────────────
|
|
# 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. Branding logo (referenced by /etc/os-release LOGO field)
|
|
# ─────────────────────────────────────────────────────────────────────
|
|
info "Branding: installing veilor logo into /usr/share/pixmaps"
|
|
BR_SRC="$ASSETS/branding"
|
|
if [[ -f $BR_SRC/veilor-logo.svg ]]; then
|
|
install -d -m 0755 /usr/share/pixmaps
|
|
install -m 0644 "$BR_SRC/veilor-logo.svg" /usr/share/pixmaps/veilor-logo.svg
|
|
ok "logo installed at /usr/share/pixmaps/veilor-logo.svg"
|
|
# Plymouth theme can pick up the same asset for consistency.
|
|
if [[ -d /usr/share/plymouth/themes/veilor ]]; then
|
|
install -m 0644 "$BR_SRC/veilor-logo.svg" /usr/share/plymouth/themes/veilor/veilor-logo.svg
|
|
ok "logo mirrored into plymouth theme dir"
|
|
fi
|
|
else
|
|
warn "branding source missing at $BR_SRC/veilor-logo.svg — skipping"
|
|
fi
|
|
|
|
# ─────────────────────────────────────────────────────────────────────
|
|
# 7. 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"
|
|
"/usr/share/wallpapers/veilor-black"
|
|
"/usr/share/pixmaps/veilor-logo.svg"
|
|
)
|
|
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 "════════════════════════════════════════════════════════"
|