From 2454b943d73ba20c20b02d35a69185838298405f Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Mon, 20 Apr 2015 17:03:28 +0200 Subject: [PATCH] eid-mw: fix and improve eid-nssdb helper script Now works. Good to know no-one else is using this :-) --- pkgs/tools/security/eid-mw/eid-nssdb.in | 36 +++++++++++++++---------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/pkgs/tools/security/eid-mw/eid-nssdb.in b/pkgs/tools/security/eid-mw/eid-nssdb.in index a5f52167b36..934c0256da7 100644 --- a/pkgs/tools/security/eid-mw/eid-nssdb.in +++ b/pkgs/tools/security/eid-mw/eid-nssdb.in @@ -3,12 +3,13 @@ rootdb="/etc/pki/nssdb" userdb="$HOME/.pki/nssdb" dbentry="Belgium eID" -libfile="/run/current-system/sw/libbeidpkcs11.so" +libfile="/run/current-system/sw/lib/libbeidpkcs11.so" dbdir="$userdb" -case "$1" in ---help) cat << EOF +while true; do + case "$1" in + --help|"") cat << EOF (Un)register $dbentry with NSS-compatible browsers. Usage: `basename "$0"` [OPTION] ACTION [LIBRARY] @@ -27,14 +28,20 @@ Actions: Default arguments if unspecified: LIBRARY $libfile EOF - exit ;; ---db) dbdir="$2" - shift 2 ;; ---user) shift ;; ---system) - dbdir="$rootdb" - shift ;; -esac + exit ;; + --db) dbdir="$2" + shift 2 ;; + --user) dbdir="$userdb" + shift ;; + --system) + dbdir="$rootdb" + shift ;; + -*) echo "$0: unknown option: '$1'" >&2 + echo "Try --help for usage information." + exit 1 ;; + *) break ;; + esac +done if [ "$2" ]; then libfile="$2" @@ -50,9 +57,6 @@ if ! [ -d "$dbdir" ]; then exit 1 fi -echo "NSS database: $dbdir" -echo "BEID library: $libfile" - dbdir="sql:$dbdir" case "$1" in @@ -63,6 +67,7 @@ remove) echo "Removing $dbentry from database:" modutil -dbdir "$dbdir" -delete "$dbentry" ;; show) echo "Displaying $dbentry database entry, if any:" echo "Note: this may fail if you don't have the correct permissions." ;; +'') exec "$0" --help ;; *) echo "$0: unknown action: '$1'" >&2 echo "Try --help for usage information." exit 1 ;; @@ -70,6 +75,9 @@ esac ret=$? +echo "NSS database: $dbdir" +echo "BEID library: $libfile" + modutil -dbdir "$dbdir" -list "$dbentry" 2>/dev/null exit $ret