Skip to main content
Community Scripts logo
Guides

Running from a fork or branch

How the engine decides where scripts and engine files come from, and how to point a run at your own fork, branch or checkout.

Every run loads files from two places: the scripts (ct/, install/, vm/) and the engine (the core repository: core/, lxc/, host/, api/, lib/, ui/, vm/, pve/, incus/). The two are resolved separately, so a script fork can run against the released engine and an engine branch against the released scripts.

The resolution happens at the top of core/build.func. host/source-origin.func is the small helper it uses to turn a Git checkout into a download URL.

The variables

VariableRootMeaningDefault
COMMUNITY_SCRIPTS_URLscriptsBase URL for ct/... and install/...https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main
COMMUNITY_SCRIPTS_ROOTscriptsLocal checkout; found automatically from the script file that was startedunset
COMMUNITY_SCRIPTS_CORE_URLengineBase URL for engine fileshttps://raw.githubusercontent.com/community-scripts/core/main
COMMUNITY_SCRIPTS_CORE_DIRengineLocal engine checkoutunset

COMMUNITY_SCRIPTS_DIR is still accepted as an older name for COMMUNITY_SCRIPTS_CORE_DIR.

For each file the engine first looks in the local directory of that root. If the file is not there, or no directory is set, it downloads <base URL>/<path>.

What source-origin.func does

It defines two functions and nothing else:

FunctionInputOutput
cs_git_remote_to_raw_basea Git remote URL and a branchhttps://raw.githubusercontent.com/<owner>/<repo>/<branch>
cs_detect_origin_from_gita directorythe same URL, built from that checkout's origin remote and current branch

Details that matter in practice:

  • Only GitHub remotes are recognised, in the forms git@github.com:owner/repo, https://github.com/owner/repo and ssh://git@github.com/owner/repo, with or without .git. For any other remote the function returns nothing and the default URL stays.
  • The branch is the checked-out one. On a detached HEAD the short commit hash is used in its place.
  • core/build.func loads the helper only from a local engine checkout, and only when git is installed. It then fills COMMUNITY_SCRIPTS_CORE_URL from the engine checkout and COMMUNITY_SCRIPTS_URL from the scripts checkout, each only if that variable is still empty and the directory has a .git directory.
  • A URL you set yourself always wins; detection never overwrites it.

The URL matters even with a local checkout: the container has no checkout, so files loaded inside it are downloaded from these URLs, which are exported into the container. A branch therefore has to be pushed before a run can use it end to end.

Run a script from your fork

Without a checkout, set the scripts URL and fetch the script from the same place:

COMMUNITY_SCRIPTS_URL=https://raw.githubusercontent.com/YOUR_USER/ProxmoxVE/YOUR_BRANCH \
  bash -c "$(curl -fsSL https://raw.githubusercontent.com/YOUR_USER/ProxmoxVE/YOUR_BRANCH/ct/debian.sh)"

Replace YOUR_USER and YOUR_BRANCH. The variable is required: without it the ct script comes from your fork but install/debian-install.sh is still downloaded from the default repository.

Run against an engine branch

COMMUNITY_SCRIPTS_CORE_URL=https://raw.githubusercontent.com/YOUR_USER/core/YOUR_BRANCH \
  bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"

The first lines of every ct script load core/build.func from COMMUNITY_SCRIPTS_CORE_URL, so the whole engine comes from that branch. Set both variables to test a script change together with an engine change.

Run from local checkouts

Clone the two repositories next to each other, with the engine in a directory named core:

git clone https://github.com/community-scripts/core /opt/cs/core
git clone -b YOUR_BRANCH https://github.com/YOUR_USER/ProxmoxVE /opt/cs/ProxmoxVE
bash /opt/cs/ProxmoxVE/ct/debian.sh

A ct script looks for ../../core/core/build.func relative to itself before it downloads anything, so this layout needs no variables:

  • the engine root becomes /opt/cs/core, and engine files are read from disk;
  • the scripts root becomes /opt/cs/ProxmoxVE, the first parent directory of the script that contains both ct/ and install/;
  • both URLs are derived from the checkouts' remotes and branches as described above.

With the engine somewhere else, name it:

COMMUNITY_SCRIPTS_CORE_DIR=/opt/core-dev bash /opt/cs/ProxmoxVE/ct/debian.sh

This also works with the one-line command, to run released scripts against a local engine:

COMMUNITY_SCRIPTS_CORE_DIR=/opt/core-dev \
  bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"

Check what a run used

  • When either URL differs from the official ones, the settings summary printed before the container is created has an extra line for the engine or the scripts source.
  • dev_mode=net prints [net] lines for the engine downloads with status, time and URL. See Dev mode.
dev_mode=net COMMUNITY_SCRIPTS_CORE_URL=https://raw.githubusercontent.com/YOUR_USER/core/YOUR_BRANCH \
  bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/debian.sh)"
  • COMMUNITY_SCRIPTS_STATE_DIR moves the directory for default.vars and app defaults. It is not a source root; see Defaults and install modes.
  • Setting up a fork for contributing is covered in Fork setup.