Files
davidandClaude Opus 5.5 f92dbcb3bd Add an installer and update command
curl -fsSL https://federated.sh/mac | bash

install.sh checks the Mac (macOS 13+, not root, internet; warns if the
account isn't an administrator), then downloads the latest commit as an
archive from Gitea, as macOS has no git without the Command Line Tools.
It installs into ~/.local/share/federated-connector/connector, links
configure and update into ~/.local/bin and puts that on PATH at the top
of ~/.zprofile and ~/.bash_profile, then offers to run configure. Piped
into bash, it runs only once read in full, and asks from /dev/tty.

The folder never moves, so the backup and storage jobs and the Federated
Backup app (with its Full Disk Access) keep pointing at it. update shows
the commits since the installed one and swaps the new files in with two
renames.

If configure ran from another folder before, the installer says what
still runs from there; backup and storage now show as to do until
they're set up again from the installed copy.

smoketest: 05-install pipes install.sh into bash with the working copy,
runs update, then installs the published version from Gitea.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 09:21:17 -07:00

38 lines
1.7 KiB
Bash

# shellcheck shell=bash
DESCRIPTION="The scripts parse with macOS' bash 3.2, and the macOS tools they use are there"
TIER=quick
# Patterns, expanded in CONNECTOR
SCRIPTS=("configure" "install.sh" "update" "configure.d/*.sh" "configure.d/lib/*.sh" "system/backup" "system/backup-env.sh"
"system/storage-mount" "sandbox/agent" "smoketest/run" "smoketest/lib/runner.sh")
# Commands that macOS doesn't have, or that would start installing the
# Command Line Tools if called (python3), outside comments
uses_missing_tools() {
(cd "$CONNECTOR" && grep -nE '(^|[^#[:alnum:]_-])(python3|jq|gsed|gawk|timeout|realpath|mapfile|readarray|declare -A)([^[:alnum:]_-]|$)' \
configure install.sh update configure.d/*.sh configure.d/lib/*.sh system/backup system/storage-mount sandbox/agent \
| grep -vE ':[[:space:]]*#')
}
scenario() {
local pattern file tool
check_eq "/bin/bash is 3.2" "3.2" "${BASH_VERSINFO[0]}.${BASH_VERSINFO[1]}"
for pattern in "${SCRIPTS[@]}"; do
# shellcheck disable=SC2231
for file in "$CONNECTOR"/$pattern; do
check "parses: ${file#"$CONNECTOR"/}" /bin/bash -n "$file"
done
done
check_not "no tools macOS doesn't have (python3, jq, timeout, mapfile...)" uses_missing_tools
for tool in osascript plutil xmllint security profiles dns-sd sips osacompile codesign \
pkgutil spctl hdiutil ditto installer launchctl shasum bunzip2 unzip nc md5 uuidgen \
openssl scutil curl diskutil base64; do
check "has $tool" command -v "$tool"
done
if command -v brew > /dev/null || [ -x /opt/homebrew/bin/brew ]; then
skip "This image has Homebrew, so the download paths for tools Homebrew already has aren't tested"
else
check "no Homebrew, as on a new Mac" true
fi
}