GRI-2081: install.sh client upgrade installs the new build and restarts the player #217

Merged
vivy merged 6 commits from fix/GRI-2081-client-upgrade-reinstall into dev 2026-11-15 15:04:45 +00:00
Member

Closes #206 (board GRI-2081).

Cause

Every client build was packaged as 0.1.0. install.sh ran apt-get install -y "$deb", and apt skips a .deb whose version is already installed, with exit 0, while its output went to /dev/null. So install.sh upgrade client printed installed grimoirix-signage-client_0.1.0_amd64.deb and left the old binary in /usr/bin.

Reproduced with the real apt-get and dpkg against a private dpkg database (no root):

A plain (fresh install)            exit=0    /usr/bin -> build-A
B plain, same version              exit=0    /usr/bin -> build-A    <- the defect
B --reinstall, same ver            exit=0    /usr/bin -> build-B
D older version, plain             exit=100  "Packages were downgraded and -y was used without --allow-downgrades"
D older, --allow-downgrades        exit=0    /usr/bin -> build-D

Change (both options from the issue, plus the restart)

  1. scripts/package-client-deb.sh: each build gets its own version, <workspace version>+git<UTC commit time>.<short sha>, e.g. 0.1.0+git20261115014326.71a482fb. The commit time comes first, so a newer commit sorts as a newer version, and dpkg -l grimoirix-signage-client shows which build a device runs. SIGNAGE_DEB_VERSION overrides it. Outside a git checkout the bare workspace version is kept.
  2. install.sh:
    • installs the file the package script names on its built: line, not the newest .deb found by ls -t;
    • apt-get install --reinstall --allow-downgrades, which keeps dependency resolution. A rebuild of the same commit (upgrade --force) applies, and so does an older SCRYGLASS_REF;
    • checks that it took: the dpkg version must equal the .deb's version, and the sha256 of /usr/bin/grimoirix-signage-client must equal the one inside the .deb. Otherwise it stops with an error and does not print "installed". It prints the installed version and the binary's sha;
    • restarts the player: a player still running the replaced binary (its /proc/PID/exe ends in (deleted)) is stopped and started again as the same user, with the same environment, working directory and arguments, so it comes back in the same desktop session. Its output goes to the journal through systemd-cat when journald is running. When no player is running, the script says that the next login starts the new build. When a player cannot be started again, it says plainly to log out or restart the device. Running it a second time leaves a player that is already on the new build alone.
  3. scripts/tests/install-client-upgrade-test.sh (18 assertions): real apt-get and dpkg against a private database, with a copy of sleep(1) as the packaged binary, so /proc/PID/exe behaves as it does for the real player. It covers a fresh install, a same-version rebuild, a newer and an older commit, an upgrade from the bare 0.1.0, the guard catching a silent skip (old command without --reinstall), and the restart: the old process is gone, exactly one new one runs the new binary with the same arguments and working directory, and a second run leaves it alone. It is wired into local-gates.sh and added as CI job installer, which is in the needs of CI and of notify-gate-failed.
  4. README: the upgrade text and the manual install line.

Verified

  • scripts/local-gates.sh --rust-only --frontend-only (the shell gates: hooks, pre-push test, this test): every gate passed. No Rust or front-end file is changed, so the Rust and front-end gates were not run locally. CI runs them.
  • Version derivation, run from the package script itself: in this checkout 0.1.0+git20261115014326.71a482fb (HEAD 71a482f, committed 01:43:26 UTC); with SIGNAGE_DEB_VERSION=1.2.3 → 1.2.3; outside a git checkout → 0.1.0.

Not verified here

  • The real client .deb was not built: the build host was at load 14 of 16 threads. Only the version string and the file name change in that script, and the test builds .debs with versions in the new format.
  • The restart inside a real desktop session (runuser into a graphical session, X11 or Wayland) cannot be run on the build host. The test runs that code path as the same user. The acceptance run on the test client from GRI-2051 is still owed: install.sh upgrade client on two different commits, then check that /usr/bin/grimoirix-signage-client is the second build, the printed version matches dpkg -l, and the player on screen came back.
