#!/bin/bash
# plymouth-custom.sh — Plymouth boot splash with user-supplied logo
#
# Called by install-modules.sh with PLYMOUTH_LOGO_SRC already exported.
# Validates the path then delegates all installation work to plymouth.sh.
# Supports PNG (used as-is) and SVG (converted via rsvg-convert).

set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/../../lib/logging.sh"

if [[ -z "${PLYMOUTH_LOGO_SRC:-}" ]]; then
    err "PLYMOUTH_LOGO_SRC is not set — cannot install custom Plymouth theme."
    exit 1
fi
if [[ ! -f "$PLYMOUTH_LOGO_SRC" ]]; then
    err "Logo file not found: $PLYMOUTH_LOGO_SRC"
    exit 1
fi

log "Custom Plymouth logo: $PLYMOUTH_LOGO_SRC"
export PLYMOUTH_LOGO_SRC
exec bash "$(dirname "${BASH_SOURCE[0]}")/plymouth.sh"
