aboutsummaryrefslogtreecommitdiff
#!/bin/sh
set -eu


while getopts 'k:' flag; do
	case "$flag" in
		k)
			KEY="$OPTARG"
			;;
		*)
			exit 2
			;;
	esac
done
shift $((OPTIND - 1))

if [ -z "${KEY:-}" ]; then
	echo 'Missing "-k KEY" argument.' >&2
	exit 2
fi

set -x

REPO="$1/alpine"

if command -v remembering; then
	echo 'remembering(1) is already installed.' >&2
	exit 1
fi

if apk info remembering; then
	echo 'remembering(1) is already in apk(8) list.' >&2
	exit 1
fi

wget -qO- "$REPO"/"$KEY".rsa.pub | doas tee /etc/apk/keys/"$KEY".rsa.pub
printf '%s\n' "$REPO" | doas tee -a /etc/apk/repositories
doas apk add remembering

remembering --help
remembering -V