style: format deployment helpers
Build web service image / build (push) Successful in 40s

This commit is contained in:
2026-09-12 12:05:24 +08:00
parent 0d29b828bb
commit 97cfba7f01
4 changed files with 121 additions and 47 deletions
+10 -4
View File
@@ -7,10 +7,16 @@ if [ "$#" -ne 2 ]; then
fi
certificate=$1
list=$2
[ -f "$certificate" ] || { echo "certificate does not exist: $certificate" >&2; exit 1; }
[ -f "$certificate" ] || {
echo "certificate does not exist: $certificate" >&2
exit 1
}
fingerprint=$(openssl x509 -in "$certificate" -outform DER | sha256sum | awk '{print $1}')
[ "${#fingerprint}" -eq 64 ] || { echo "could not calculate certificate fingerprint" >&2; exit 1; }
[ "${#fingerprint}" -eq 64 ] || {
echo "could not calculate certificate fingerprint" >&2
exit 1
}
mkdir -p "$(dirname "$list")"
lock="$list.lock"
exec 9>"$lock"
@@ -22,9 +28,9 @@ fi
temporary="${list}.tmp.$$"
trap 'rm -f "$temporary"' EXIT
if [ -f "$list" ]; then
cat "$list" > "$temporary"
cat "$list" >"$temporary"
fi
printf '%s\n' "$fingerprint" >> "$temporary"
printf '%s\n' "$fingerprint" >>"$temporary"
chmod 600 "$temporary"
mv -f "$temporary" "$list"
printf '%s\n' "$fingerprint"