signing infrastructure
[pharext/replicator.pharext.org] / bin / missing-sigs
1 #!/bin/sh
2 CWD=$(dirname "$0")
3 SIGS="asc sig"
4 PHARS="$CWD/../public/phars"
5
6 test -d "$PWD" || PwD=$(pwd)
7
8 checksig() {
9 local phar
10 local sigs
11
12 phar="$1"
13 sigs=$(printf "%s" "$phar" | sed 's/phars\//sigs\//')
14
15 for sig in $SIGS; do
16 local name
17 local file
18 local sign
19
20 if ! test -f "$sigs.$sig"; then
21 name=$(basename "$(dirname \"$phar\")")
22 file=$(realpath --relative-to="$PWD" "$phar")
23
24 case "$sig" in
25 asc)
26 sign=$(realpath --relative-to="$PWD" "$CWD/gpg-sign")
27 ;;
28 sig)
29 sign=$(realpath --relative-to="$PWD" "$CWD/rsa-sign")
30 ;;
31 esac
32 echo "'$sign'" "'$name'" "'$file'"
33 fi
34 done
35 }
36 checksigs() {
37 local phar
38 while read phar; do
39 checksig $phar
40 done
41 }
42
43 find $PHARS -type f -name '*.ext.phar*' | checksigs