eid-mw: fix and improve eid-nssdb helper script
Now works. Good to know no-one else is using this :-)
This commit is contained in:
parent
8eef55b0e0
commit
2454b943d7
@ -3,12 +3,13 @@
|
|||||||
rootdb="/etc/pki/nssdb"
|
rootdb="/etc/pki/nssdb"
|
||||||
userdb="$HOME/.pki/nssdb"
|
userdb="$HOME/.pki/nssdb"
|
||||||
dbentry="Belgium eID"
|
dbentry="Belgium eID"
|
||||||
libfile="/run/current-system/sw/libbeidpkcs11.so"
|
libfile="/run/current-system/sw/lib/libbeidpkcs11.so"
|
||||||
|
|
||||||
dbdir="$userdb"
|
dbdir="$userdb"
|
||||||
|
|
||||||
case "$1" in
|
while true; do
|
||||||
--help) cat << EOF
|
case "$1" in
|
||||||
|
--help|"") cat << EOF
|
||||||
(Un)register $dbentry with NSS-compatible browsers.
|
(Un)register $dbentry with NSS-compatible browsers.
|
||||||
|
|
||||||
Usage: `basename "$0"` [OPTION] ACTION [LIBRARY]
|
Usage: `basename "$0"` [OPTION] ACTION [LIBRARY]
|
||||||
@ -27,14 +28,20 @@ Actions:
|
|||||||
Default arguments if unspecified:
|
Default arguments if unspecified:
|
||||||
LIBRARY $libfile
|
LIBRARY $libfile
|
||||||
EOF
|
EOF
|
||||||
exit ;;
|
exit ;;
|
||||||
--db) dbdir="$2"
|
--db) dbdir="$2"
|
||||||
shift 2 ;;
|
shift 2 ;;
|
||||||
--user) shift ;;
|
--user) dbdir="$userdb"
|
||||||
--system)
|
shift ;;
|
||||||
dbdir="$rootdb"
|
--system)
|
||||||
shift ;;
|
dbdir="$rootdb"
|
||||||
esac
|
shift ;;
|
||||||
|
-*) echo "$0: unknown option: '$1'" >&2
|
||||||
|
echo "Try --help for usage information."
|
||||||
|
exit 1 ;;
|
||||||
|
*) break ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
if [ "$2" ]; then
|
if [ "$2" ]; then
|
||||||
libfile="$2"
|
libfile="$2"
|
||||||
@ -50,9 +57,6 @@ if ! [ -d "$dbdir" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "NSS database: $dbdir"
|
|
||||||
echo "BEID library: $libfile"
|
|
||||||
|
|
||||||
dbdir="sql:$dbdir"
|
dbdir="sql:$dbdir"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -63,6 +67,7 @@ remove) echo "Removing $dbentry from database:"
|
|||||||
modutil -dbdir "$dbdir" -delete "$dbentry" ;;
|
modutil -dbdir "$dbdir" -delete "$dbentry" ;;
|
||||||
show) echo "Displaying $dbentry database entry, if any:"
|
show) echo "Displaying $dbentry database entry, if any:"
|
||||||
echo "Note: this may fail if you don't have the correct permissions." ;;
|
echo "Note: this may fail if you don't have the correct permissions." ;;
|
||||||
|
'') exec "$0" --help ;;
|
||||||
*) echo "$0: unknown action: '$1'" >&2
|
*) echo "$0: unknown action: '$1'" >&2
|
||||||
echo "Try --help for usage information."
|
echo "Try --help for usage information."
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
@ -70,6 +75,9 @@ esac
|
|||||||
|
|
||||||
ret=$?
|
ret=$?
|
||||||
|
|
||||||
|
echo "NSS database: $dbdir"
|
||||||
|
echo "BEID library: $libfile"
|
||||||
|
|
||||||
modutil -dbdir "$dbdir" -list "$dbentry" 2>/dev/null
|
modutil -dbdir "$dbdir" -list "$dbentry" 2>/dev/null
|
||||||
|
|
||||||
exit $ret
|
exit $ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user