[PR #1251] [MERGED] [overrideable url] Initial changes to ct scripts to use environment variable #2911

Closed
opened 2025-11-20 05:32:29 -05:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/1251
Author: @cricalix
Created: 1/5/2025
Status: Merged
Merged: 1/9/2025
Merged by: @MickLesk

Base: dev_overrideable_urlHead: initial-ct-changes


📝 Commits (2)

  • d661b27 Redo: Change from wget to curl when fetching create_lxc.sh
  • 4ca6da2 Redo: [overrideable url] Initial changes to ct scripts to use environment variable

📊 Changes

15 files changed (+29 additions, -15 deletions)

View changed files

📝 ct/2fauth.sh (+2 -1)
📝 ct/5etools.sh (+2 -1)
📝 ct/actualbudget.sh (+2 -1)
📝 ct/adguard.sh (+2 -1)
📝 ct/adventurelog.sh (+2 -1)
📝 ct/agentdvr.sh (+2 -1)
📝 ct/alpine-docker.sh (+2 -1)
📝 ct/alpine-grafana.sh (+2 -1)
📝 ct/alpine-nextcloud.sh (+2 -1)
📝 ct/alpine-vaultwarden.sh (+2 -1)
📝 ct/alpine-zigbee2mqtt.sh (+2 -1)
📝 ct/alpine.sh (+2 -1)
📝 ct/debian.sh (+2 -1)
📝 ct/ubuntu.sh (+2 -1)
📝 misc/build.func (+1 -1)

📄 Description

🛠️ Note:
We are meticulous about merging code into the main branch, so please understand that pull requests not meeting the project's standards may be rejected. It's never personal!
🎮 Note for game-related scripts: These have a lower likelihood of being merged.


✍️ Description

In https://github.com/community-scripts/ProxmoxVE/discussions/1202, I proposed that a new environment variable could be used to change the URL that the scripts fetch data from, enabling easy testing against custom repositories (or even local disk) without having to edit the files every time. In https://github.com/community-scripts/ProxmoxVE/pull/1230, the request was made to split the PR into smaller PRs.

This PR implements the initial changes to a subset of ct/* app scripts, moving the root of the hard-coded URL to a variable that allows the environment to override it, and then changes the source command to use that variable as the base of the URL to fetch.

This PR is essentially a codemod done with rg -sl 'curl -s' | xargs sed -i -e '/ProxmoxVE/develop/misc/ i: "${CSCRIPTS_BASE_URL:=https://raw.githubusercontent.com/community-scripts/ProxmoxVE/develop}"' -e 's%https://raw.githubusercontent.com/community-scripts/ProxmoxVE/develop/misc/build.func%"${CSCRIPTS_BASE_URL}/misc/build.func"%'

The defaulting of the vault to the existing base URL means that there will be no impact on existing source calls; setting the variable will change where build.func is sourced from, but will not affect where the $var_install.sh script is loaded from.



🛠️ Type of Change

Please check the relevant options:

  • Bug fix (non-breaking change that resolves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change unexpectedly)
  • New script (a fully functional and thoroughly tested script or set of scripts)

Prerequisites

The following steps must be completed for the pull request to be considered:

  • Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.)
  • Testing performed (I have thoroughly tested my changes and verified expected functionality.)
  • Documentation updated (I have updated any relevant documentation)

📋 Additional Information (optional)

The second run of the script sets the URL to point to my local checkout on the pve node.

  • git checkout initial-ct-changes
  • bash ct/alpine.sh
  • pct stop 105 && pct destroy 105
  • CSCRIPTS_BASE_URL=file:///root/t/ProxmoxVE bash ct/alpine.sh

In both cases:
image


🔄 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/1251 **Author:** [@cricalix](https://github.com/cricalix) **Created:** 1/5/2025 **Status:** ✅ Merged **Merged:** 1/9/2025 **Merged by:** [@MickLesk](https://github.com/MickLesk) **Base:** `dev_overrideable_url` ← **Head:** `initial-ct-changes` --- ### 📝 Commits (2) - [`d661b27`](https://github.com/community-scripts/ProxmoxVE/commit/d661b27ee3e14b71140dc7bc38635905b9df4148) Redo: Change from wget to curl when fetching create_lxc.sh - [`4ca6da2`](https://github.com/community-scripts/ProxmoxVE/commit/4ca6da2e5c16213d155fa2ad77848dcd91495216) Redo: [overrideable url] Initial changes to ct scripts to use environment variable ### 📊 Changes **15 files changed** (+29 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `ct/2fauth.sh` (+2 -1) 📝 `ct/5etools.sh` (+2 -1) 📝 `ct/actualbudget.sh` (+2 -1) 📝 `ct/adguard.sh` (+2 -1) 📝 `ct/adventurelog.sh` (+2 -1) 📝 `ct/agentdvr.sh` (+2 -1) 📝 `ct/alpine-docker.sh` (+2 -1) 📝 `ct/alpine-grafana.sh` (+2 -1) 📝 `ct/alpine-nextcloud.sh` (+2 -1) 📝 `ct/alpine-vaultwarden.sh` (+2 -1) 📝 `ct/alpine-zigbee2mqtt.sh` (+2 -1) 📝 `ct/alpine.sh` (+2 -1) 📝 `ct/debian.sh` (+2 -1) 📝 `ct/ubuntu.sh` (+2 -1) 📝 `misc/build.func` (+1 -1) </details> ### 📄 Description > **🛠️ Note:** > We are meticulous about merging code into the main branch, so please understand that pull requests not meeting the project's standards may be rejected. It's never personal! > 🎮 **Note for game-related scripts:** These have a lower likelihood of being merged. --- ## ✍️ Description In https://github.com/community-scripts/ProxmoxVE/discussions/1202, I proposed that a new environment variable could be used to change the URL that the scripts fetch data from, enabling easy testing against custom repositories (or even local disk) without having to edit the files every time. In https://github.com/community-scripts/ProxmoxVE/pull/1230, the request was made to split the PR into smaller PRs. This PR implements the initial changes to a subset of `ct/*` app scripts, moving the root of the hard-coded URL to a variable that allows the environment to override it, and then changes the source command to use that variable as the base of the URL to fetch. This PR is essentially a codemod done with rg -sl 'curl -s' | xargs sed -i -e '/ProxmoxVE\/develop\/misc/ i: "${CSCRIPTS_BASE_URL:=https://raw.githubusercontent.com/community-scripts/ProxmoxVE/develop}"' -e 's%https://raw.githubusercontent.com/community-scripts/ProxmoxVE/develop/misc/build.func%"${CSCRIPTS_BASE_URL}/misc/build.func"%' The defaulting of the vault to the existing base URL means that there will be no impact on existing `source` calls; setting the variable will change where build.func is sourced from, but will not affect where the `$var_install.sh` script is loaded from. - - - - Related PR: #1250 - Related Discussion: #1202 --- ## 🛠️ Type of Change Please check the relevant options: - [ ] Bug fix (non-breaking change that resolves an issue) - [ ] New feature (non-breaking change that adds functionality) - [X] Breaking change (fix or feature that would cause existing functionality to change unexpectedly) - [ ] New script (a fully functional and thoroughly tested script or set of scripts) --- ## ✅ Prerequisites The following steps must be completed for the pull request to be considered: - [X] Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.) - [X] Testing performed (I have thoroughly tested my changes and verified expected functionality.) - [ ] ~Documentation updated (I have updated any relevant documentation)~ --- ## 📋 Additional Information (optional) The second run of the script sets the URL to point to my local checkout on the pve node. * git checkout initial-ct-changes * bash ct/alpine.sh * pct stop 105 && pct destroy 105 * CSCRIPTS_BASE_URL=file:///root/t/ProxmoxVE bash ct/alpine.sh In both cases: ![image](https://github.com/user-attachments/assets/4c47fda6-048f-4aea-9240-ad323f578986) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2025-11-20 05:32:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#2911