Set up a Mac for a Federated Core, like CoreDesktop's configure

A macOS counterpart of CoreDesktop's configure, with the same drop-in
items in configure.d/:

- core: Mail, Calendar and Contacts through a configuration profile,
  Superpanel as an app, Nextcloud files through the Nextcloud app, and
  Element; with test-and-fix, password change and removal
- tailscale: join the Core's network through headscale
- backup: restic to Nextcloud through rclone, run by launchd through an
  app that can be given Full Disk Access
- storage: SMB shares mounted the way Finder does, again at login and
  on network changes
- agents, claude, opencode, hermes, sandbox: install the agents and run
  them in Anthropic's sandbox runtime (Seatbelt on macOS)
- ai-servers: LLM servers on this Mac or the network, for the agents

Apps and tools macOS lacks are offered for download, checked against
their makers' Team IDs and notarization, or published SHA-256 sums.
Everything runs on macOS' bash 3.2 with only built-in tools.

smoketest/ runs scenarios in fresh macOS VMs with Tart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 08:34:42 -07:00
co-authored by Claude Opus 5.5
commit 08e6b2ee4f
45 changed files with 4517 additions and 0 deletions
+100
View File
@@ -0,0 +1,100 @@
#!/bin/bash
#
# Purpose : Run one smoketest scenario inside the VM (smoketest/run starts
# this in the desktop session). Prints ok, FAIL or skip for each
# check, and exits 1 if any failed.
#
# Usage: runner.sh <scenario file>
#
# A scenario sets DESCRIPTION and TIER and defines `scenario`, which calls the
# checks below. It runs with what configure gives items (CONNECTOR, CONF_DIR,
# confirm...), answering yes to every question, so it can source items and
# call their functions.
CONNECTOR="$HOME/connector"
CONF_DIR="$HOME/Library/Application Support/Federated Connector"
COMPUTER="$(scutil --get ComputerName 2> /dev/null || hostname -s)"
RED=$'\033[31m' GREEN=$'\033[32m' YELLOW=$'\033[33m' BOLD=$'\033[1m' RESET=$'\033[0m'
export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
export TMPDIR="${TMPDIR:-$(getconf DARWIN_USER_TEMP_DIR)}"
FAILURES=0
# configure's questions, answered yes; ask takes the default
confirm() { echo "$1 [y/N] y"; return 0; }
confirm_yes() { echo "$1 [Y/n] y"; return 0; }
ask() { printf -v "$1" '%s' "$3"; }
# wait_until without reading stdin: try every 2 seconds for up to $1
wait_until() {
local seconds="$1" waited=0
shift
while [ "$waited" -lt "$seconds" ]; do
"$@" && return 0
sleep 2
waited=$((waited + 2))
done
"$@"
}
# check <description> <command...>: ok if the command succeeds
check() {
local description="$1" output
shift
if output="$("$@" 2>&1)"; then
echo "${GREEN}ok$RESET $description"
else
echo "${RED}FAIL$RESET $description"
[ -n "$output" ] && printf '%s\n' "$output" | tail -n 15 | sed 's/^/ /'
FAILURES=$((FAILURES + 1))
fi
}
# check_not <description> <command...>: ok if the command fails
check_not() {
local description="$1"
shift
if "$@" > /dev/null 2>&1; then
echo "${RED}FAIL$RESET $description (it succeeded)"
FAILURES=$((FAILURES + 1))
else
echo "${GREEN}ok$RESET $description"
fi
}
# check_eq <description> <expected> <actual>
check_eq() {
if [ "$2" = "$3" ]; then
echo "${GREEN}ok$RESET $1"
else
echo "${RED}FAIL$RESET $1"
echo " expected: $2"
echo " got: $3"
FAILURES=$((FAILURES + 1))
fi
}
skip() {
echo "${YELLOW}skip$RESET $1"
}
# A step whose output is worth seeing, run as it is
step() {
echo "-- $*"
}
# The VM's login keychain is open in the desktop session; ssh's wouldn't be
security unlock-keychain -p admin "$HOME/Library/Keychains/login.keychain-db" 2> /dev/null
cd "$HOME" || exit 1
# shellcheck disable=SC1090
source "$1" || { echo "Couldn't read $1"; exit 1; }
echo "$DESCRIPTION"
echo "(macOS $(sw_vers -productVersion), $(uname -m))"
scenario
echo
if [ $FAILURES -eq 0 ]; then
echo "${GREEN}All checks passed.$RESET"
else
echo "${RED}$FAILURES check(s) failed.$RESET"
exit 1
fi