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
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Downloads upstream Proxmox VE packages and extracts all their files to real
|
||||
# system paths, so the patch engine can be exercised on a plain CI runner.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SUITE="${PVE_SUITE:-trixie}"
|
||||
WORKDIR="$(mktemp -d)"
|
||||
trap 'rm -rf "$WORKDIR"' EXIT
|
||||
|
||||
echo "[fetch] Configuring Proxmox no-subscription repo ($SUITE)..."
|
||||
sudo wget -q "https://enterprise.proxmox.com/debian/proxmox-archive-keyring-${SUITE}.gpg" \
|
||||
-O /usr/share/keyrings/proxmox-archive-keyring.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/proxmox-archive-keyring.gpg] http://download.proxmox.com/debian/pve $SUITE pve-no-subscription" \
|
||||
| sudo tee /etc/apt/sources.list.d/pve-test.list >/dev/null
|
||||
sudo apt-get update -qq
|
||||
|
||||
echo "[fetch] Downloading pve-manager, proxmox-widget-toolkit, pve-yew-mobile-gui, libjson-perl, libpve-common-perl, libclone-perl, liblinux-inotify2-perl, libcommon-sense-perl, libhttp-message-perl, libstring-shellquote-perl, libencode-locale-perl, libdevel-cycle-perl, liburi-perl, libnet-ip-perl, libtimedate-perl and libfilesys-df-perl..."
|
||||
cd "$WORKDIR"
|
||||
apt-get download pve-manager proxmox-widget-toolkit pve-yew-mobile-gui libjson-perl libpve-common-perl libclone-perl liblinux-inotify2-perl libcommon-sense-perl libhttp-message-perl libstring-shellquote-perl libencode-locale-perl libdevel-cycle-perl liburi-perl libnet-ip-perl libtimedate-perl libfilesys-df-perl
|
||||
|
||||
echo "[fetch] Extracting to system paths..."
|
||||
for deb in *.deb; do
|
||||
echo "[fetch] $deb"
|
||||
sudo dpkg-deb -x "$deb" /
|
||||
done
|
||||
|
||||
echo "[fetch] Done."
|
||||
@@ -1,112 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# src/gen-rules.sh
|
||||
#
|
||||
# Generates the per-module portion of the Debian build configuration from each
|
||||
# module's metadata, so adding or changing a module never requires touching
|
||||
# debian/rules by hand.
|
||||
#
|
||||
# A module is any directory under src/ that contains a files/ and/or patches/
|
||||
# subdirectory (so src/Scripts/, which has neither, is ignored). The module's
|
||||
# directory name is its canonical mod key (matches the [modules] keys in
|
||||
# pve-mod.conf and the install path usr/lib/pve-mod/patches/<mod>/).
|
||||
#
|
||||
# Usage:
|
||||
# gen-rules.sh Emit dpkg install lines (tab-indented, no header).
|
||||
# Append to debian/rules' override_dh_install recipe:
|
||||
# bash src/gen-rules.sh >> debian/rules
|
||||
# Conffiles under etc/ are detected automatically by
|
||||
# debhelper (compat 13+); no separate conffiles step needed.
|
||||
#
|
||||
# For each module it emits, in order:
|
||||
# 1. files/files.list -> install each mapped file at its destination.
|
||||
# Format: <source> <destination> [permission]
|
||||
# (permission defaults to 644; source is relative to
|
||||
# the module's files/ directory).
|
||||
# 2. patches/* -> every file under patches/ recursively, including
|
||||
# patches.list and hook scripts. Shell scripts (.sh)
|
||||
# get mode 755, everything else 644. Installed under
|
||||
# usr/lib/pve-mod/patches/<mod>/<relative-path>.
|
||||
# 3. <mod>.conf -> if present in the module root, installed as a
|
||||
# conffile at etc/pve-mod/conf.d/<mod>.conf (644) plus
|
||||
# a reference copy at
|
||||
# usr/share/pve-mod/conf.d/<mod>.conf.default (644).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Resolve repository root from this script's location so paths are stable
|
||||
# regardless of the caller's working directory.
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
SRC_DIR="$REPO_ROOT/src"
|
||||
PKG_DIR="debian/pve-mod"
|
||||
|
||||
# Print the list of module directory names (basenames), sorted, that contain a
|
||||
# files/ or patches/ subdirectory.
|
||||
list_modules() {
|
||||
local d name
|
||||
for d in "$SRC_DIR"/*/; do
|
||||
[[ -d "$d" ]] || continue
|
||||
name="$(basename "$d")"
|
||||
if [[ -d "$d/files" || -d "$d/patches" ]]; then
|
||||
echo "$name"
|
||||
fi
|
||||
done | sort
|
||||
}
|
||||
|
||||
# Emit a single tab-indented `install -D` line.
|
||||
# Args: <mode> <relative-source> <relative-destination>
|
||||
emit_install() {
|
||||
printf '\tinstall -Dm%s %s %s/%s\n' "$1" "$2" "$PKG_DIR" "$3"
|
||||
}
|
||||
|
||||
emit_install_rules() {
|
||||
local mod="$1"
|
||||
local mod_dir="$SRC_DIR/$mod"
|
||||
local rel_mod="src/$mod"
|
||||
|
||||
# 1. Mapped files from files/files.list.
|
||||
local manifest="$mod_dir/files/files.list"
|
||||
if [[ -f "$manifest" ]]; then
|
||||
local src dest perm
|
||||
while read -r src dest perm; do
|
||||
# Tolerate CRLF line endings.
|
||||
src="${src%$'\r'}"; dest="${dest%$'\r'}"; perm="${perm%$'\r'}"
|
||||
# Skip comments and blank lines.
|
||||
[[ -z "${src:-}" || "$src" == \#* ]] && continue
|
||||
perm="${perm:-644}"
|
||||
emit_install "$perm" "$rel_mod/files/$src" "$dest"
|
||||
done < "$manifest"
|
||||
fi
|
||||
|
||||
# 2. Everything under patches/ (recursive): .sh -> 755, else 644.
|
||||
local patches_dir="$mod_dir/patches"
|
||||
if [[ -d "$patches_dir" ]]; then
|
||||
local f rel perm
|
||||
while IFS= read -r f; do
|
||||
rel="${f#"$patches_dir"/}"
|
||||
if [[ "$rel" == *.sh ]]; then
|
||||
perm=755
|
||||
else
|
||||
perm=644
|
||||
fi
|
||||
emit_install "$perm" "$rel_mod/patches/$rel" "usr/lib/pve-mod/patches/$mod/$rel"
|
||||
done < <(find "$patches_dir" -type f | sort)
|
||||
fi
|
||||
|
||||
# 3. Per-module config: conffile + reference default copy.
|
||||
local conf="$mod_dir/$mod.conf"
|
||||
if [[ -f "$conf" ]]; then
|
||||
emit_install 644 "$rel_mod/$mod.conf" "etc/pve-mod/conf.d/$mod.conf"
|
||||
emit_install 644 "$rel_mod/$mod.conf" "usr/share/pve-mod/conf.d/$mod.conf.default"
|
||||
fi
|
||||
|
||||
# 4. Per-module configure script.
|
||||
local configure_script="$mod_dir/$mod.configure.sh"
|
||||
if [[ -f "$configure_script" ]]; then
|
||||
emit_install 755 "$rel_mod/$mod.configure.sh" "usr/lib/pve-mod/configure.d/$mod.sh"
|
||||
fi
|
||||
}
|
||||
|
||||
for mod in $(list_modules); do
|
||||
emit_install_rules "$mod"
|
||||
done
|
||||
@@ -4,7 +4,7 @@
|
||||
# source - path relative to this files/ directory
|
||||
# destination - path relative to the package root (no leading slash)
|
||||
# permission - octal mode, optional (defaults to 644)
|
||||
# Read by src/gen-rules.sh to generate the per-module debian install rules.
|
||||
# Read by build/gen-rules.sh to generate the per-module debian install rules.
|
||||
#
|
||||
# The nag_screen mod ships no new files - it only patches existing Proxmox
|
||||
# files - so this manifest is intentionally empty.
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -4,7 +4,7 @@
|
||||
# source - path relative to this files/ directory
|
||||
# destination - path relative to the package root (no leading slash)
|
||||
# permission - octal mode, optional (defaults to 644)
|
||||
# Read by src/gen-rules.sh to generate the per-module debian install rules.
|
||||
# Read by build/gen-rules.sh to generate the per-module debian install rules.
|
||||
|
||||
# PVE API2 facade
|
||||
PveMod_SensorInfo.pm usr/share/perl5/PVE/API2/PVEMod_SensorInfo.pm
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# src/Scripts/test/test-mods.sh
|
||||
# src/scripts/test/test-patches.sh
|
||||
#
|
||||
# Exercises pve-mod's patch engine against the installed Proxmox files.
|
||||
#
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# src/Scripts/test/test-syntax.sh
|
||||
# src/scripts/test/test-syntax.sh
|
||||
#
|
||||
# Validates source syntax for all mod files without requiring a running system.
|
||||
#
|
||||
@@ -16,7 +16,7 @@
|
||||
set -u
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SRC_DIR="${PVE_MOD_SRC_DIR:-$(cd "$SCRIPT_DIR/../../.." && pwd)/src}"
|
||||
SRC_DIR="${PVE_MOD_SRC_DIR:-$(cd "$SCRIPT_DIR/../../.." && pwd)/src/modules}"
|
||||
|
||||
info() { echo "[syntax] $*"; }
|
||||
warn() { echo "[syntax] WARNING: $*" >&2; }
|
||||
Reference in new issue
Block a user