fix: docker installs from Docker, never brew; VM guest rows
The docker-ce, buildx and compose rows named apt packages that only exist in Docker's own repository, so on stock Ubuntu they fell through to brew. They are a script channel now: get.docker.com downloaded to the run's workdir and run from the file on Linux, Docker Desktop's DMG installer on macOS. One install serves all three rows; the plugin rows report its outcome. Also adds virt/guest-agent and virt/spice-vdagent, with tests and README.
This commit is contained in:
1 parent
a28a831a14
commit
a538ab75dd
7 files changed
+365
-31
No files matched your search
@@ -423,6 +423,14 @@ SUDO=
|
||||
if [ "$(id -u)" != 0 ] && command -v sudo >/dev/null 2>&1; then SUDO=sudo; fi
|
||||
FAILED=$STATE/.failed.$$
|
||||
APT_UPDATED=0
|
||||
# The docker group is three manifest rows and ONE install: get.docker.com lays
|
||||
# down the engine and both plugins together. docker/docker-ce does the work (see
|
||||
# install_bespoke, which puts it in front of its own plugins) and records the
|
||||
# OUTCOME here -- empty, `ok` or `fail` -- so the two rows behind it can say what
|
||||
# actually happened rather than claiming a success that never occurred. A
|
||||
# recorded outcome rather than a re-probe, so a dry run prints the commands once
|
||||
# instead of three times, and a broken network is not retried three times.
|
||||
DOCKER_SCRIPTED=
|
||||
|
||||
# One private directory per run, for everything this script downloads.
|
||||
#
|
||||
@@ -615,8 +623,10 @@ apt_update_once() {
|
||||
# That is what "apt-then-brew" has to mean in practice, and it is the difference
|
||||
# between 34 packages installed and 0.
|
||||
# `apt-cache show` is not an existence test. A name that exists only because
|
||||
# something else Conflicts/Replaces it -- docker-ce on a stock Ubuntu is the
|
||||
# live example -- prints nothing and exits 0, so the batch kept it, apt refused
|
||||
# something else Conflicts/Replaces it, or that is published from a vendor
|
||||
# repository nothing here configures -- nvidia-container-toolkit on a stock
|
||||
# Ubuntu is the live example, and docker-ce was until the docker rows moved to
|
||||
# get.docker.com -- prints nothing and exits 0, so the batch kept it, apt refused
|
||||
# the whole batch with "has no installation candidate", and the brew column was
|
||||
# never consulted. Ask for the installation candidate instead, which is the
|
||||
# thing `apt-get install` will actually go looking for.
|
||||
@@ -799,6 +809,15 @@ install_deb() {
|
||||
install_bespoke() {
|
||||
bsp=$(norm "$2")
|
||||
[ -n "$bsp" ] || return 0
|
||||
# The docker group is three rows and one install, and the row that performs
|
||||
# it is the row the log should name. `keys` hands this list over sorted, so
|
||||
# docker-buildx led and the engine appeared to be a consequence of its own
|
||||
# plugin. Put the engine back in front of them.
|
||||
# shellcheck disable=SC2086
|
||||
case " $bsp " in
|
||||
*" docker/docker-ce "*)
|
||||
bsp="docker/docker-ce $(printf '%s\n' $bsp | grep -vx docker/docker-ce | tr '\n' ' ')" ;;
|
||||
esac
|
||||
head_ "$1"
|
||||
for key in $bsp; do
|
||||
case $key in
|
||||
@@ -913,6 +932,118 @@ install_bespoke() {
|
||||
# a failure invented by the dry run itself.
|
||||
[ "$DRYRUN" -eq 1 ] || have brew \
|
||||
|| note_fail "$key" "brew still not found after installing it" ;;
|
||||
docker/docker-ce|docker/docker-buildx|docker/docker-compose)
|
||||
# Docker publishes its own apt repository and ships nothing to
|
||||
# Ubuntu's. `apt-cache policy docker-ce` on a stock box reports
|
||||
# `Candidate: (none)`, so install_apt's unknown-name path fired and
|
||||
# consulted the brew column — for a system daemon, on Linux. That is
|
||||
# how brew got into the docker story at all, and it is why these
|
||||
# rows are a script channel now: the vendor's own installer is the
|
||||
# supported route, it configures the repository first, and it
|
||||
# installs docker-ce, docker-ce-cli, containerd.io,
|
||||
# docker-buildx-plugin AND docker-compose-plugin in a single pass.
|
||||
#
|
||||
# So the three rows are one install. The picker still shows three
|
||||
# members and still carries the group's invasive warning, and
|
||||
# `@needs gpu/container-toolkit docker` still pulls all three in —
|
||||
# but docker/docker-ce is the row that runs it and the other two
|
||||
# report ITS outcome. Saying "covered by" after a failed install
|
||||
# would turn one honest failure into two invented successes.
|
||||
#
|
||||
# The compose that lands is the PLUGIN (`docker compose`). The
|
||||
# standalone docker-compose v1 binary is deprecated and is never
|
||||
# fetched, from apt, brew or anywhere else.
|
||||
if [ -n "$DOCKER_SCRIPTED" ]; then
|
||||
if [ "$DOCKER_SCRIPTED" = ok ]; then
|
||||
say " $key: covered by the docker group's single install"
|
||||
else
|
||||
note_fail "$key" "not attempted — the docker install failed"
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
# `have docker` on its own is a false proxy for this group. docker.io,
|
||||
# podman-docker and a hand-dropped binary all satisfy it while
|
||||
# shipping NEITHER plugin, so ticking the buildx or compose row would
|
||||
# have quietly installed nothing. Ask for what the three rows between
|
||||
# them deliver. A partial match is a reason to run the installer, not
|
||||
# to skip it: the script upgrades and completes an existing install.
|
||||
# Resolved through find_tool, like everything else here, because a
|
||||
# docker installed a moment ago is not on this process's PATH.
|
||||
if [ "$DRYRUN" -eq 0 ] && dk=$(find_tool docker) \
|
||||
&& "$dk" buildx version >/dev/null 2>&1 \
|
||||
&& "$dk" compose version >/dev/null 2>&1; then
|
||||
say " docker with buildx and compose already present — leaving it"
|
||||
DOCKER_SCRIPTED=ok; continue
|
||||
fi
|
||||
case $(uname -s) in
|
||||
Darwin)
|
||||
# No brew cask either. Docker Desktop's disk image carries an
|
||||
# official CLI installer -- Contents/MacOS/install -- which is
|
||||
# the documented unattended route and the only one that sets up
|
||||
# the privileged helper without a human dragging an icon.
|
||||
case $(uname -m) in
|
||||
aarch64|arm64) a=arm64 ;;
|
||||
x86_64|amd64) a=amd64 ;;
|
||||
*) note_fail "$key" "no Docker Desktop build for $(uname -m)"
|
||||
DOCKER_SCRIPTED=fail; continue ;;
|
||||
esac
|
||||
workdir || { note_fail "$key" "no private working directory"
|
||||
DOCKER_SCRIPTED=fail; continue; }
|
||||
# Same `[ -s ]` as the tarball handlers, and for the same
|
||||
# reason: nothing reaches hdiutil that was not verified to have
|
||||
# arrived. A truncated proxy error page mounts as garbage.
|
||||
run_sh "curl -fsSL 'https://desktop.docker.com/mac/main/$a/Docker.dmg' -o '$WORKDIR/Docker.dmg' && [ -s '$WORKDIR/Docker.dmg' ]" \
|
||||
|| { note_fail "$key" "Docker Desktop download failed or arrived empty"
|
||||
DOCKER_SCRIPTED=fail; continue; }
|
||||
# -mountpoint is the security-relevant flag here, not a tidiness
|
||||
# one. Without it hdiutil mounts at /Volumes/Docker -- or at
|
||||
# "/Volumes/Docker 1" when that name is already taken, and STILL
|
||||
# exits 0. The installer line would then run whatever happens to
|
||||
# be sitting at the fixed /Volumes/Docker, AS ROOT, and anyone
|
||||
# able to mount an image gets to choose what that is. Mounting
|
||||
# read-only inside this run's own 700 directory makes the thing
|
||||
# that runs as root exactly the image just downloaded.
|
||||
run_sh "hdiutil attach -nobrowse -readonly -quiet -mountpoint '$WORKDIR/mnt' '$WORKDIR/Docker.dmg'" \
|
||||
|| { note_fail "$key" "could not mount Docker.dmg"
|
||||
DOCKER_SCRIPTED=fail; continue; }
|
||||
dk_rc=0
|
||||
run_sh "${SUDO:+$SUDO }'$WORKDIR/mnt/Docker.app/Contents/MacOS/install' --accept-license" || dk_rc=1
|
||||
# Detach whatever happened above, or the next run inherits a
|
||||
# mount it did not make.
|
||||
run_sh "hdiutil detach -quiet '$WORKDIR/mnt'" || warn "could not unmount $WORKDIR/mnt"
|
||||
[ "$dk_rc" -eq 0 ] || { note_fail "$key" "the Docker Desktop installer failed"
|
||||
DOCKER_SCRIPTED=fail; continue; }
|
||||
DOCKER_SCRIPTED=ok ;;
|
||||
*)
|
||||
# NOT fetched straight into a shell through a pipe. POSIX sh has
|
||||
# no pipefail, so that form exits with the SHELL's status: a
|
||||
# download that 404s or dies half way through is a 0, note_fail
|
||||
# is unreachable, and whatever fragment did arrive has already
|
||||
# been executed as root. Download to a file this run owns, check
|
||||
# it arrived non-empty, then run that file -- the same shape, and
|
||||
# the same reason, as the three tarball handlers above.
|
||||
workdir || { note_fail "$key" "no private working directory"
|
||||
DOCKER_SCRIPTED=fail; continue; }
|
||||
run_sh "curl -fsSL https://get.docker.com -o '$WORKDIR/get-docker.sh' && [ -s '$WORKDIR/get-docker.sh' ]" \
|
||||
|| { note_fail "$key" "the Docker install script download failed or arrived empty"
|
||||
DOCKER_SCRIPTED=fail; continue; }
|
||||
# get.docker.com escalates on its own when it is not run as root,
|
||||
# but this box may have no sudo at all and dotup already knows
|
||||
# which -- so pass it explicitly and keep the command that is
|
||||
# printed identical to the one that runs.
|
||||
run_sh "${SUDO:+$SUDO }sh '$WORKDIR/get-docker.sh'" \
|
||||
|| { note_fail "$key" "the official Docker install script failed"
|
||||
DOCKER_SCRIPTED=fail; continue; }
|
||||
DOCKER_SCRIPTED=ok ;;
|
||||
esac
|
||||
# core/brew's post-condition, for the same reason: an installer that
|
||||
# exits 0 without leaving the binary behind is a failure THIS run
|
||||
# should name, not one the next command stumbles into. Only after
|
||||
# something actually ran -- under --print nothing did.
|
||||
if [ "$DRYRUN" -eq 0 ] && [ "$DOCKER_SCRIPTED" = ok ] && ! have docker; then
|
||||
note_fail "$key" "docker still not found after the installer ran"
|
||||
DOCKER_SCRIPTED=fail
|
||||
fi ;;
|
||||
core/uv)
|
||||
if have uv && [ "$DRYRUN" -eq 0 ]; then say " uv already present — leaving it"; continue; fi
|
||||
run_sh "curl -LsSf https://astral.sh/uv/install.sh | sh" || note_fail "$key" "installer failed" ;;
|
||||
|
||||
Reference in new issue
Block a user