chore: add build scaffolding, overlay structure, CI workflow: apply-overlay.sh
This commit is contained in:
parent
e708a4ac63
commit
2f9fd42a91
1 changed files with 67 additions and 0 deletions
67
apply-overlay.sh
Normal file
67
apply-overlay.sh
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#!/bin/sh
|
||||
# apply-overlay.sh — Wild Dragon reskin applied to a freshly cloned
|
||||
# datarhei/restreamer-ui tree. Two phases:
|
||||
#
|
||||
# 1. File overlay: cp the contents of $OVERLAY/{public,src} on top of
|
||||
# the upstream working tree. Whole-file replacements only — simple
|
||||
# and idempotent. Modified views (Edit/index.js, Main/index.js) and
|
||||
# all new components (WHEP.js, WHEPStatus.js, Logo/) live here.
|
||||
#
|
||||
# 2. Targeted awk patches for one-line UI strings that aren't worth a
|
||||
# whole-file overlay (the header title, welcome strings). Each
|
||||
# pattern is anchored to unique surrounding context so a future
|
||||
# upstream rename fails loudly rather than silently no-op'ing.
|
||||
#
|
||||
# Caller: the Dockerfile ui-builder stage. Expects:
|
||||
# $OVERLAY = /overlay (repo overlay/ COPYd into the build)
|
||||
# $UI = /ui (cloned upstream source root)
|
||||
#
|
||||
# Idempotent on a single source tree (re-running is a no-op).
|
||||
|
||||
set -eu
|
||||
|
||||
OVERLAY="${OVERLAY:-/overlay}"
|
||||
UI="${UI:-/ui}"
|
||||
|
||||
echo "wilddragon-overlay: layering $OVERLAY -> $UI"
|
||||
|
||||
# Phase 1 — file copies. -L follows symlinks, -p preserves perms,
|
||||
# -R recursive. --delete is intentionally omitted: the upstream tree
|
||||
# stays intact except for the files we override.
|
||||
for sub in public src; do
|
||||
if [ -d "$OVERLAY/$sub" ]; then
|
||||
cp -RLp "$OVERLAY/$sub/." "$UI/$src/"
|
||||
fi
|
||||
done
|
||||
|
||||
# Phase 2 — targeted awk patches. Fails loudly if the needle is missing
|
||||
# (upstream changed the patched line).
|
||||
patch_line() {
|
||||
file="$1"; needle="$2"; replacement="$3"
|
||||
if ! grep -qF "$needle" "$file"; then
|
||||
echo "wilddragon-overlay: ERROR — pattern not found in $file:"
|
||||
echo " $needle"
|
||||
exit 1
|
||||
fi
|
||||
tmp="$(mktemp)"
|
||||
awk -v n="$needle" -v r="$replacement" '
|
||||
index($0, n) { sub(n, r); }
|
||||
{ print }
|
||||
' "$file" > "$tmp"
|
||||
mv "$tmp" "$file"
|
||||
echo "wilddragon-overlay: patched $(basename "$file") — $needle -> $replacement"
|
||||
}
|
||||
|
||||
patch_line "$UI/src/Header.js" \
|
||||
'<Typography className="headerTitle">Restreamer</Typography>' \
|
||||
'<Typography className="headerTitle">Wild Dragon</Typography>'
|
||||
|
||||
patch_line "$UI/src/views/Welcome.js" \
|
||||
'title="Welcome to Restreamer v2"' \
|
||||
'title="Welcome to Wild Dragon"'
|
||||
|
||||
patch_line "$UI/src/views/Settings.js" \
|
||||
'title="Welcome to Restreamer v2"' \
|
||||
'title="Welcome to Wild Dragon"'
|
||||
|
||||
echo "wilddragon-overlay: done."
|
||||
Loading…
Reference in a new issue