aboutsummaryrefslogtreecommitdiff
path: root/tests/checks/apk.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/checks/apk.sh')
-rwxr-xr-xtests/checks/apk.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/checks/apk.sh b/tests/checks/apk.sh
new file mode 100755
index 0000000..5acb479
--- /dev/null
+++ b/tests/checks/apk.sh
@@ -0,0 +1,41 @@
+#!/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