#!/bin/sh
# Bakes a real, dereferenced copy of the NexusOS Plymouth theme into the
# initramfs. The theme files live in nexus-core and are exposed at
# /usr/share/plymouth/themes/my-custom-logo via a symlink into /home, which
# the stock initramfs plymouth hook copies verbatim -> it dangles at early
# boot (before /home is mounted) and Plymouth falls back to text mode.
# This hook runs after the stock "plymouth" hook and replaces that dangling
# symlink with the actual theme files.

PREREQS="plymouth"
prereqs() { echo "$PREREQS"; }

case "$1" in
	prereqs)
		prereqs
		exit 0
		;;
esac

. /usr/share/initramfs-tools/hook-functions

THEME_SRC="/home/jon/nexus-core/assets/boot/my-custom-logo"
THEME_DEST="${DESTDIR}/usr/share/plymouth/themes/my-custom-logo"

[ -d "${THEME_SRC}" ] || exit 0

rm -rf "${THEME_DEST}"
mkdir -p "${THEME_DEST}"
cp -aL "${THEME_SRC}/." "${THEME_DEST}/"
