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>
This commit is contained in:
1 parent
0642e77429
commit
0c25030a21
21 files changed
+1686
-410
No files matched your search
Vendored
+1
-1
@@ -8,7 +8,7 @@ Homepage: https://github.com/Meliox/PVE-mods
|
||||
|
||||
Package: pve-mod
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, perl, librrds-perl
|
||||
Depends: ${misc:Depends}, perl, librrds-perl, patch
|
||||
Recommends: lm-sensors, nut-client
|
||||
Suggests: intel-gpu-tools
|
||||
Description: Proxmox VE UI modifications and sensor monitoring
|
||||
|
||||
Vendored
+2
@@ -1 +1,3 @@
|
||||
/etc/pve-mod/pve-mod.conf
|
||||
/etc/pve-mod/conf.d/node_info.conf
|
||||
/etc/pve-mod/conf.d/nag_screen.conf
|
||||
Vendored
+42
-15
@@ -1,9 +1,15 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
NODES_PM="/usr/share/perl5/PVE/API2/Nodes.pm"
|
||||
DEFAULT_CONF="/usr/share/pve-mod/pve-mod.conf.default"
|
||||
USER_CONF="/etc/pve-mod/pve-mod.conf"
|
||||
DEFAULT_DIR="/usr/share/pve-mod"
|
||||
CONF_DIR="/etc/pve-mod"
|
||||
|
||||
# Config file pairs to compare on upgrade: "<default-file>|<user-file>"
|
||||
CONF_PAIRS="
|
||||
${DEFAULT_DIR}/pve-mod.conf.default|${CONF_DIR}/pve-mod.conf
|
||||
${DEFAULT_DIR}/conf.d/node_info.conf.default|${CONF_DIR}/conf.d/node_info.conf
|
||||
${DEFAULT_DIR}/conf.d/nag_screen.conf.default|${CONF_DIR}/conf.d/nag_screen.conf
|
||||
"
|
||||
|
||||
# Extracts "section.key" pairs from an INI file, one per line.
|
||||
_extract_conf_keys() {
|
||||
@@ -17,38 +23,59 @@ _extract_conf_keys() {
|
||||
done < "$file"
|
||||
}
|
||||
|
||||
# Warns about keys present in the default config but missing from the user's config.
|
||||
_check_new_config_keys() {
|
||||
[ -f "$DEFAULT_CONF" ] || return 0
|
||||
[ -f "$USER_CONF" ] || return 0
|
||||
# Warns about keys present in a default config but missing from the user's copy.
|
||||
_check_one_pair() {
|
||||
local default_conf="$1" user_conf="$2"
|
||||
[ -f "$default_conf" ] || return 0
|
||||
[ -f "$user_conf" ] || return 0
|
||||
|
||||
local new_keys="" section="" key default_val
|
||||
local new_keys="" section="" key line
|
||||
while IFS= read -r line; do
|
||||
case "$line" in
|
||||
'#'*|'') continue ;;
|
||||
'['*']') section="${line#[}"; section="${section%]}"; continue ;;
|
||||
*'='*)
|
||||
key="${line%%=*}"
|
||||
if ! _extract_conf_keys "$USER_CONF" | grep -qF "${section}.${key}"; then
|
||||
new_keys="${new_keys} [${section}] ${line}\n"
|
||||
if ! _extract_conf_keys "$user_conf" | grep -qF "${section}.${key}"; then
|
||||
new_keys="${new_keys} [${section}] ${line} (${user_conf})\n"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done < "$DEFAULT_CONF"
|
||||
done < "$default_conf"
|
||||
|
||||
if [ -n "$new_keys" ]; then
|
||||
printf "%b" "$new_keys"
|
||||
fi
|
||||
}
|
||||
|
||||
# Warns about any new config keys across the main config and all per-mod configs.
|
||||
_check_new_config_keys() {
|
||||
local all_new="" pair default_conf user_conf
|
||||
while IFS= read -r pair; do
|
||||
[ -n "$pair" ] || continue
|
||||
default_conf="${pair%%|*}"
|
||||
user_conf="${pair#*|}"
|
||||
all_new="${all_new}$(_check_one_pair "$default_conf" "$user_conf")"
|
||||
done <<EOF
|
||||
$CONF_PAIRS
|
||||
EOF
|
||||
|
||||
if [ -n "$all_new" ]; then
|
||||
echo ""
|
||||
echo "pve-mod: New configuration options are available since your last install:"
|
||||
printf "%b" "$new_keys"
|
||||
echo "pve-mod: Run 'pve-mod-configure' to configure them, or add them manually to $USER_CONF"
|
||||
printf "%b" "$all_new"
|
||||
echo "pve-mod: Run 'pve-mod-configure' to configure them, or add them manually."
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
# Apply patches for any enabled modules. Fails loudly on error.
|
||||
/usr/lib/pve-mod/apply-patches.sh
|
||||
# Apply patches for any enabled modules. Don't abort the install if a
|
||||
# patch fails — warn instead so dpkg doesn't end half-configured.
|
||||
if ! /usr/lib/pve-mod/apply-patches.sh; then
|
||||
echo "pve-mod: WARNING: Some patches failed to apply. Run 'pve-mod-configure' to retry." >&2
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
echo ""
|
||||
|
||||
Vendored
+34
-5
@@ -31,17 +31,46 @@ override_dh_install:
|
||||
# JS module (rename to match loader reference)
|
||||
install -Dm644 src/PVENodeInfo/PveMod_pvemanagerlib.js \
|
||||
debian/pve-mod/usr/share/pve-manager/js/PveMod_PveNodeStatusView.js
|
||||
# Patch helpers
|
||||
install -Dm755 src/PVENodeInfo/apply-patches.sh \
|
||||
# Patch helpers (generic, manifest-driven)
|
||||
install -Dm755 src/Scripts/apply-patches.sh \
|
||||
debian/pve-mod/usr/lib/pve-mod/apply-patches.sh
|
||||
install -Dm755 src/PVENodeInfo/revert-patches.sh \
|
||||
install -Dm755 src/Scripts/revert-patches.sh \
|
||||
debian/pve-mod/usr/lib/pve-mod/revert-patches.sh
|
||||
# node_info mod patches + manifest + hooks
|
||||
install -Dm644 src/PVENodeInfo/patches/patches.list \
|
||||
debian/pve-mod/usr/lib/pve-mod/patches/node_info/patches.list
|
||||
install -Dm644 src/PVENodeInfo/patches/01-nodes-pm-sensors.patch \
|
||||
debian/pve-mod/usr/lib/pve-mod/patches/node_info/01-nodes-pm-sensors.patch
|
||||
install -Dm644 src/PVENodeInfo/patches/02-nodes-pm-GPU-RRD-history.patch \
|
||||
debian/pve-mod/usr/lib/pve-mod/patches/node_info/02-nodes-pm-GPU-RRD-history.patch
|
||||
install -Dm644 src/PVENodeInfo/patches/03-pvemanager-js-sensors.patch \
|
||||
debian/pve-mod/usr/lib/pve-mod/patches/node_info/03-pvemanager-js-sensors.patch
|
||||
install -Dm755 src/PVENodeInfo/patches/post-apply.sh \
|
||||
debian/pve-mod/usr/lib/pve-mod/patches/node_info/post-apply.sh
|
||||
# nag_screen mod patches + manifest + hooks
|
||||
install -Dm644 src/NagScreen/patches/patches.list \
|
||||
debian/pve-mod/usr/lib/pve-mod/patches/nag_screen/patches.list
|
||||
install -Dm644 src/NagScreen/patches/01-proxmoxlib-js-nagscreen.patch \
|
||||
debian/pve-mod/usr/lib/pve-mod/patches/nag_screen/01-proxmoxlib-js-nagscreen.patch
|
||||
install -Dm755 src/NagScreen/patches/post-apply.sh \
|
||||
debian/pve-mod/usr/lib/pve-mod/patches/nag_screen/post-apply.sh
|
||||
install -Dm755 src/NagScreen/patches/post-revert.sh \
|
||||
debian/pve-mod/usr/lib/pve-mod/patches/nag_screen/post-revert.sh
|
||||
# Configure tool
|
||||
install -Dm755 src/Scripts/pve-mod-configure \
|
||||
debian/pve-mod/usr/sbin/pve-mod-configure
|
||||
# Default config (conffile for user edits)
|
||||
# Main config (conffile for user edits)
|
||||
install -Dm644 src/pve-mod.conf \
|
||||
debian/pve-mod/etc/pve-mod/pve-mod.conf
|
||||
# Reference copy for upgrade key-diff (not a conffile — always updated)
|
||||
# Per-mod configs under conf.d (conffiles for user edits)
|
||||
install -Dm644 src/PVENodeInfo/node_info.conf \
|
||||
debian/pve-mod/etc/pve-mod/conf.d/node_info.conf
|
||||
install -Dm644 src/NagScreen/nag_screen.conf \
|
||||
debian/pve-mod/etc/pve-mod/conf.d/nag_screen.conf
|
||||
# Reference copies for upgrade key-diff (not conffiles — always updated)
|
||||
install -Dm644 src/pve-mod.conf \
|
||||
debian/pve-mod/usr/share/pve-mod/pve-mod.conf.default
|
||||
install -Dm644 src/PVENodeInfo/node_info.conf \
|
||||
debian/pve-mod/usr/share/pve-mod/conf.d/node_info.conf.default
|
||||
install -Dm644 src/NagScreen/nag_screen.conf \
|
||||
debian/pve-mod/usr/share/pve-mod/conf.d/nag_screen.conf.default
|
||||
Reference in new issue
Block a user