Files
kvitt/infra/dev/copy-google-services.sh

20 lines
922 B
Bash
Executable File

#!/usr/bin/env bash
# Copies the Firebase config (both Android clients, se.hagstedt.kvitt and se.hagstedt.kvitt.debug) from
# infra/secrets/google-services.json to android/app/google-services.json in this checkout. Both are git-ignored.
# Usage: infra/dev/copy-google-services.sh [source checkout] (default: this checkout; in a worktree, pass the main checkout)
set -euo pipefail
# shellcheck source=lib.sh
. "$(dirname "$0")/lib.sh"
src_root="${1:-$repo_root}"
src="$src_root/infra/secrets/google-services.json"
dst="$repo_root/android/app/google-services.json"
[[ -f "$src" ]] || die "$src not found (created by the M2c-dev Firebase setup, SPEC §10.7)."
git -C "$repo_root" check-ignore -q "android/app/google-services.json" \
|| die "android/app/google-services.json is not git-ignored; refusing to copy."
mkdir -p "$(dirname "$dst")"
cp "$src" "$dst"
chmod 600 "$dst"
echo "Copied google-services.json to $dst"