Closes #206 (board GRI-2081). ## Cause Every client build was packaged as `0.1.0`. `install.sh` ran `apt-get install -y "$deb"`, and apt **skips** a `.deb` whose version is already installed, with exit 0, while its output went to `/dev/null`. So `install.sh upgrade client` printed `installed grimoirix-signage-client_0.1.0_amd64.deb` and left the old binary in `/usr/bin`. Reproduced with the real apt-get and dpkg against a private dpkg database (no root): ``` A plain (fresh install) exit=0 /usr/bin -> build-A B plain, same version exit=0 /usr/bin -> build-A <- the defect B --reinstall, same ver exit=0 /usr/bin -> build-B D older version, plain exit=100 "Packages were downgraded and -y was used without --allow-downgrades" D older, --allow-downgrades exit=0 /usr/bin -> build-D ``` ## Change (both options from the issue, plus the restart) 1. **`scripts/package-client-deb.sh`**: each build gets its own version, `<workspace version>+git<UTC commit time>.<short sha>`, e.g. `0.1.0+git20261115014326.71a482fb`. The commit time comes first, so a newer commit sorts as a newer version, and `dpkg -l grimoirix-signage-client` shows which build a device runs. `SIGNAGE_DEB_VERSION` overrides it. Outside a git checkout the bare workspace version is kept. 2. **`install.sh`**: - installs the file the package script names on its `built:` line, not the newest `.deb` found by `ls -t`; - `apt-get install --reinstall --allow-downgrades`, which keeps dependency resolution. A rebuild of the same commit (`upgrade --force`) applies, and so does an older `SCRYGLASS_REF`; - **checks that it took**: the dpkg version must equal the `.deb`'s version, and the sha256 of `/usr/bin/grimoirix-signage-client` must equal the one inside the `.deb`. Otherwise it stops with an error and does not print "installed". It prints the installed version and the binary's sha; - **restarts the player**: a player still running the replaced binary (its `/proc/PID/exe` ends in ` (deleted)`) is stopped and started again as the same user, with the same environment, working directory and arguments, so it comes back in the same desktop session. Its output goes to the journal through `systemd-cat` when journald is running. When no player is running, the script says that the next login starts the new build. When a player cannot be started again, it says plainly to log out or restart the device. Running it a second time leaves a player that is already on the new build alone. 3. **`scripts/tests/install-client-upgrade-test.sh`** (18 assertions): real apt-get and dpkg against a private database, with a copy of `sleep(1)` as the packaged binary, so `/proc/PID/exe` behaves as it does for the real player. It covers a fresh install, a same-version rebuild, a newer and an older commit, an upgrade from the bare `0.1.0`, the guard catching a silent skip (old command without `--reinstall`), and the restart: the old process is gone, exactly one new one runs the new binary with the same arguments and working directory, and a second run leaves it alone. It is wired into `local-gates.sh` and added as CI job `installer`, which is in the `needs` of `CI` and of `notify-gate-failed`. 4. README: the upgrade text and the manual install line. ## Verified - `scripts/local-gates.sh --rust-only --frontend-only` (the shell gates: hooks, pre-push test, this test): every gate passed. No Rust or front-end file is changed, so the Rust and front-end gates were not run locally. CI runs them. - Version derivation, run from the package script itself: in this checkout `0.1.0+git20261115014326.71a482fb` (HEAD `71a482f`, committed 01:43:26 UTC); with `SIGNAGE_DEB_VERSION=1.2.3` → `1.2.3`; outside a git checkout → `0.1.0`. ## Not verified here - The real client `.deb` was not built: the build host was at load 14 of 16 threads. Only the version string and the file name change in that script, and the test builds `.deb`s with versions in the new format. - **The restart inside a real desktop session** (`runuser` into a graphical session, X11 or Wayland) cannot be run on the build host. The test runs that code path as the same user. The acceptance run on the test client from GRI-2051 is still owed: `install.sh upgrade client` on two different commits, then check that `/usr/bin/grimoirix-signage-client` is the second build, the printed version matches `dpkg -l`, and the player on screen came back.
GRI-2081: install.sh client upgrade installs the new build and restarts the player
Some checks failed
CI / the pre-push hook (pull_request) Successful in 49s
CI / cargo fmt (pull_request) Successful in 37s
CI / install.sh client upgrade (pull_request) Failing after 2m25s
CI / cargo deny (pull_request) Successful in 2m1s
CI / cargo clippy (pull_request) Successful in 2m30s
CI / repository boundary (pull_request) Successful in 56s
CI / cargo deny advisories (pull_request) Successful in 1m59s
CI / frontend-web (pull_request) Successful in 2m44s
CI / cargo test (pull_request) Successful in 4m56s
CI / CI (pull_request) Failing after 54s
CI / Notify gate failed (pull_request) Successful in 1m21s
7613c53572
Every client build was packaged as 0.1.0, and apt-get install skips a .deb
whose version is already installed, with exit 0 and its output in /dev/null.
install.sh upgrade client printed "installed" and left the old binary.

