Skip to main content
Community Scripts logo
Skip to Content
Tools & Add-onsPVE Tools

PMG Post Install

Set up package repositories, the subscription notice and updates on a Proxmox Mail Gateway host.

post-pmg-install.sh does for Proxmox Mail Gateway what PVE Post Install does for Proxmox VE.

Website entry: post-pmg-install. Source: tools/pve/post-pmg-install.sh.

Run

In the Proxmox Mail Gateway shell, as root:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/post-pmg-install.sh)"

The script exits with 232 unless the package proxmox-mailgateway or proxmox-mailgateway-container is installed, and with 1 on ARM64.

Prompts

After the text prompt Start the Proxmox Mail Gateway Post Install Script (y/n)? the script asks one whiptail menu per step. The Debian codename is read from VERSION_CODENAME in /etc/os-release and used in all files it writes.

Menu titleChoicesEffect
PMG SOURCESyesWrites /etc/apt/sources.list.d/debian.sources (deb822; the release, its -updates and -security suites; main contrib non-free non-free-firmware) and deletes /etc/apt/sources.list.
PMG-ENTERPRISEsee below
PMG-NO-SUBSCRIPTIONsee below
PMG TEST (only if pmgtest is not found anywhere)yesWrites /etc/apt/sources.list.d/pmgtest.sources with Enabled: no.
SUBSCRIPTION NAGyesWrites /usr/local/bin/pmg-remove-nag.sh and the APT hook /etc/apt/apt.conf.d/no-nag-script, and removes the older /etc/apt/apt.conf.d/no-nag-script-pmgmanagerlib-mobile.
noDeletes those three files.
UPDATEyesapt update and apt -y dist-upgrade.
REBOOTyesReboots the host.

The enterprise and no-subscription menus depend on what the script finds in /etc/apt/sources.list, *.list and *.sources:

StateChoices
Enabledkeep, disable, delete (removes the file that contains the repository)
Disabledenable, keep, delete
Missing, pmg-enterpriseno (default) or yes: writes /etc/apt/sources.list.d/pmg-enterprise.sources
Missing, pmg-no-subscriptionyes: writes /etc/apt/sources.list.d/pmg-no-subscription.sources; no

disable and enable set Enabled: no or Enabled: yes in a .sources file, and comment or uncomment the lines of a .list file.

The nag script patches these files if they exist: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js, /usr/share/javascript/pmg-gui/js/pmgmanagerlib-mobile.js and /usr/share/pmg-mobile-quarantine-ui/pmg-mobile-index.html.tt. After the nag question the script reinstalls proxmox-widget-toolkit and pmg-gui (and pmg-mobile-quarantine-ui if installed), which applies the patch or restores the original files.

Undo

  • Subscription notice: run the script again and answer no at SUBSCRIPTION NAG.
  • Repositories: run the script again; existing repositories can be enabled, disabled or deleted.
  • /etc/apt/sources.list is deleted without a backup when you answer yes at PMG SOURCES.

Environment variables

VariableDefaultPurpose
COMMUNITY_SCRIPTS_CORE_URLhttps://raw.githubusercontent.com/community-scripts/core/mainBase URL the script loads api/api.func from.

Limits

  • disable and delete act on the whole file that contains the repository. If a file holds several repositories, all of them are affected.
  • A .sources file counts as disabled only if it has an Enabled: no line.
  • In a PMG cluster, run the script on every node.