summary refs log tree commit diff
path: root/pkgs/tools/security/eid-mw/eid-nssdb.in
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>2015-04-20 17:03:28 +0200
committerTobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com>2015-04-20 17:17:39 +0200
commit2454b943d73ba20c20b02d35a69185838298405f (patch)
tree7d795a1628fcbdeefe3556ea9e5bc4dbb0a32a21 /pkgs/tools/security/eid-mw/eid-nssdb.in
parent8eef55b0e0414672db82fa6a37d4cc8ddd58a2eb (diff)
downloadnixpkgs-2454b943d73ba20c20b02d35a69185838298405f.tar
nixpkgs-2454b943d73ba20c20b02d35a69185838298405f.tar.gz
nixpkgs-2454b943d73ba20c20b02d35a69185838298405f.tar.bz2
nixpkgs-2454b943d73ba20c20b02d35a69185838298405f.tar.lz
nixpkgs-2454b943d73ba20c20b02d35a69185838298405f.tar.xz
nixpkgs-2454b943d73ba20c20b02d35a69185838298405f.tar.zst
nixpkgs-2454b943d73ba20c20b02d35a69185838298405f.zip
eid-mw: fix and improve eid-nssdb helper script
Now works. Good to know no-one else is using this :-)
Diffstat (limited to 'pkgs/tools/security/eid-mw/eid-nssdb.in')
-rw-r--r--pkgs/tools/security/eid-mw/eid-nssdb.in36
1 files 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