PVE-mods/src/NagScreen/patches/post-apply.sh
Meliox 0c25030a21
Migrate file patching from sed/python into generic patching scheme (#181)
* Start patching

* rework apply and revert patches to patch

* don't let a patch failure abort apt install

* roll the mod back if its post-apply hook errors

* add patch for gpu history

* Start patching

* rework apply and revert patches to patch

* don't let a patch failure abort apt install

* roll the mod back if its post-apply hook errors

* add patch for gpu history

* fix rrd history patch for compilation

* add test workflows

* Move test and CI to separate PR

* Start patching

* rework apply and revert patches to patch

* don't let a patch failure abort apt install

* roll the mod back if its post-apply hook errors

* add patch for gpu history

* fix rrd history patch for compilation

* add test workflows

* Move test and CI to separate PR

* readd test-release

* realign test-release with main

---------

Co-authored-by: Meliox <na>
2026-06-10 20:07:33 +02:00

27 lines
1.0 KiB
Bash

#!/usr/bin/env bash
# post-apply hook for the nag_screen mod.
# Runs after nag_screen patches are applied. Provided env: MOD_CONF, STASH_DIR,
# CONFD_DIR. Replaces the minified proxmoxlib with a symlink to the patched
# unminified copy so the browser serves the patched code. The original minified
# file is stashed (it is a non-patch binary replacement, so `patch -R` cannot
# restore it). Exit codes: 0 = no change, 100 = changed, other = error.
set -u
PROXMOXLIB_JS="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js"
PROXMOXLIB_MIN_JS="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.min.js"
STASH_DIR="${STASH_DIR:-/var/lib/pve-mod/backup}"
if [[ ! -L "$PROXMOXLIB_MIN_JS" ]]; then
mkdir -p "$STASH_DIR"
if [[ -f "$PROXMOXLIB_MIN_JS" ]]; then
mv "$PROXMOXLIB_MIN_JS" \
"$STASH_DIR/proxmoxlib.min.js.$(date +%Y%m%d_%H%M%S)" 2>/dev/null || true
fi
ln -sf "$PROXMOXLIB_JS" "$PROXMOXLIB_MIN_JS"
echo "[pve-mod] Symlinked proxmoxlib.min.js -> proxmoxlib.js"
exit 100
fi
exit 0