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>
52 lines
2.0 KiB
Bash
52 lines
2.0 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Purpose : Point restic at your backup in your Nextcloud files. Sourced by
|
|
# system/backup and configure.d/20-backup.sh, and by you (in bash
|
|
# or zsh) to look at or restore from a backup:
|
|
#
|
|
# source <this folder>/backup-env.sh
|
|
# restic snapshots
|
|
#
|
|
# To use another computer's backup, name its folder:
|
|
#
|
|
# source <this folder>/backup-env.sh .backup-<name>
|
|
#
|
|
# restic reaches Nextcloud over WebDAV through rclone. The Nextcloud app
|
|
# password and the backup's passphrase are in your login keychain. This is
|
|
# sourced by zsh too, so it uses no bash-only syntax.
|
|
|
|
BACKUP_CONF="$HOME/Library/Application Support/Federated Connector/backup.conf"
|
|
BACKUP_KEYCHAIN="federated-connector-backup"
|
|
FC_TOOLS="$HOME/.local/share/federated-connector"
|
|
PATH="$FC_TOOLS/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
|
|
export PATH
|
|
|
|
# A secret from the keychain: nextcloud:<webdav> (app password) or
|
|
# passphrase:<webdav>/<folder>
|
|
backup_secret() {
|
|
security find-generic-password -s "$BACKUP_KEYCHAIN" -a "$1" -w 2> /dev/null
|
|
}
|
|
|
|
if [ -f "$BACKUP_CONF" ]; then
|
|
. "$BACKUP_CONF"
|
|
BACKUP_DIR="${1:-$BACKUP_DIR}"
|
|
|
|
export RCLONE_WEBDAV_URL="$BACKUP_WEBDAV"
|
|
# BACKUP_VENDOR is only set by the smoketest, whose stand-in for Nextcloud
|
|
# is a plain WebDAV server
|
|
export RCLONE_WEBDAV_VENDOR="${BACKUP_VENDOR:-nextcloud}"
|
|
export RCLONE_WEBDAV_USER="$BACKUP_USER"
|
|
RCLONE_WEBDAV_PASS="$(backup_secret "nextcloud:$BACKUP_WEBDAV" | rclone obscure - 2> /dev/null)"
|
|
export RCLONE_WEBDAV_PASS
|
|
export RESTIC_REPOSITORY="rclone::webdav:$BACKUP_DIR"
|
|
|
|
# Without a passphrase in the keychain, e.g. for another computer's backup,
|
|
# restic asks for it
|
|
unset RESTIC_PASSWORD_COMMAND
|
|
if [ -n "$(backup_secret "passphrase:$BACKUP_WEBDAV/$BACKUP_DIR")" ]; then
|
|
export RESTIC_PASSWORD_COMMAND="security find-generic-password -s $BACKUP_KEYCHAIN -a passphrase:$BACKUP_WEBDAV/$BACKUP_DIR -w"
|
|
fi
|
|
else
|
|
echo "Backups aren't set up. Run: configure backup" >&2
|
|
fi
|