- package-client-deb.sh: each build is <version>+git<UTC commit time>.<sha>
  (SIGNAGE_DEB_VERSION overrides it).
- install.sh: apt-get install --reinstall --allow-downgrades, installs the
  file the package script names, then checks the dpkg version and the
  binary's sha256 against the .deb and stops on a mismatch; prints the
  installed version. A player still running the replaced binary is stopped
  and started again in its own session (user, environment, cwd, arguments).
- scripts/tests/install-client-upgrade-test.sh: real apt-get and dpkg against
  a private dpkg database; in local-gates.sh and as a CI job.
Merge branch 'dev' into fix/GRI-2081-client-upgrade-reinstall
Some checks failed
CI / the pre-push hook (pull_request) Successful in 23s
CI / cargo fmt (pull_request) Successful in 27s
CI / install.sh client upgrade (pull_request) Failing after 1m36s
CI / cargo clippy (pull_request) Successful in 2m10s
CI / cargo deny (pull_request) Successful in 1m52s
CI / cargo deny advisories (pull_request) Successful in 1m35s
CI / repository boundary (pull_request) Successful in 29s
CI / frontend-web (pull_request) Successful in 2m36s
CI / cargo test (pull_request) Successful in 5m0s
CI / Notify gate failed (pull_request) Successful in 1m9s
CI / CI (pull_request) Failing after 1m11s
d281986a43
Owner

Not merging yet: the new install.sh client upgrade job that this PR adds is red on 7613c535. It is not a required context, but it is the test for this exact fix, so a red here means the fix is not shown to work. I updated the branch on dev (#215 merged); please make that job green on the new head. I will also make it a required context on dev once this lands.

Not merging yet: the new `install.sh client upgrade` job that this PR adds is red on 7613c535. It is not a required context, but it is the test for this exact fix, so a red here means the fix is not shown to work. I updated the branch on dev (#215 merged); please make that job green on the new head. I will also make it a required context on dev once this lands.
Merge remote-tracking branch 'origin/dev' into fix/GRI-2081-client-upgrade-reinstall
Some checks failed
CI / the pre-push hook (pull_request) Successful in 54s
CI / cargo fmt (pull_request) Successful in 1m5s
CI / install.sh client upgrade (pull_request) Successful in 2m36s
CI / cargo clippy (pull_request) Successful in 2m53s
CI / cargo deny (pull_request) Successful in 1m47s
CI / cargo deny advisories (pull_request) Successful in 2m4s
CI / cargo test (pull_request) Failing after 3m55s
CI / repository boundary (pull_request) Successful in 1m56s
CI / frontend-web (pull_request) Successful in 2m29s
CI / Notify gate failed (pull_request) Successful in 27s
CI / CI (pull_request) Failing after 29s
c523957592
Merge remote-tracking branch 'origin/dev' into fix/GRI-2081-client-upgrade-reinstall
Some checks failed
CI / cargo fmt (pull_request) Successful in 45s
CI / the pre-push hook (pull_request) Successful in 53s
CI / install.sh client upgrade (pull_request) Successful in 1m0s
CI / cargo clippy (pull_request) Successful in 2m14s
CI / cargo deny advisories (pull_request) Successful in 1m53s
CI / cargo deny (pull_request) Successful in 2m1s
CI / cargo test (pull_request) Failing after 2m22s
CI / repository boundary (pull_request) Successful in 27s
CI / frontend-web (pull_request) Successful in 1m50s
CI / CI (pull_request) Failing after 25s
CI / Notify gate failed (pull_request) Successful in 27s
2ee3f441b8
Merge remote-tracking branch 'origin/dev' into HEAD
All checks were successful
CI / the pre-push hook (pull_request) Successful in 3m23s
CI / cargo fmt (pull_request) Successful in 1m11s
CI / install.sh client upgrade (pull_request) Successful in 2m51s
CI / cargo deny (pull_request) Successful in 1m45s
CI / cargo clippy (pull_request) Successful in 3m46s
CI / repository boundary (pull_request) Successful in 1m56s
CI / cargo deny advisories (pull_request) Successful in 3m6s
CI / frontend-web (pull_request) Successful in 3m28s
CI / cargo test (pull_request) Successful in 6m5s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 11s
b86baba332
vivy merged commit 2ae146b6cd into dev 2026-11-15 15:04:45 +00:00
vivy deleted branch fix/GRI-2081-client-upgrade-reinstall 2026-11-15 15:04:46 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!217
No description provided.