Verified Commit 2d968cff authored by Štěpán Henek's avatar Štěpán Henek 🌩

turris-cagen: certificate list fix

parent 3390a0c2
......@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=turris-cagen
PKG_VERSION:=3
PKG_VERSION:=4
PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz>
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
......
......@@ -31,16 +31,23 @@ echo "status: ready"
echo "## Certs:"
if [ -f notes.txt ]; then
while read line; do
id=$(echo $line | sed 's/^\([0-9A-Za-z][0-9A-Za-z]\).*$/\1/')
name=$(echo $line | sed 's/^[0-9A-Za-z][0-9A-Za-z] [^ ]* \([^ ]*\)$/\1/')
if grep -q "^R\t[0-9]*Z\t[0-9]*Z\t${id}.*CN=${name}.*" index.txt ; then
line="$line revoked"
elif grep -q "^V\t[0-9]*Z\t\t$id.*CN=${name}.*" index.txt ; then
line="$line valid"
else
line="$line generating"
fi
echo $line
done < notes.txt
awk -F '(\t| )' '
# from notes.txt
ARGIND == 1 {
result[$1]=$1 " " $2 " " $3;
status[$1]="generating";
}
# from index.txt
ARGIND == 2 && $1 == "V" {
status[$4]="valid"
}
# from index.txt
ARGIND == 2 && $1 == "R" {
status[$4]="revoked"
}
END {
for (id in result)
print result[id] " " status[id]
}
' notes.txt index.txt | sort
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment