Commit Graph

28 Commits

Author SHA1 Message Date
MickLesk
27f256a20f Refactor VM script to use shared vm-core helpers
Introduce a shared vm-core loader and refactor the Ubuntu 26.04 VM script to use reusable helper functions. misc/vm-core.func: add COMMUNITY_SCRIPTS_URL default and load_api_functions to dynamically source API helpers, then call load_api_functions from load_functions. vm/ubuntu2604-vm.sh: switch to sourcing the shared vm-core via COMMUNITY_SCRIPTS_URL, replace many inline UI and utility functions with generic vm_* helpers (vm_confirm_new_vm, vm_prompt_*, vm_select_storage, vm_define_disk_references, set_description, etc.), modernize quoting and pushd usage, simplify disk import/resizing logic, and set START_VM default to yes. Also update repository URLs to ProxmoxVED and adjust some behavior (machine type handling, storage/disk references). Overall this centralizes common functionality, reduces duplication, and prepares scripts to use the shared core utilities.
2026-05-07 09:52:57 +02:00
MickLesk
2f5a5771b0 Add interactive VM prompts and error handling
Introduce interactive whiptail-based helpers and robust error handling for VM creation.

- Add error_handler() to report failures (calls post_update_to_api if available), print contextual error info, and call cleanup_vmid.
- Ensure TEMP_DIR is removed in cleanup().
- Replace brittle pve_check with version parsing that supports Proxmox VE 8.0–8.9 and 9.0–9.1 (exits with code 105 on unsupported versions).
- Add ssh_check() to warn users running the script over SSH.
- Add sanitize_vm_hostname() and a suite of vm_* helper functions to prompt and validate interactive settings via whiptail: vm_confirm_new_vm, vm_choose_settings_mode, vm_prompt_vmid, vm_prompt_machine_type, vm_apply_machine_type, vm_prompt_disk_size, vm_prompt_disk_cache, vm_prompt_hostname, vm_prompt_cpu_model, vm_prompt_cpu_cores, vm_prompt_ram, vm_prompt_bridge, vm_prompt_mac, vm_prompt_vlan, vm_prompt_mtu, vm_prompt_start_vm.
- Add storage helpers: vm_select_storage, vm_apply_storage_layout, vm_define_disk_references to detect storage pools, set formats/extensions and prepare disk refs.
- Use APP/NSAPP for description title by introducing local description_title in set_description().

These changes centralize validation and interactive flow, improve UX, and harden error reporting and cleanup.
2026-05-07 09:45:45 +02:00
CanbiZ (MickLesk)
7ab160ff75 gitea sync 2026-03-18 14:58:47 +01:00
CanbiZ (MickLesk)
aaaf18de91 switch urls back to github (due slow gitea syncs) 2026-03-18 14:47:29 +01:00
CanbiZ (MickLesk)
4e2b64524f merge vmcore 2026-02-24 09:41:40 +01:00
MickLesk
5ab302102b refactor: clean COMMUNITY_SCRIPTS_URL pattern (#1449)
- ct/vm scripts: split to 2-line pattern (variable + source)
- func files: remove redundant inline defaults
- Only entry points keep the default (ct/*.sh, vm/*.sh, build.func,
  install.func, alpine-install.func)
- Downstream sources use $COMMUNITY_SCRIPTS_URL without default
2026-02-22 14:43:08 +01:00
MickLesk
4b9121f41c feat: add configurable COMMUNITY_SCRIPTS_URL for dev sourcing (#1449)
- Replace all hardcoded source URLs with $COMMUNITY_SCRIPTS_URL variable
- Default: https://git.community-scripts.org/.../ProxmoxVED/raw/branch/main
- Override: export COMMUNITY_SCRIPTS_URL=https://.../your-fork/raw/branch/xyz
- Propagates into container via build.func exports
- Updated: 43 ct scripts, 14 deferred, 22 vm scripts, 5 func files
- Document in docs/DEV_MODE.md with usage examples
- Also normalizes legacy GitHub URLs to Gitea canonical URL
2026-02-22 14:36:31 +01:00
CanbiZ (MickLesk)
cc10993edb Update vm-core.func 2026-02-03 14:27:09 +01:00
CanbiZ (MickLesk)
b9cbfef0ca Improve logging, error handling, and messages
Add new icons and message helpers; introduce get_active_logfile and enhance silent() to redirect output to a proper log file (BUILD_LOG or /tmp fallback), preserve/propagate exit codes, temporarily disable traps while running commands, source explain_exit_code for human-friendly error explanations, and show the last 10 log lines on failure. Also sanitize keys when unsetting MSG_INFO_SHOWN to avoid ANSI/control-char issues, add msg_warn and fatal helpers, and make msg_custom skip empty messages. These changes improve observability and robustness of VM creation scripts and error reporting.
2026-02-03 14:18:57 +01:00
CanbiZ (MickLesk)
49318cc629 remove ssh check 2026-02-03 14:11:38 +01:00
Tobias
c5786b9210 happ new year - well a bit late :D 2026-01-06 12:36:02 +01:00
CanbiZ
b7430c20fe Update remaining pve_check functions to support Proxmox 9.0 and 9.1 2025-11-19 16:42:59 +01:00
CanbiZ
3d8ac42015 - 2025-05-26 14:05:11 +02:00
CanbiZ
04d2cdc14c - 2025-05-26 14:03:36 +02:00
CanbiZ
cb7ce3f27e verb 2025-05-26 13:58:02 +02:00
CanbiZ
6e53e130b1 Update vm-core.func 2025-05-26 13:47:47 +02:00
CanbiZ
13b6ac8dba fuixes 2025-05-26 13:43:36 +02:00
CanbiZ
5cf528254a Update vm-core.func 2025-05-26 13:35:56 +02:00
CanbiZ
6fb306d8b1 debug 2025-05-26 13:27:40 +02:00
CanbiZ
8fec027678 Update vm-core.func 2025-05-26 13:19:32 +02:00
CanbiZ
33f950071b Update vm-core.func 2025-05-26 13:08:08 +02:00
CanbiZ
ecfdfc6c6f fixes 2025-05-26 13:04:02 +02:00
CanbiZ
aab52e30a2 test 2025-05-26 12:57:39 +02:00
Michel Roegl-Brunner
f99c48d760 Change all links to gite (#343) 2025-05-14 10:17:40 +02:00
CanbiZ
0c98ecdc9d cc 2025-05-08 14:44:04 +02:00
CanbiZ
89111b2e6b Update vm-core.func 2025-05-08 14:34:55 +02:00
CanbiZ
a7ef32b29d fixxess 2025-05-08 14:06:17 +02:00
CanbiZ
12796db067 test new vm-core.sh 2025-05-08 13:33:31 +02:00