[PR #5705] [MERGED] Core layer refactor: centralized error traps and msg_* consistency #5691

Closed
opened 2026-02-26 14:34:57 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/5705
Author: @MickLesk
Created: 7/4/2025
Status: Merged
Merged: 7/4/2025
Merged by: @michelroegl-brunner

Base: mainHead: core_stable


📝 Commits (1)

  • 03e7a00 Core layer refactor: centralized error traps and msg_* consistency

📊 Changes

6 files changed (+371 additions, -380 deletions)

View changed files

📝 misc/alpine-install.func (+0 -5)
📝 misc/build.func (+99 -33)
📝 misc/core.func (+122 -274)
📝 misc/create_lxc.sh (+136 -56)
📝 misc/install.func (+9 -9)
📝 misc/tools.func (+5 -3)

📄 Description

🔧 Change Summary for Branch core_stable

This summarizes the changes made across 6 key files in your working directory.

#5540
#5651
#5637
#5684
#5653


misc/alpine-install.func

  • Removed: Installation block for core dependencies (newt, curl, openssh, nano, mc, ncurses, gpg) from update_os().
  • Reason: Clear separation between OS upgrade and package installation logic.

misc/build.func

  • echo_default()
    • Reordered output lines: Container ID moved up.
    • Operating system version now displayed inline: e.g., Debian (12).
  • build_container()
    • Explicit string initialization for LXC_CONFIG.
    • New block for USB passthrough for privileged containers (CT_TYPE == "0"), adding:
      lxc.cgroup2.devices.allow: a
      lxc.cap.drop:
      lxc.cgroup2.devices.allow: c 188:* rwm
      lxc.cgroup2.devices.allow: c 189:* rwm
      lxc.mount.entry: /dev/serial/by-id ...
      
    • Added VAAPI detection (card0, renderD128, fb0).
    • Integrated msg_custom for stylized output.
    • Conditional prompts for VAAPI passthrough.

misc/core.func

  • Major refactoring:
    • Removed legacy MOTD, IPv6, and SSH configuration functions.
    • Centralized configuration adjustments.
  • New helper functions:
    • is_verbose_mode(), is_alpine(), for environment detection.

misc/create_lxc.sh

  • Heavy overhaul:
    • Introduced LOCKFD + flock to lock template access during pct create.
    • Validates template size before container creation retry.
    • Enhanced error output if pct create fails.
  • Integrated:
    • is_verbose_mode, catch_errors, and spinner/message improvements.
    • VAAPI passthrough and USB logic, synced with build.func.

misc/install.func

  • Minor changes:
    • Unified logging via msg_info and msg_ok.
    • Removed redundant installation logic.

misc/tools.func

  • msg_custom() improvements:
    • Standardized ANSI color handling.
    • Ensured clean newlines and spinner stops before output.
  • Minor syntax cleanup.

🧾 Summary Table

File Highlights
alpine-install.func Cleanup, removed redundant installation block
build.func USB + VAAPI handling, cleaner info display
core.func Refactored detection, centralized diagnostics
create_lxc.sh Safe locking, template validation, VAAPI logic
install.func Logging cleanup, small logic corrections
tools.func Improved custom message formatting

Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE/pull/5705 **Author:** [@MickLesk](https://github.com/MickLesk) **Created:** 7/4/2025 **Status:** ✅ Merged **Merged:** 7/4/2025 **Merged by:** [@michelroegl-brunner](https://github.com/michelroegl-brunner) **Base:** `main` ← **Head:** `core_stable` --- ### 📝 Commits (1) - [`03e7a00`](https://github.com/community-scripts/ProxmoxVE/commit/03e7a00eb691bc7c4982d0064d458f94ed94ce2a) Core layer refactor: centralized error traps and msg_* consistency ### 📊 Changes **6 files changed** (+371 additions, -380 deletions) <details> <summary>View changed files</summary> 📝 `misc/alpine-install.func` (+0 -5) 📝 `misc/build.func` (+99 -33) 📝 `misc/core.func` (+122 -274) 📝 `misc/create_lxc.sh` (+136 -56) 📝 `misc/install.func` (+9 -9) 📝 `misc/tools.func` (+5 -3) </details> ### 📄 Description # 🔧 Change Summary for Branch `core_stable` This summarizes the changes made across 6 key files in your working directory. #5540 #5651 #5637 #5684 #5653 --- ## `misc/alpine-install.func` - **Removed**: Installation block for core dependencies (`newt`, `curl`, `openssh`, `nano`, `mc`, `ncurses`, `gpg`) from `update_os()`. - **Reason**: Clear separation between OS upgrade and package installation logic. --- ## `misc/build.func` - **`echo_default()`** - Reordered output lines: `Container ID` moved up. - Operating system version now displayed inline: e.g., `Debian (12)`. - **`build_container()`** - Explicit string initialization for `LXC_CONFIG`. - **New block** for USB passthrough for privileged containers (`CT_TYPE == "0"`), adding: ```bash lxc.cgroup2.devices.allow: a lxc.cap.drop: lxc.cgroup2.devices.allow: c 188:* rwm lxc.cgroup2.devices.allow: c 189:* rwm lxc.mount.entry: /dev/serial/by-id ... ``` - Added VAAPI detection (`card0`, `renderD128`, `fb0`). - Integrated `msg_custom` for stylized output. - Conditional prompts for VAAPI passthrough. --- ## `misc/core.func` - **Major refactoring**: - Removed legacy MOTD, IPv6, and SSH configuration functions. - Centralized configuration adjustments. - **New helper functions**: - `is_verbose_mode()`, `is_alpine()`, for environment detection. --- ## `misc/create_lxc.sh` - **Heavy overhaul**: - Introduced `LOCKFD` + `flock` to lock template access during `pct create`. - Validates template size before container creation retry. - Enhanced error output if `pct create` fails. - Integrated: - `is_verbose_mode`, `catch_errors`, and spinner/message improvements. - VAAPI passthrough and USB logic, synced with `build.func`. --- ## `misc/install.func` - **Minor changes**: - Unified logging via `msg_info` and `msg_ok`. - Removed redundant installation logic. --- ## `misc/tools.func` - **`msg_custom()` improvements**: - Standardized ANSI color handling. - Ensured clean newlines and spinner stops before output. - Minor syntax cleanup. --- ## 🧾 Summary Table | File | Highlights | |-----------------------|--------------------------------------------------| | `alpine-install.func` | Cleanup, removed redundant installation block | | `build.func` | USB + VAAPI handling, cleaner info display | | `core.func` | Refactored detection, centralized diagnostics | | `create_lxc.sh` | Safe locking, template validation, VAAPI logic | | `install.func` | Logging cleanup, small logic corrections | | `tools.func` | Improved custom message formatting | ## ✅ Prerequisites (**X** in brackets) - [x] **Self-review completed** – Code follows project standards. - [x] **Tested thoroughly** – Changes work as expected. - [x] **No security risks** – No hardcoded secrets, unnecessary privilege escalations, or permission issues. --- ## 🛠️ Type of Change (**X** in brackets) - [ ] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [ ] ✨ **New feature** – Adds new, non-breaking functionality. - [ ] 💥 **Breaking change** – Alters existing functionality in a way that may require updates. - [ ] 🆕 **New script** – A fully functional and tested script or script set. - [ ] 🌍 **Website update** – Changes to website-related JSON files or metadata. - [x] 🔧 **Refactoring / Code Cleanup** – Improves readability or maintainability without changing functionality. - [ ] 📝 **Documentation update** – Changes to `README`, `AppName.md`, `CONTRIBUTING.md`, or other docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 14:34:57 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE#5691
No description provided.