#!/bin/sh
# Copy the skin sources into the installed skin when addons/skin.milionar is a copy, not the dev symlink (then no-op),
# and compose the installed skin.milionar.modern from them (docs/plan/skin-milionar/240-modern.md).
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
SRC="$ROOT/resources/skin.milionar"
DST="$ROOT/../skin.milionar"
if [ -L "$DST" ]; then
	echo "dev symlink: nothing to sync"
elif [ -d "$DST" ]; then
	rsync -a --exclude addon.xml --exclude changelog.txt "$SRC/" "$DST/" && echo "synced $SRC -> $DST" || exit 1
else
	echo "skin.milionar is not installed"; exit 1
fi
[ -d "$ROOT/../skin.milionar.modern" ] && exec python3 "$ROOT/scripts/skin_harness/compose_modern.py"
exit 0
