Documentation
¶
Index ¶
- Constants
- func AllowedEnvOverrideNames() []string
- func BuildInstallScriptCommand(scriptURL string) string
- func BuildInstallScriptCommandWithEnv(scriptURL string, env []EnvOverride) (string, error)
- func BuildInstallScriptCommandWithEnvAndPreset(scriptURL string, env []EnvOverride, preset string) (string, error)
- func BuildRemoteInstallCommand(user string, script Script, env []EnvOverride, preset string) (string, error)
- func BuildRemoteInstallCommandWithMode(user string, script Script, env []EnvOverride, preset string, ...) (string, error)
- func BuildRemoteInstallInLXCCommand(user string, vmid int, script Script, nonInteractive bool) (string, error)
- func BuildRemoteInstallInLXCCommandWithEnv(user string, vmid int, script Script, env []EnvOverride, preset string, ...) (string, error)
- func InstallScript(user, nodeIP string, script Script) (int, error)
- func InstallScriptInLXC(user, nodeIP string, vmid int, script Script) (int, error)
- func InstallScriptInLXCWithOptions(ctx context.Context, opts InstallOptions, vmid int) (int, error)
- func InstallScriptWithOptions(ctx context.Context, opts InstallOptions) (int, error)
- func IsSensitiveEnvOverride(name string) bool
- func RawRepoForScript(script Script) string
- func RawScriptURL(script Script) string
- func ScriptURLExists(script Script) (bool, error)
- func ShellQuote(s string) string
- func ShellSingleQuote(s string) string
- func ValidateConnection(user, nodeIP string) error
- func ValidateEnvOverride(override EnvOverride) error
- func ValidateInstallPreset(preset string) error
- func WrapRemoteCommandWithBash(cmd string) string
- type EnvOverride
- type GitHubContent
- type InstallOptions
- type Script
- func FetchScripts() ([]Script, error)
- func FindScript(scripts []Script, nameOrSlug string) (Script, error)
- func GetScriptMetadata(metadataURL string) (*Script, error)
- func GetScriptsByCategory(category string) ([]Script, error)
- func NormalizeScript(script Script) Script
- func SearchScripts(scripts []Script, query string) []Script
- type ScriptCategory
Constants ¶
const ( GitHubRepo = "https://github.com/community-scripts/ProxmoxVE" GitHubAPIRepo = "https://api.github.com/repos/community-scripts/ProxmoxVE" RawGitHubRepo = "https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main" RawGitHubDevRepo = "https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main" MetadataPocketBaseBase = "https://db.community-scripts.org" MetadataPocketBaseAPI = MetadataPocketBaseBase + "/api/collections" )
GitHubRepo is the URL to the Proxmox Community Scripts repository.
const ( ScriptMetadataTTL = 24 * time.Hour // Cache script metadata for 24 hours ScriptListTTL = 12 * time.Hour // Cache script list for 12 hours )
Cache TTLs.
const ( ScriptMetadataListCacheKey = "communityscripts_script_metadata_list_v3" ScriptListCacheKey = "communityscripts_script_list_v3" ScriptCacheKeyPrefix = "communityscripts_script_" )
Cache keys.
Variables ¶
This section is empty.
Functions ¶
func AllowedEnvOverrideNames ¶
func AllowedEnvOverrideNames() []string
AllowedEnvOverrideNames returns the supported Community Scripts var_* keys.
func BuildInstallScriptCommand ¶
BuildInstallScriptCommand builds the shell command that runs a remote script.
func BuildInstallScriptCommandWithEnv ¶
func BuildInstallScriptCommandWithEnv(scriptURL string, env []EnvOverride) (string, error)
BuildInstallScriptCommandWithEnv builds the shell command that runs a remote script with Community Scripts var_* environment overrides.
func BuildInstallScriptCommandWithEnvAndPreset ¶
func BuildInstallScriptCommandWithEnvAndPreset(scriptURL string, env []EnvOverride, preset string) (string, error)
BuildInstallScriptCommandWithEnvAndPreset builds the shell command that runs a remote script with var_* overrides and an optional Community Scripts preset.
func BuildRemoteInstallCommand ¶
func BuildRemoteInstallCommand(user string, script Script, env []EnvOverride, preset string) (string, error)
BuildRemoteInstallCommand returns the shell command executed on the target node.
func BuildRemoteInstallCommandWithMode ¶ added in v1.4.3
func BuildRemoteInstallCommandWithMode(user string, script Script, env []EnvOverride, preset string, nonInteractive bool) (string, error)
BuildRemoteInstallCommandWithMode returns the shell command executed on the target node. In non-interactive mode, sudo uses -n so password prompts fail immediately instead of blocking automation.
func BuildRemoteInstallInLXCCommand ¶ added in v1.4.3
func BuildRemoteInstallInLXCCommand(user string, vmid int, script Script, nonInteractive bool) (string, error)
BuildRemoteInstallInLXCCommand returns the shell command executed on a Proxmox node to run a Community Scripts addon inside an existing LXC.
func BuildRemoteInstallInLXCCommandWithEnv ¶ added in v1.4.3
func BuildRemoteInstallInLXCCommandWithEnv(user string, vmid int, script Script, env []EnvOverride, preset string, nonInteractive bool) (string, error)
BuildRemoteInstallInLXCCommandWithEnv returns the shell command executed on a Proxmox node to run a Community Scripts addon inside an existing LXC with optional environment overrides.
func InstallScript ¶
InstallScript installs a script on a Proxmox node via SSH. Returns the remote exit code (0 on success) and any error encountered.
func InstallScriptInLXC ¶
InstallScriptInLXC installs a script inside an existing LXC container via pct exec.
func InstallScriptInLXCWithOptions ¶ added in v1.4.3
InstallScriptInLXCWithOptions installs a script inside an existing LXC container via pct exec.
func InstallScriptWithOptions ¶
func InstallScriptWithOptions(ctx context.Context, opts InstallOptions) (int, error)
InstallScriptWithOptions installs a script on a Proxmox node via SSH.
func IsSensitiveEnvOverride ¶
IsSensitiveEnvOverride reports whether an override value should be redacted in output.
func RawRepoForScript ¶
RawRepoForScript returns the raw GitHub repository URL for a script.
func RawScriptURL ¶
RawScriptURL returns the direct raw shell script URL.
func ScriptURLExists ¶
ScriptURLExists checks whether the raw install script exists.
func ShellQuote ¶
ShellQuote wraps a value in single quotes for POSIX shell usage.
func ShellSingleQuote ¶
ShellSingleQuote escapes a value for inclusion inside a single-quoted shell string.
func ValidateConnection ¶
ValidateConnection checks if SSH connection to the node is possible.
func ValidateEnvOverride ¶
func ValidateEnvOverride(override EnvOverride) error
ValidateEnvOverride validates a Community Scripts var_* override.
func ValidateInstallPreset ¶
ValidateInstallPreset validates a Community Scripts menu preset argument.
func WrapRemoteCommandWithBash ¶
WrapRemoteCommandWithBash wraps a remote command in /bin/bash -lc.
Types ¶
type EnvOverride ¶
EnvOverride is a validated Community Scripts environment variable override.
func ParseEnvOverride ¶
func ParseEnvOverride(raw string) (EnvOverride, error)
ParseEnvOverride parses and validates a KEY=VALUE Community Scripts override.
func RedactEnvOverrides ¶
func RedactEnvOverrides(env []EnvOverride) []EnvOverride
RedactEnvOverrides returns a copy with sensitive values replaced.
type GitHubContent ¶
type GitHubContent struct {
Name string `json:"name"`
Path string `json:"path"`
Type string `json:"type"` // "file" or "dir"
DownloadURL string `json:"download_url"`
}
GitHubContent represents a file or directory in the GitHub API.
func GetScriptMetadataFiles ¶
func GetScriptMetadataFiles() ([]GitHubContent, error)
GetScriptMetadataFiles fetches the list of script metadata JSON files from the repository.
type InstallOptions ¶
type InstallOptions struct {
User string
Host string
Keyfile string
JumpHost config.SSHJumpHost
Script Script
Env []EnvOverride
Preset string
NonInteractive bool
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
InstallOptions describes a community script installation over SSH.
type Script ¶
type Script struct {
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
Categories []string `json:"categories"`
Type string `json:"type"` // "ct" for containers, "vm" for VMs
SourceType string `json:"source_type,omitempty"`
Target string `json:"target,omitempty"`
Updateable bool `json:"updateable"`
Privileged bool `json:"privileged"`
InterfacePort int `json:"interface_port"`
Documentation string `json:"documentation"`
Website string `json:"website"`
ConfigPath string `json:"config_path"`
Logo string `json:"logo"`
ScriptPath string // Added for our use, not in the JSON
DateCreated string `json:"date_created"`
IsDev bool `json:"is_dev"`
IsDisabled bool `json:"is_disabled"`
IsDeleted bool `json:"is_deleted"`
}
Script represents a single script from the repository.
func FetchScripts ¶
FetchScripts fetches all available scripts from the repository.
func FindScript ¶
FindScript finds a script by exact slug or case-insensitive name.
func GetScriptMetadata ¶
GetScriptMetadata fetches and parses the metadata for a specific script.
func GetScriptsByCategory ¶
GetScriptsByCategory returns scripts for a specific category.
func NormalizeScript ¶ added in v1.4.3
NormalizeScript fills derived metadata and cleans display text for cached scripts.
func SearchScripts ¶
SearchScripts returns scripts whose name, slug, or description contains query.
func (Script) SupportsGuestInstall ¶ added in v1.4.3
SupportsGuestInstall reports whether the script can be run inside an existing LXC.
func (Script) SupportsNodeInstall ¶ added in v1.4.3
SupportsNodeInstall reports whether the script can be run on a Proxmox node.
type ScriptCategory ¶
ScriptCategory represents a category of Proxmox scripts.
func GetScriptCategories ¶
func GetScriptCategories() []ScriptCategory
GetScriptCategories returns the available script categories.