Restructure repo (#251)
* refactor: restructure src/ into modules/, scripts/, and build/ - src/nag_screen/ and src/node_info/ -> src/modules/ (mods grouped explicitly) - src/Scripts/ -> src/scripts/ (lowercase, consistent) - src/gen-rules.sh -> build/ (build tool separated from source) Update all references: debian/rules, .github/workflows/*, build/gen-rules.sh, src/scripts/test/test-syntax.sh (SRC_DIR now points to src/modules/), src/scripts/test/test-patches.sh, and files.list comments. * refactor: move CI test scripts from src/scripts/test/ to build/test/ Test scripts are not installed — they are CI/dev tooling and belong alongside build/gen-rules.sh. Update workflow references and fix the SRC_DIR path depth in build/test/test-syntax.sh (../ -> ../..). * d --------- Co-authored-by: Meliox <na>
This commit is contained in:
1 parent
3db6a010df
commit
6585849459
44 files changed
+342
-30
No files matched your search
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# post-apply hook for the node_info mod.
|
||||
# Runs after node_info patches are applied. Provided env: MOD_CONF, STASH_DIR,
|
||||
# CONFD_DIR. Creates the GPU RRD storage directory when GPU history is enabled.
|
||||
# Exit codes: 0 = no change, 100 = changed (restart pveproxy), other = error.
|
||||
|
||||
set -u
|
||||
|
||||
GPU_RRD_DIR="/var/lib/rrdcached/db/pve-mod-gpu"
|
||||
|
||||
read_conf() {
|
||||
local file="$1" section="$2" key="$3" default="${4:-0}"
|
||||
[[ -f "$file" ]] || { echo "$default"; return; }
|
||||
local val
|
||||
val=$(awk -F= -v sec="[$section]" -v k="$key" '
|
||||
/^\[/ { in_sec = ($0 == sec) }
|
||||
in_sec && /^[^#=]+=/ {
|
||||
gsub(/^[[:space:]]+|[[:space:]]+$/, "", $1)
|
||||
if ($1 == k) { gsub(/^[[:space:]]+|[[:space:]]+$/, "", $2); print $2; exit }
|
||||
}
|
||||
' "$file")
|
||||
echo "${val:-$default}"
|
||||
}
|
||||
|
||||
gpu_history="$(read_conf "${MOD_CONF:-/etc/pve-mod/conf.d/node_info.conf}" gpu gpu_history 0)"
|
||||
|
||||
if [[ "$gpu_history" == "1" && ! -d "$GPU_RRD_DIR" ]]; then
|
||||
mkdir -p "$GPU_RRD_DIR"
|
||||
chown www-data:www-data "$GPU_RRD_DIR" 2>/dev/null || true
|
||||
echo "[pve-mod] Created GPU RRD directory: $GPU_RRD_DIR"
|
||||
exit 100
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in new issue
Block a user