Commit Graph

397 Commits

Author SHA1 Message Date
Sam Heinz
88a6b07334 fix for copilot detected bugs 2026-05-13 00:57:11 +10:00
Sam Heinz
39c514a1e3 Merge branch 'main' into arm64-build-support 2026-05-12 15:54:18 +10:00
Sam Heinz
5f6a02986d add arm64_notice function 2026-05-12 15:38:38 +10:00
Sam Heinz
079afa4600 add ensure_whiptail function
This is required as some arm64 systems will not have whiptail installed, as it is not installed by default.
2026-05-12 15:30:31 +10:00
Sam Heinz
0aeaa5ae97 fix template name handling change 2026-05-12 15:24:21 +10:00
Sam Heinz
9f7b951ec6 Redo template name handling 2026-05-12 15:12:59 +10:00
Sam Heinz
314b1b843b Reapply "remove arm64 overlay"
This reverts commit 866b6950c0.
2026-05-12 14:16:04 +10:00
Sam Heinz
73e121b679 Reapply "Improve arm64 support and arch-specific downloads"
This reapplies commit 7c051fb648.
2026-05-12 14:16:02 +10:00
CanbiZ (MickLesk)
ebaa526560 core: support optional POST_INSTALL_SCRIPT (var_post_install_script) hook (#14160) 2026-05-11 15:54:38 +02:00
CanbiZ (MickLesk)
3c02868add update-apps: some improvements (#14275)
* feat(update-apps): add var_continue_on_error and TERM=dumb fix

- Add var_continue_on_error=yes to skip failed containers instead
  of aborting all remaining updates. Useful for cron/unattended runs
  where one disabled or broken script should not stop others.
  Containers with backup still attempt restore on failure regardless.

- Set TERM=dumb when running pct exec to prevent whiptail from
  hanging when no TTY is available (e.g. cron jobs redirecting
  stdout/stderr). This causes whiptail to fail-fast instead of
  blocking indefinitely.

- Add var_continue_on_error to export_config_json, --help output,
  and usage examples (cron-style invocation example added).

* feat(update-apps): add var_dry_run to check updates without applying

Adds dry-run mode (var_dry_run=yes) that reports available updates for
all selected containers without modifying anything:

- Extracts GitHub source repo from the ct script header (# Source:)
- Resolves the version file name from check_for_gh_release app arg
- Reads current installed version from ~/.appname inside the container
- Queries GitHub API /releases/latest for comparison
- Outputs color-coded status: up-to-date (green), update available (yellow),
  or unknown (blue/yellow with reason)

Non-GitHub sources (Codeberg, custom URLs) are skipped with a notice.
Resource scaling is suppressed entirely during dry-run.

Example usage:
  var_container=all_running var_skip_confirm=yes var_dry_run=yes \
    bash -c "$(curl -fsSL .../update-apps.sh)"

* fix(update-apps): dry-run uses check_for_gh_release args, not Source header

The # Source: header can point to a different repo than what
check_for_gh_release actually queries (e.g. RustDesk uses
lejianwen fork, not official rustdesk repo).

Now parse both app name and source repo directly from the
check_for_gh_release call in the ct script:
  check_for_gh_release "appname" "owner/repo"

Also fix $HOME/.appname path expansion in pct exec context.

* fix issue on clear()

* feat(update-apps): add no-op clear wrapper to PATH for update scripts

Co-authored-by: Copilot <copilot@github.com>

* feat(update-apps): enhance error handling for unattended mode in resource checks

Co-authored-by: Copilot <copilot@github.com>

* feat(update-apps): implement structured logging and summary report for updates

Co-authored-by: Copilot <copilot@github.com>

* fix log issue

Co-authored-by: Copilot <copilot@github.com>

* feat(update-apps): enhance dry-run functionality and logging for container updates

Co-authored-by: Copilot <copilot@github.com>

* feat(update-apps): add dry-run completion message for better user feedback

Co-authored-by: Copilot <copilot@github.com>

---------

Co-authored-by: Copilot <copilot@github.com>
2026-05-07 15:53:22 +02:00
Michael Oultram
37eafa199d core: fix validate_bridge function (#14206) 2026-05-03 22:35:53 +02:00
CanbiZ (MickLesk)
9578c6fa91 core: prompt to also run installed addon update scripts (…/bin/update_*) after update_script (#14162) 2026-05-02 12:06:16 +02:00
CanbiZ (MickLesk)
e9ae1bfde1 Add guidance when storage lacks rootdir support (#14108) 2026-04-29 22:28:08 +02:00
Mike
88397b48dc Update build.func - fixed spelling mistake (#14047) 2026-04-27 09:00:29 +02:00
CanbiZ (MickLesk)
3c38647055 core: improve system update information / lxc stack upgrade (#13970)
* fix(lxc-stack): use dist-upgrade and improve recovery prompt

When the host LXC stack is too old for a template, upgrading only
pve-container/lxc-pve can leave the Proxmox stack in an inconsistent state.
Use a full dist-upgrade instead.

Also refine the recovery prompt:
- [1] Upgrade LXC stack now
- [2] Older template fallback only when actually available
- [3] Ignore
- [4] Cancel

Do not auto-fallback to an older template after ignore/failure; honor the
user's explicit choice and stop with a clear error instead.

* chore(lxc-stack-prompt): clarify host dist-upgrade action in option 1

* Update build.func

* fix(lxc-stack): use host upgrade instead of dist-upgrade in recovery flow

* Enhance upgrade prompt with warning message

Added a warning message to inform users about the implications of running the host upgrade.

---------

Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
2026-04-23 20:52:59 +02:00
CanbiZ (MickLesk)
8706cd3783 Revert "core: Add PHS_VERBOSE env var to skip verbose mode prompts (#13797)" (#13963)
This reverts commit 518b6778e2.
2026-04-23 15:30:38 +02:00
CanbiZ (MickLesk)
874d8f300c Revert "Prefer silent mode on PHS env conflict (#13951)" (#13962)
This reverts commit a37b36520c.
2026-04-23 15:30:19 +02:00
CanbiZ (MickLesk)
a37b36520c Prefer silent mode on PHS env conflict (#13951)
When PHS_SILENT and PHS_VERBOSE are both set, stop falling back to interactive mode. Changes prefer silent mode to keep automation safe and avoid blocking unattended/non-TTY updates. Only show a whiptail warning when both stdin/stdout are TTYs and whiptail is present, and ignore any whiptail errors. Added a brief comment and adjusted the fallback message accordingly.
2026-04-23 09:33:40 +02:00
John Gorman
518b6778e2 core: Add PHS_VERBOSE env var to skip verbose mode prompts (#13797) 2026-04-22 14:47:44 +02:00
CanbiZ (MickLesk)
0986f485ee core: detect Perl breakage after LXC stack upgrade and improve storage validation (#13879) 2026-04-20 20:22:10 +02:00
CanbiZ (MickLesk)
453f73abcf core: fix some pct create issues (telemetry) + cleanup (#13810)
* fix(build.func): pct create audit — 5 fixes

1. Disable globbing (set -f) around pct create calls to prevent
   passwords containing * or ? from expanding to filenames.

2. Fix TAGS: use semicolons (pct format), prevent duplicate
   community-script prefix, remove trailing separator.

3. Skip keyctl dialog for unprivileged containers — pct always
   forces keyctl=1 for CT_TYPE=1, so the dialog was misleading.

4. Remove dead IPV6_STATIC variable (IPv6 is handled via
   IPV6_ADDR/IPV6_GATE which are properly wired into NET_STRING).

5. Remove dead UDHCPC_FIX variable — set and exported but never
   consumed by any install script.

* Update api.func
2026-04-17 15:19:52 +02:00
CanbiZ (MickLesk)
a5fc040deb fix(build): sanitize mount_fs input — strip spaces and trailing commas (#13806)
User input like 'nfs, cifs' or 'nfs,' would produce invalid pct
features strings like 'mount=nfs; cifs' (space breaks pct argument
parsing) or 'mount=nfs;' (trailing semicolon). Fixes:

- Whiptail dialog (Step 27): normalize input immediately after entry
- load_vars_file validation: normalize before regex check, use
  stricter regex that rejects trailing/leading commas
- FEATURES construction: defensive sanitize before building the
  mount= value (strip spaces, trailing commas/semicolons)

All three layers ensure 'nfs, cifs' -> 'nfs,cifs' -> 'mount=nfs;cifs'
2026-04-17 13:04:52 +02:00
CanbiZ (MickLesk)
4e89480e8c core: wire ENABLE_MKNOD and ALLOW_MOUNT_FS into LXC features (#13796) 2026-04-16 22:23:15 +02:00
CanbiZ (MickLesk)
e55fe43e2d core: remove unused TEMP_DIR mktemp leak in build_container / clean sonarqube (#13708)
* fix(core): remove unused TEMP_DIR mktemp leak in build_container

The build_container() function created a temp directory via mktemp -d and
pushd into it, but never popd or rm -rf. The directory was not used for
anything — FUNCTIONS_FILE_PATH is downloaded into a variable, not a file.

Remove the mktemp -d and pushd entirely to eliminate the leak.

* fix(sonarqube): clean up temp file after zip extraction

The SonarQube update function (ct/sonarqube.sh) never deleted the
downloaded zip file (~200-500 MB) from /tmp after extraction. On LXC
containers with 4-8 GB disks, this accumulates with every update and
can eventually fill the disk.

Also add explicit cleanup in the install script instead of relying
solely on cleanup_lxc() pattern matching.
2026-04-13 15:59:42 +02:00
CanbiZ (MickLesk)
9a82ec48b2 tools.func: prevent script crash when entering GitHub token after rate limit (#13638)
* fix(tools): prevent script crash when entering GitHub token after rate limit

fetch_and_deploy_gh_release set attempt=0 after accepting a token, then
immediately ran ((0++)) which evaluates to 0 (falsy) causing exit code 1
and killing the script under set -e.

Fix: set attempt=1 and continue to restart the retry loop cleanly,
giving the full max_retries budget with the new token.

Also fix fetch_and_deploy_codeberg_release: replace ((attempt++)) with
attempt=\ to avoid the same zero-evaluation crash on
the first connection timeout (attempt starts at 0 in that loop).

Fixes #13635

* feat(tools): add var_github_token support with token validation

- Add var_github_token to all VAR_WHITELIST arrays in build.func so the
  token can be set via default.vars, app.vars, or environment variable
- Map var_github_token -> GITHUB_TOKEN in default_var_settings() (env
  variable takes precedence over the var file value)
- Add commented var_github_token example to the default.vars template
- Add validate_github_token() to tools.func:
    * Calls GET /user to verify the token is accepted
    * Reports expiry date from x-oauth-expiry header (fine-grained PATs)
    * Warns when classic PAT is missing public_repo scope
    * Returns distinct exit codes: 0=valid, 1=invalid/expired, 2=no scope, 3=error
- Update prompt_for_github_token():
    * Non-interactive path now picks up var_github_token automatically
    * Interactive path also picks up var_github_token without prompting
    * Validates token immediately after entry; loops until valid or Ctrl+C
2026-04-10 11:28:52 +02:00
CanbiZ (MickLesk)
68b486be92 Add donate & script page badges to descriptions (#13596)
Update LXC and VM description blocks to include donation and script page badges. Introduces script_slug, script_url and donate_url variables (derived from SCRIPT_SLUG or NSAPP/APP, normalized to lowercase and dashed) and uses them to build links. Replaces the old Ko-fi "Buy us a coffee" badge with a generic donate badge and adds an "Open Script Page" badge linking to the script detail page.
2026-04-08 21:40:52 +02:00
CanbiZ (MickLesk)
ac3cf75b11 core: improve resilience for top Proxmox error codes (209, 215, 118, 206) (#13575) 2026-04-07 23:10:37 +02:00
CanbiZ (MickLesk)
730176268e APT Proxy: Support full URLs (http/https with custom ports) (#13474)
* APT Proxy: Support full URLs (http/https with custom ports)

* APT Proxy: Add URL validation and update default.vars examples
2026-04-03 21:17:07 +02:00
CanbiZ (MickLesk)
8275531161 fix(build): skip empty gateway value in network config (#13442)
When var_gateway is set to an empty string, the resulting gw= token
in the comma-separated network string causes pct create to fail with
a 'missing key in comma-separated list property' error.

Closes #13421
2026-03-31 23:57:25 +02:00
CanbiZ (MickLesk)
d4e20816c7 core: APT/APK Mirror Fallback for CDN Failures (#13316) 2026-03-26 16:53:04 +01:00
CanbiZ (MickLesk)
fbe5b57c76 core/tools: replace generic return 1 exit_codes with more specific exit_codes (#13311) 2026-03-26 16:07:38 +01:00
CanbiZ (MickLesk)
42fbf1afc5 core: use /usr/bin/install to prevent function shadowing (#13299) 2026-03-26 10:11:47 +01:00
CanbiZ (MickLesk)
97bf744e96 fix typo (org instead of com) 2026-03-25 17:48:03 +01:00
CanbiZ (MickLesk)
53bc492fdb Make shell command substitutions safe with || true (#13279)
Add defensive fallbacks (|| true) to multiple command substitutions to prevent non-zero exits when commands produce no output or are unavailable. Changes touch misc/api.func, misc/build.func and misc/tools.func and cover places like lspci, /proc/cpuinfo parsing, /etc/os-release reads, hostname -I usage, grep reads from vars files and maps, pct config parsing, storage/template lookups, tool version detection, NVIDIA driver version extraction, and MeiliSearch config parsing. These edits do not change functional behavior aside from ensuring the scripts continue running (variables will be empty) instead of failing in stricter shells or when commands return non-zero status.
2026-03-25 13:06:21 +01:00
CanbiZ (MickLesk)
caf03fe274 chore: replace helper-scripts.com with community-scripts.com (#13244) 2026-03-24 20:50:40 +01:00
CanbiZ (MickLesk)
86c658909a Classify exit-1 errors & guard telemetry
Analyze logs for generic exit code 1 and export an ERROR_CATEGORY_OVERRIDE so telemetry receives a more accurate error category (apt, oom, network, storage, dependency). Preserve any existing TELEMETRY_TYPE when posting updates. Add defense-in-depth by disabling strict error traps before running grep/sed log analysis to avoid spurious error_handler invocations. Mark successful installs with INSTALL_COMPLETE and update the error handler to only report a successful "done" telemetry state when INSTALL_COMPLETE is explicitly set, preventing false-positive success reports from early zero-exit exits.
2026-03-24 09:57:43 +01:00
CanbiZ (MickLesk)
c8606e9fcc core: harden shell scripts against injection and insecure permissions (#13239) 2026-03-23 22:22:23 +01:00
CanbiZ (MickLesk)
f29606ae87 fix(build): allow /31 and /32 CIDR with out-of-subnet gateway (#13231) 2026-03-23 20:41:55 +01:00
CanbiZ (MickLesk)
791981ba68 qf msg_warn lxc stack update 2026-03-23 14:44:24 +01:00
CanbiZ (MickLesk)
2922ecdcbb core: guard against empty IPv6 address in static mode (#13195) 2026-03-22 22:48:19 +01:00
CanbiZ (MickLesk)
55324dbb98 core: add missing -searchdomain/-nameserver prefix in base_settings (#13166) 2026-03-21 21:13:15 +01:00
CanbiZ (MickLesk)
3601388abe core: add mode=generated for unattended frontend installs (#12807) 2026-03-12 12:21:28 +01:00
CanbiZ (MickLesk)
dd3b381813 core: validate storage availability when loading defaults (#12794) 2026-03-12 09:17:18 +01:00
Sam Heinz
24f1347990 Revert changes from "Improve arm64 support and arch-specific downloads" 2026-03-12 16:45:00 +10:00
Sam Heinz
866b6950c0 Revert "remove arm64 overlay"
This reverts commit 231945dfa7.
2026-03-12 16:42:41 +10:00
CanbiZ (MickLesk)
44ec223d20 update ifupdown2 source 2026-03-11 14:37:43 +01:00
CanbiZ (MickLesk)
4ab3a24d03 Merge branch 'main' into arm64-build-support 2026-03-11 14:27:14 +01:00
CanbiZ (MickLesk)
231945dfa7 remove arm64 overlay 2026-03-11 14:26:03 +01:00
CanbiZ (MickLesk)
7c051fb648 Improve arm64 support and arch-specific downloads
Add clearer architecture error messages and gate arm64 usage, plus implement architecture-aware behavior across the toolkit. Changes include: update exit-code messages to reference amd64/arm64, refuse arm64 unless explicitly enabled, show architecture in summaries, and use arch-specific package lists when installing in containers. Make downloads for FFmpeg and yq choose the correct amd64/arm64 binaries, tighten template download error handling and formatting, and clean up minor whitespace/comment issues. These changes aim to make arm64 handling explicit and downloads/installations more robust for non-amd64 systems.
2026-03-11 14:23:56 +01:00
Sam Heinz
6f8aa6eadc build.func: remove arm64 support for focal, bullseye
Legacy support removed since no cts use them anymore.
2026-03-11 21:17:38 +10:00