Packager guide - acmesh-official/acme.sh GitHub Wiki
Packager guide
This page is for distro / package maintainers who ship acme.sh as a system
package (deb, rpm, port, etc.), typically with the files under a
package-managed directory like /usr/share/acme.sh.
The problem
By default acme.sh manages itself:
acme.sh --installcopies the script and the hook folders (dnsapi,deploy,notify) into$LE_WORKING_DIR(default~/.acme.sh), so users end up running a frozen copy that your package upgrades can never update.acme.sh --upgrade,acme.sh --install-onlineand the cronAUTO_UPGRADE=1path download the latest master from GitHub and install it over$LE_WORKING_DIR. If your package pointsLE_WORKING_DIRat the packaged files, this overwrites package-managed files.acme.sh --uninstallremoves$LE_WORKING_DIR/acme.sh, which again may be a package-managed file.
ACME_PACKAGED
Since v3.1.5, set the ACME_PACKAGED environment variable to any non-empty
value to tell acme.sh that it is managed by a system package manager:
--installdoes not copy the script, the completion file or the hook folders into$LE_WORKING_DIR. It still creates the working/config dirs, writesaccount.conf, installs the cron job and the shell alias -- both pointing to the packaged script itself.--upgrade,--install-onlineand the cronAUTO_UPGRADEpath refuse with an error telling the user to upgrade via the package manager.--uninstallremoves the cron job and the alias, but does not delete the script files.
The easiest way to set it is a wrapper installed as /usr/bin/acme.sh:
#!/bin/sh
export ACME_PACKAGED=1
exec /usr/share/acme.sh/acme.sh "$@"
Notes
- Do not point
LE_WORKING_DIRat the packaged directory. Leave it at the default (~/.acme.shper user, or let users pick--home): it holds the per-user state (account.conf, account keys, certs). The hooks are looked up next to the running script automatically, no copy in$LE_WORKING_DIRis needed. - Users can still use
--config-hometo separate config/certs from$LE_WORKING_DIRas usual. - There is intentionally no path auto-detection ("am I under /usr?"): a git
clone under
/usr/localor a custom--homeunder/usrare legitimate self-managed installs.ACME_PACKAGEDis an explicit opt-in by the packager.
See https://github.com/acmesh-official/acme.sh/issues/7135 for background.