On the pacman backend, an installed AUR helper (paru, else yay;
--aur-helper=paru|yay|none, --no-aur) adds the AUR updates to the review
list. The helper never runs as root: when the tool is root through sudo it
runs as SUDO_USER (runuser -u, else sudo -u, with that user's HOME, from
that home); unprivileged it runs as is; a root login gets no AUR, with a
warning. The banner names the helper ("+ AUR via paru").
- listing: <helper> -Qua (also with --no-refresh), rows with repository
"aur"; [ignored] is shown [held]; a failing -Qua warns and the session
goes on with the repository rows
- every row has a marker column after the number: "*" for AUR rows, a
space otherwise (on every backend)
- N?? merges pacman -Qi with <helper> -Sia; N?, N+, Nx stay with pacman;
N- excludes through the helper's --ignore
- <enter>: the repository step exactly as before, then <helper> -Sua
--ignore <excluded> as the invoking user (--noconfirm only when stdin is
not a terminal); pacman is skipped when only AUR rows are left; a helper
failure is reported and its status returned; --dry-run prints it
- other backends never run a helper; --aur-helper is ignored with a warning
paru 2.1.0 and yay 13.0.1 formats verified in discovery/pacman.md section
15 (proof: discovery/pacman/aur.sh). Unit tests replay the recorded output
(fake paru, yay, runuser, getent); the archlinux E2E run installs the
foreign su-dummy-aur and drives a fake paru through a fake sudo built on
passwordless su for wheel.
59 lines
2.5 KiB
Bash
Executable File
59 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# Copyright (C) 2026 Bryan Joshua Pedini
|
|
|
|
# tests/e2e/entrypoint.sh - runs INSIDE one distro container (started by tests/docker/run-e2e.sh,
|
|
# as root, repository mounted read-only at /work, SU_DISTRO=<label>):
|
|
# 1. installs the applet as /usr/local/bin/skeptical-updater
|
|
# 2. builds the deterministic fixture for the package-manager family (su-dummy-{a,b,c}
|
|
# 1.0 installed, 2.0 offered by a local repo; the distro's own repos are disabled;
|
|
# su-dummy-orphan: an unrelated, automatically installed package nothing needs)
|
|
# 3. runs tests/e2e/*.bats with the vendored bats-core against the REAL package manager
|
|
# Exit status: the bats status (or 1 if the setup failed).
|
|
set -euo pipefail
|
|
export LC_ALL=C DEBIAN_FRONTEND=noninteractive
|
|
|
|
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." # repository root (read-only)
|
|
log() { printf '== entrypoint: %s\n' "$*"; }
|
|
die() {
|
|
printf '== entrypoint: ERROR: %s\n' "$*" >&2
|
|
exit 1
|
|
}
|
|
|
|
[[ $(id -u) -eq 0 ]] || die "must run as root"
|
|
t0=$SECONDS
|
|
|
|
install -m 0755 skeptical-updater /usr/local/bin/skeptical-updater
|
|
|
|
if command -v pacman >/dev/null 2>&1; then
|
|
family=pacman
|
|
# FIXTURE_SYNC=1: a system whose sync database was synced once (--no-refresh lists from it);
|
|
# FIXTURE_AUR=1: the foreign package su-dummy-aur and the user su-tester for tests/e2e/aur.bats
|
|
FIXTURE_ISOLATE=1 FIXTURE_ORPHAN=1 FIXTURE_SYNC=1 FIXTURE_AUR=1 bash tests/e2e/fixtures/pacman.sh
|
|
elif command -v apt-get >/dev/null 2>&1; then
|
|
family=apt
|
|
SU_FIXTURE_OFFLINE=1 SU_FIXTURE_ORPHAN=1 SU_FIXTURE_B_AUTO=1 bash tests/e2e/fixtures/apt.sh
|
|
elif command -v zypper >/dev/null 2>&1 || command -v dnf >/dev/null 2>&1 || command -v yum >/dev/null 2>&1; then
|
|
family=rpm
|
|
SU_FIXTURE_ISOLATE=1 SU_FIXTURE_ORPHAN=1 SU_FIXTURE_B_AUTO=1 bash tests/e2e/fixtures/rpm.sh
|
|
else
|
|
die "no supported package manager in this image"
|
|
fi
|
|
export SU_FAMILY=$family
|
|
# shellcheck source=/dev/null
|
|
log "${SU_DISTRO:-?}: family=$family, fixture ready after $((SECONDS - t0))s ($(. /etc/os-release && printf '%s' "$PRETTY_NAME"), bash $BASH_VERSION)"
|
|
|
|
TMPDIR=$(mktemp -d /tmp/su-e2e.XXXXXX)
|
|
export TMPDIR
|
|
|
|
# bats needs find(1) to expand a directory argument; openSUSE base images may lack it
|
|
if command -v find >/dev/null 2>&1; then
|
|
targets=(tests/e2e)
|
|
else
|
|
targets=(tests/e2e/*.bats)
|
|
fi
|
|
status=0
|
|
bash tests/vendor/bats-core/bin/bats --tap "${targets[@]}" || status=$?
|
|
log "${SU_DISTRO:-?}: bats exited $status after $((SECONDS - t0))s"
|
|
exit "$status"
|