[overrideable url] Initial changes to ct scripts to use environment variable #1251
+29
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✍️ Description
In #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 #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:
✅ Prerequisites
The following steps must be completed for the pull request to be considered:
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.
In both cases: