firefox-db2pem.sh: add macOS support, tidy-ups

Cherry-picked from #19076
Closes #19086
This commit is contained in:
Viktor Szakats 2025-10-15 19:46:35 +02:00
parent c8aaa5d2f2
commit da06621d61
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201

View file

@ -32,7 +32,11 @@
set -eu
db=$(ls -1d "$HOME"/.mozilla/firefox/*default*)
if [ -d "$HOME/Library/Application Support"/Firefox/Profiles ]; then
db=$(ls -1d "$HOME/Library/Application Support"/Firefox/Profiles/*default*)
else
db=$(ls -1d "$HOME"/.mozilla/firefox/*default*)
fi
out="${1:-}"
if test -z "$out"; then
@ -55,7 +59,7 @@ certutil -L -h 'Builtin Object Token' -d "$db" | \
grep ' *[CcGTPpu]*,[CcGTPpu]*,[CcGTPpu]* *$' | \
sed -e 's/ *[CcGTPpu]*,[CcGTPpu]*,[CcGTPpu]* *$//' -e 's/\(.*\)/"\1"/' | \
sort | \
while read -r nickname; \
do echo "$nickname" | sed -e "s/Builtin Object Token://g"; \
echo "$nickname" | xargs -I{} certutil -d "$db" -L -a -n -- {} ; \
while read -r nickname; do
echo "$nickname" | sed 's/Builtin Object Token://g'
echo "$nickname" | xargs -I{} certutil -d "$db" -L -a -n {}
done >> "$out"