#!/usr/bin/env bash # First admin invite on the Kvitt Pi (SPEC FR-1, ยง10.4). Run ON the Pi once, after install.sh: /opt/kvitt/bootstrap.sh # Prints the invite code, link and expiry. Exit 2 from the server means the database is already initialised. set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=lib.sh . "$here/lib.sh" set +e compose exec -T server kvitt-server bootstrap status=$? set -e case "$status" in 0) say "Open the link on the owner's phone (or enter the code on the pairing screen)." ;; 2) say "Already initialised: no new invite. Extra devices: docker compose exec server kvitt-server pair-device --user " ;; *) die "bootstrap exited $status (docker compose logs server)" ;; esac