Expand description
The launcher’s half of upgrading a .deb or .rpm install from the app
(docs/specs/SPEC_LINUX_PACKAGE_UPGRADE_AND_REPOSITORY_2026_10_24.md §3.1,
phase 3g-1).
Installing a package takes root, and AgentMux never runs as root. So instead
of the usual “quit, then run the installer”, the user is asked for permission
first, while AgentMux is still open: pkexec starts the package’s own helper
(/opt/agentmux/bin/agentmux-install-update, scripts/agentmux-install-update.sh),
the desktop shows its password prompt, and the helper checks the file itself
and prints READY. Only then does the launcher quit; the helper waits for it
to be gone, installs, and a small waiter, started before any of that and kept
running after the launcher exits, starts AgentMux again whether the install
worked or not, so the old version runs rather than none.
If the password is refused, can’t be asked for, or the file fails its checks,
nothing quits: the reason is left for srv (INSTALL_RESULT_FILE) and the
panel says it.
Structs§
- Package
Upgrade - A package that the user’s password can install.
Constants§
- DISMISSED 🔒
- pkexec exits with this when the user dismissed the password prompt, and with
NOT_AUTHORIZEDwhen it couldn’t authorise the command (no prompt to show, or not allowed). - GO_
BACK_ 🔒ARG - What to hand the helper in place of a file when it is to install the version the last upgrade replaced.
- GO_
BACK_ 🔒AUTHORIZE_ WITHIN - How long going back waits for the helper’s
READY: it prints that only once it has downloaded the old release (its download may take up to 900 s) and checked it, and the user’s password prompt comes before all of that. Stopping the wait early would leave the helper without the waiter that starts AgentMux again. - GO_
BACK_ 🔒WITHIN - How long after an upgrade going back is still offered: after that, what the new version did to its data is too much to leave behind.
- HELPER_
NAME - The helper’s name in
INSTALL_BIN. - INSTALL_
BIN - Where a package puts AgentMux’s programs.
- NOT_
AUTHORIZED 🔒 - START_
COMMAND - The command that starts the installed AgentMux (the package’s wrapper).
- STATE_
DIR - The helper’s record of the last upgrade it did (
from=andto=lines), readable by anyone: what “go back” is offered from. - WAITER 🔒
- What the waiter runs:
pkexec <helper> <file> <version> <launcher pid>, with the helper’s output in files the launcher and the waiter read (the files are opened here, as the user, so root never needs a path in the user’s folders). Arguments: pkexec, helper, file, version, launcher pid, out, err, result, the command that starts AgentMux.
Statics§
- WAITER_
GROUP 🔒 - The waiter’s process group while the password prompt is open (0 when none).
Functions§
- authorize
- Ask for permission to install
up(the desktop’s password prompt, through polkit) and have its helper check the file.trueonce the helper is waiting for AgentMux to quit: the waiter then carries on without the launcher.false(with the reason left for srv, unless the user simply said no) when nothing will be installed, so AgentMux keeps running. - authorize_
with 🔒 - check
- Check what srv names to install against this install:
installeris the release’s package forversion, as downloaded into this version’supdates/<version>/and whole bysha256, and this launcher is the installed one (own_dirisbin_dir) with the install helper beside it. - dismiss
- Close the password prompt (and with it the waiter), as “Not now”.
- go_
back_ question - What the dialog asks when the new version could not be kept running.
- go_
back_ version - Whether the last upgrade the helper did replaced
versionwithown_version(the running one) not long beforenow: then going back to it is on offer.recordis the helper’slast-upgradefile:from=andto=lines. - last_
reason 🔒 - The last line the helper left on stderr, without its prefix.
- leave_
result 🔒 - Leave
errorfor srv, which shows it in the version panel. - offer_
go_ back - The new version could not be kept running (
whyfinishes “AgentMux X ___”): offer to go back to the version the last upgrade replaced.trueonce the helper has accepted and is waiting for this launcher to exit: the caller exits, and the waiter starts the old version. Only for a.deb/.rpminstall, one upgrade from the app ago (the helper’s record), and the user’s yes. - package_
file_ name - The release’s file for
version, by package kind. - question
- What the dialog asks before the password is: the user agrees to quit, then the desktop asks for the password.
- read_
result 🔒 - The reason an earlier try left (see
leave_result).