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>
This commit is contained in:
@@ -49,6 +49,7 @@ Each scenario runs on a fresh clone of Cirrus Labs' **vanilla** macOS image (def
|
||||
| Scenario | Checks |
|
||||
|----------|--------|
|
||||
| `00-environment` | Every script parses with `/bin/bash` 3.2. None uses a tool macOS lacks: no python3, which would start installing the Command Line Tools, and no jq, timeout or mapfile. The macOS tools used are all there. |
|
||||
| `05-install` | `install.sh` piped into bash, as `curl \| bash` runs it, with the working copy. The commands are in `~/.local/bin` and a login zsh finds them, and `update` swaps in a fresh copy without leaving staging folders behind. Then the published version installs from Gitea, records its commit, and `update` says it is up to date. |
|
||||
| `10-configure` | `configure --help`, `--list` (nothing on stderr; agent sign-ins hidden until installed), the menu, and an item's questions |
|
||||
| `20-json-keychain` | `json_get` and `json_edit` through real `osascript`; saving, replacing and deleting keychain secrets |
|
||||
| `30-core-local` | The profile: valid, passwords and names survive escaping, stable payload UUIDs, and the format of `profiles show -output stdout-xml`. Superpanel's app: built, re-signed after the icon changes, and it opens. Element's config, and `nextcloud.cfg` matching |
|
||||
|
||||
@@ -3,14 +3,14 @@ DESCRIPTION="The scripts parse with macOS' bash 3.2, and the macOS tools they us
|
||||
TIER=quick
|
||||
|
||||
# Patterns, expanded in CONNECTOR
|
||||
SCRIPTS=("configure" "configure.d/*.sh" "configure.d/lib/*.sh" "system/backup" "system/backup-env.sh"
|
||||
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 configure.d/*.sh configure.d/lib/*.sh system/backup system/storage-mount sandbox/agent \
|
||||
configure install.sh update configure.d/*.sh configure.d/lib/*.sh system/backup system/storage-mount sandbox/agent \
|
||||
| grep -vE ':[[:space:]]*#')
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# shellcheck shell=bash
|
||||
DESCRIPTION="install.sh piped into bash, then update: the working copy, then the real one from Gitea"
|
||||
TIER=quick
|
||||
|
||||
INSTALLED="$HOME/.local/share/federated-connector/connector"
|
||||
RAW="https://gitea.federated.computer/Federated_Computer/connector-macos/raw/branch/main/install.sh"
|
||||
|
||||
# As `curl ... | bash` runs it: the script on stdin, no terminal to answer
|
||||
# questions (so it doesn't offer to run configure)
|
||||
install_piped() {
|
||||
cat "$1" | /bin/bash
|
||||
}
|
||||
|
||||
login_zsh_finds() {
|
||||
[ "$(zsh -lc "command -v $1" 2> /dev/null)" = "$HOME/.local/bin/$1" ]
|
||||
}
|
||||
|
||||
lists_from_installed() {
|
||||
zsh -lc 'configure --list' < /dev/null | grep -qE '^(to do|done) +core '
|
||||
}
|
||||
|
||||
swaps() {
|
||||
touch "$INSTALLED/marker-from-before"
|
||||
"$HOME/.local/bin/update" < /dev/null && [ ! -e "$INSTALLED/marker-from-before" ] || return 1
|
||||
# No staging folders left over from the swap
|
||||
set -- "$(dirname "$INSTALLED")"/.connector-*
|
||||
[ ! -e "$1" ]
|
||||
}
|
||||
|
||||
up_to_date() {
|
||||
"$HOME/.local/bin/update" < /dev/null | grep -q 'is up to date'
|
||||
}
|
||||
|
||||
scenario() {
|
||||
step "The working copy, through install.sh"
|
||||
check "install.sh, piped into bash" env FEDERATED_CONNECTOR_SOURCE="$CONNECTOR" bash -c \
|
||||
"cat '$CONNECTOR/install.sh' | /bin/bash"
|
||||
check "it's in ~/.local/share/federated-connector/connector" test -x "$INSTALLED/configure"
|
||||
check "a login zsh finds configure in ~/.local/bin" login_zsh_finds configure
|
||||
check "...and update" login_zsh_finds update
|
||||
check "configure --list runs from there" lists_from_installed
|
||||
check_eq "update --version" "Federated Connector local" "$("$HOME/.local/bin/update" --version)"
|
||||
check "update swaps in a fresh copy and leaves nothing behind" env FEDERATED_CONNECTOR_SOURCE="$CONNECTOR" bash -c \
|
||||
"$(declare -f swaps); INSTALLED='$INSTALLED'; swaps"
|
||||
check_eq "the PATH lines are in ~/.zprofile once" 1 "$(grep -c 'Federated Connector commands >>>' "$HOME/.zprofile")"
|
||||
|
||||
step "The published version, from Gitea"
|
||||
check "curl -fsSL <install.sh on Gitea> | bash" bash -c "curl -fsSL '$RAW' | /bin/bash"
|
||||
check "it records the commit" grep -qE '^[0-9a-f]{40}$' "$INSTALLED/.version"
|
||||
check "update says it's up to date" up_to_date
|
||||
}
|
||||
Reference in New Issue
Block a user