Installation Scripts
Install scripts
What install/<app>-install.sh is, when it runs, and what the engine has prepared before its first line.
Every container script has a partner at install/<app>-install.sh in
ProxmoxVE.
The user never runs it. build_container fetches it on the host and executes it
inside the new container as root. It installs the application and nothing else:
the container already exists, has an address, and has curl, sudo, mc,
gnupg2 and jq (Debian and Ubuntu) or bash, newt, curl, openssh, nano,
mc, ncurses and jq (Alpine) installed.
The shape of a script
install/gotify-install.sh
in full:
#!/usr/bin/env bash
# Copyright (c) 2021-2026 tteck
# Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://gotify.net/ | Github: https://github.com/gotify/server
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
fetch_and_deploy_gh_release "gotify" "gotify/server" "prebuild" "latest" "/opt/gotify" "gotify-linux-$(arch_resolve).zip"
chmod +x /opt/gotify/gotify-linux-$(arch_resolve)
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/gotify.service
[Unit]
Description=Gotify
Requires=network.target
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/gotify
ExecStart=/opt/gotify/gotify-linux-$(arch_resolve) serve
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now gotify
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc| Block | Lines | Same in every script |
|---|---|---|
| Bootstrap | source through update_os | yes |
| Application | dependencies, runtimes, databases, release, configuration, service | no |
| Finish | motd_ssh, customize, cleanup_lxc | yes |
What the script can rely on
- It runs as root inside the container, started by the host with
lxc-attach. FUNCTIONS_FILE_PATHholds the text oflxc/install.func. Sourcing it loads messaging, error handling and OS detection.- After
update_osthe helper library is loaded:lib/tools.funcon every distribution except Alpine, which getslib/alpine.func. Helpers such asfetch_and_deploy_gh_releaseorsetup_nodejsdo not exist before that call. - Exported variables of the container script arrive in the environment, among them
APPLICATION(theAPPvalue),app(NSAPP),PASSWORD,SSH_ROOT,CTTYPE,PCT_OSTYPE,PCT_OSVERSION,PCT_ARCH,var_ramand anyvar_*the container script exported itself. LOCAL_IPholds the container's address.- A failing command stops the script. The error handler writes the exit code and the output of the failed step to files the host collects; the host shows the error and reports it.
Where to go next
- Anatomy of an install script explains every block with real scripts, including the Alpine variant.
- Container scripts covers the file the user runs.
- Container creation covers what happens on the host before and after the install script.