Add update-vendor.sh symlink support, unify install.sh vendor flow
- update-vendor.sh now creates webui/vendor symlinks (htm.js) - install.sh calls update-vendor.sh after package install - Add vendor/.empty and webui/vendor/.empty as directory placeholders in git
This commit is contained in:
@@ -4,6 +4,7 @@ Provides common helpers for JSON persistence, subprocess execution,
|
||||
deep merging, and directory creation used across all subsystem modules.
|
||||
"""
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@@ -12,6 +13,21 @@ from copy import deepcopy
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
_APPLY_HASH_KEY = "_last_applied_hash"
|
||||
|
||||
|
||||
def config_hash(cfg: dict[str, Any]) -> str:
|
||||
"""Compute a SHA-256 hash of *cfg* excluding the ``_last_applied_hash`` key.
|
||||
|
||||
Args:
|
||||
cfg: Config dict, possibly containing ``_last_applied_hash``.
|
||||
|
||||
Returns:
|
||||
Hex digest of the stripped config JSON.
|
||||
"""
|
||||
clean = {k: v for k, v in cfg.items() if k != _APPLY_HASH_KEY}
|
||||
return hashlib.sha256(json.dumps(clean, sort_keys=True).encode()).hexdigest()
|
||||
|
||||
|
||||
def validate_interface_name(name: str) -> str:
|
||||
"""Validate a Linux network interface name.
|
||||
@@ -154,6 +170,8 @@ def ensure_dirs(*dirs: Path) -> None:
|
||||
|
||||
|
||||
__all__ = [
|
||||
"_APPLY_HASH_KEY",
|
||||
"config_hash",
|
||||
"deep_merge",
|
||||
"ensure_dirs",
|
||||
"load_json",
|
||||
|
||||
Reference in New Issue
Block a user