The macOS wrapper starts the container service itself when it is down (from dev 685ce778cf34)

This commit is contained in:
ack committed 2026-10-19 00:17:22 +02:00
1 parent 35ca469e4d
commit d09909a111
3 files changed
+26 -10

No files matched your search

+15 -2
View File
@@ -7,8 +7,10 @@
#
# Then open a new terminal and use `ktext`, `kdesc`, `kdiag` like normal
# commands. Requires Apple Silicon + macOS 26 or later, with Apple's
# `container` runtime installed and its service started (`container system
# start`). Install `container` from the signed .pkg at
# `container` runtime installed and its service started once by hand
# (`container system start`, which sets up its kernel the first time); after
# that the wrapper starts the service itself whenever it is down, as it is
# after every restart. Install `container` from the signed .pkg at
# https://github.com/apple/container/releases (NOT Homebrew). See
# doc/install/macos_container_install.md for the full guide.
# -----------------------------------------------------------------------------
@@ -17,8 +19,18 @@
# native arm64 build, so no --platform / --rosetta is needed.
KLAMMERTEXT_IMAGE="${KLAMMERTEXT_IMAGE:-akopra/klammertext:latest}"
# The container service does not survive a restart, and without it every
# command fails with a connection error. So start it when it is down
# (`container system status` exits 1 then) before anything needs it.
_klammertext_service() {
container system status >/dev/null 2>&1 \
|| container system start >/dev/null 2>&1 \
|| { echo "klammertext: the container service did not start; run \`container system start\` to see why" >&2; return 1; }
}
_klammertext_run() {
local cmd="$1"; shift
_klammertext_service || return 1
container run --rm \
-v "$PWD:/work" -w /work \
"$KLAMMERTEXT_IMAGE" "$cmd" "$@"
@@ -33,6 +45,7 @@ kdiag() { _klammertext_run kdiag "$@"; }
# Download or update to the latest published image (delete first so the moving
# `latest` tag is definitely refreshed).
klammertext-update() {
_klammertext_service || return 1
container image delete "$KLAMMERTEXT_IMAGE" 2>/dev/null
container image pull "$KLAMMERTEXT_IMAGE"
}