Skip to main content
Community Scripts logo

Technical reference

Lookup tables for the engine - which file to read for which task, load guards, the host-to-container contract and the override variables.

This page is a set of lookup tables for people who read or change the engine. The overview of what each file is for is on Architecture; the function references are under core.func and Error handling.

Where to look

You want to knowReadDocs
How a script finds the enginecore/build.funcLoading
What runs on the host and what in the containerpve/backend.func (build_container), lxc/install.funcRuntime
What msg_info, $STD or a prompt doescore/core.funccore.func
Why a run failed and what the error line meanscore/error_handler.func, api/exitcodes.funcError handling, Exit codes
What a dev_mode switch doescore/dev-mode.funcDev mode
How the install menu and defaults workui/menu.func, ui/defaults.func, ui/advanced.funcWizard
How a container is created on Proxmox VE or Incuspve/backend.func, incus/backend.funcPlatforms
What the container bootstrap doeslxc/install.funcContainers
Which helper installs a runtime, database or releaselib/*.funcLibraries
How VM scripts workpve/vm-core.func, incus/vm-core.func, vm/common.funcVM paths
What telemetry sendsapi/telemetry.funcTelemetry
How update worksui/menu.func (start), core/core.func (write_update_entrypoint), misc/update.shUpdates
Where banners come fromcore/core.func (get_header), headers/Headers

Entry points

You are writingLoadThen call
a ct scriptcore/build.func (the standard loader lines)header_info, variables, color, catch_errors, and at the end start, build_container, description
an install scriptsource /dev/stdin <<<"$FUNCTIONS_FILE_PATH"color, verb_ip6, catch_errors, setting_up_container, network_check, update_os, and at the end motd_ssh, customize, cleanup_lxc
an add-on scriptcore/core.func, lib/tools.func, core/error_handler.func, api/api.func by URLload_functions, catch_errors
a VM scriptpve/vm-core.func by URLload_functions

Files, guards and loaders

Every file can be sourced more than once; a guard variable makes the second load a no-op. Files without a guard only define functions, or are sourced once by design.

FileGuard variableLoaded by
core/build.func_LXC_BUILD_DISPATCHEDct script
core/core.func_CORE_FUNC_LOADEDui/build-ui.func, incus/core.func, lxc/install.func, add-ons
core/error_handler.funcnoneui/build-ui.func, lxc/install.func, add-ons
core/dev-mode.func_DEV_MODE_FUNC_LOADEDui/build-ui.func, lxc/install.func (with dev_mode)
host/source-origin.func_CS_SOURCE_ORIGIN_LOADEDcore/build.func
host/validate.func_VALIDATE_FUNC_LOADEDui/build-ui.func, pve/vm-core.func, incus/vm-core.func
host/preflight.func_PREFLIGHT_FUNC_LOADEDrun_preflight with ENABLE_PREFLIGHT=1
lxc/platform.func_LXC_PLATFORM_FUNC_LOADEDcore/build.func
lxc/install.funcnoneinstall script
ui/build-ui.func_BUILD_UI_FUNC_LOADEDcore/build.func, incus/build.func
ui/validate.func_BUILD_UI_VALIDATE_LOADEDui/build-ui.func
ui/defaults.func_BUILD_UI_DEFAULTS_LOADEDui/build-ui.func
ui/advanced.func_BUILD_UI_ADVANCED_LOADEDui/build-ui.func
ui/menu.func_BUILD_UI_MENU_LOADEDui/build-ui.func
pve/backend.func_PVE_BACKEND_FUNC_LOADEDcore/build.func
pve/vm-core.func_VM_CORE_DISPATCHEDVM script
pve/vm-app.funcnonenot loaded by the engine
incus/build.func_INCUS_BUILD_FUNC_LOADEDcore/build.func
incus/core.func_INCUS_CORE_FUNC_LOADEDincus/build.func, incus/tools.func, incus/vm-core.func
incus/backend.func_INCUS_BACKEND_LOADEDincus/build.func
incus/tools.func_INCUS_TOOLS_FUNC_LOADEDincus/build.func
incus/vm-core.func_INCUS_VM_CORE_LOADEDpve/vm-core.func
vm/common.func_VM_COMMON_LOADEDpve/vm-core.func, incus/vm-core.func
vm/cloud-init.funcnonepve/vm-core.func
lib/tools.func_TOOLS_FUNC_LOADEDstart, update_os, add-ons
lib/system.func_TOOLS_SYSTEM_LOADEDlib/tools.func
lib/forge.func_TOOLS_FORGE_LOADEDlib/tools.func
lib/runtime.func_TOOLS_RUNTIME_LOADEDlib/tools.func
lib/db.func_TOOLS_DB_LOADEDlib/tools.func
lib/hwaccel.func_TOOLS_HWACCEL_LOADEDlib/tools.func
lib/alpine.funcnoneupdate_os on Alpine
api/api.funcnoneui/build-ui.func, VM cores, add-ons
api/exitcodes.func_API_EXITCODES_LOADEDapi/api.func, lxc/install.func
api/errorlog.func_API_ERRORLOG_LOADEDapi/api.func, lxc/install.func
api/sysinfo.func_API_SYSINFO_LOADEDapi/api.func
api/telemetry.func_API_TELEMETRY_LOADEDapi/api.func

lib/tools.func loads its parts in the order system, forge, runtime, db, hwaccel. api/api.func loads exitcodes, errorlog, sysinfo, telemetry. ui/build-ui.func loads api/api.func, core/core.func, core/error_handler.func, core/dev-mode.func, then host/validate.func, ui/validate.func, ui/defaults.func, ui/advanced.func, ui/menu.func.

Variables that select sources

VariableMeaningDefault
COMMUNITY_SCRIPTS_CORE_URLRaw base URL of the enginehttps://raw.githubusercontent.com/community-scripts/core/main
COMMUNITY_SCRIPTS_CORE_DIRLocal engine directorydetected from a sibling checkout, else the prefetch directory
COMMUNITY_SCRIPTS_URLRaw base URL of the scriptshttps://raw.githubusercontent.com/community-scripts/ProxmoxVE/main
COMMUNITY_SCRIPTS_ROOTLocal scripts directorydetected from the running script's location
COMMUNITY_SCRIPTS_NO_PREFETCH1 disables the engine prefetchunset
LXC_PLATFORMpve, incus, incus-container or containerdetected
COMMUNITY_SCRIPTS_WEBSITE_URLWebsite used by the generated update command and in messageshttps://community-scripts.org
COMMUNITY_SCRIPTS_STATE_DIRDirectory for defaults, diagnostics setting and cached banners/usr/local/community-scripts, or ~/.config/community-scripts for a non-root Incus user

Host-to-container contract

build_container exports these before it starts the install script. An install script may read them and must not redefine them.

VariableContent
FUNCTIONS_FILE_PATHThe text of lxc/install.func
appLower-case name without spaces (NSAPP)
APPLICATIONDisplay name (APP)
APPLICATION_VERSIONvar_appversion, if set
CTID, CTTYPEContainer ID; 1 unprivileged, 0 privileged
PCT_OSTYPE, PCT_OSVERSION, PCT_ARCH, PCT_DISK_SIZEOS, release, architecture and disk size in GB
var_ramThe RAM the container really got, in MiB
PASSWORDRoot password; empty means console autologin
SSH_ROOT, SSH_AUTHORIZED_KEYRoot SSH choice and public key
VERBOSEyes or no
MODEThe install method; makes prompts in the container return their defaults
tzTimezone
IPV6_METHODIPv6 setting; disable turns IPv6 off in verb_ip6
ENABLE_FUSE, ENABLE_TUN, ENABLE_GPUFeature choices
CACHER, CACHER_IPAPT cacher setting
SESSION_ID, INSTALL_LOG, BUILD_LOGSession ID and log paths; INSTALL_LOG is /root/.install-<SESSION_ID>.log
COMMUNITY_SCRIPTS_URL, COMMUNITY_SCRIPTS_CORE_URLBoth source bases
DIAGNOSTICS, RANDOM_UUID, EXECUTION_ID, REPO_SOURCE, REPO_SLUG, TELEMETRY_PLATFORMTelemetry context for progress pings
CS_TESTING, CS_TESTING_URLTesting-build state for the login banner
dev_mode, DEV_MODE_*Dev-mode switches

In the other direction the container leaves files for the host: /root/.install-<SESSION_ID>.log, .log.errinfo, .failed, .done and .pid. See Error handling.

Function inventories

The engine keeps a generated list of public functions next to three loaders: lib/API.txt, api/API.txt and ui/API.txt. The verify-split-files.yml workflow compares each list with the functions the loader really defines, and checks the prefetch lists _CS_ENGINE_FILES and _CS_CT_ENGINE_FILES against the repository. When you add, rename or remove a top-level function in lib/, api/ or ui/, regenerate the list in the same pull request; when you add a file, add it to the prefetch list.

core/core.func and core/error_handler.func have no inventory file. Their public functions are the ones documented on core.func and Error handling; names that start with an underscore are internal.

Rules

  • Write engine paths with their folder (lib/system.func).
  • In engine code, load engine files with _cs_source_func and read them with _cs_fetch_text. A fixed URL ignores local checkouts, forks and the prefetched copy.
  • Do not source individual parts of lib/, ui/ or api/ from a script.
  • Do not set ERR or EXIT traps in a script; catch_errors owns them.
  • The code on main of community-scripts/core is the authority. If a page here disagrees with it, the page is wrong.