From 3570f9fe7f169c5f9800477f5a8dc606b801f9e7 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Thu, 12 Jul 2018 10:17:34 +0200 Subject: [PATCH] Drop the pkcs11-switch script the coolkey package is already gone and the pkcs11 modules are handled by p11-kit now: https://fedoraproject.org/wiki/Changes/NSSLoadP11KitModules --- opensc.spec | 7 ----- pkcs11-switch.sh | 80 ------------------------------------------------ 2 files changed, 87 deletions(-) delete mode 100755 pkcs11-switch.sh diff --git a/opensc.spec b/opensc.spec index 729a788..26587fa 100644 --- a/opensc.spec +++ b/opensc.spec @@ -8,7 +8,6 @@ License: LGPLv2+ URL: https://github.com/OpenSC/OpenSC/wiki Source0: https://github.com/OpenSC/OpenSC/releases/download/%{version}/%{name}-%{version}.tar.gz Source1: opensc.module -Source2: pkcs11-switch.sh BuildRequires: pcsc-lite-devel BuildRequires: readline-devel @@ -62,9 +61,6 @@ make install DESTDIR=$RPM_BUILD_ROOT rm -f $RPM_BUILD_ROOT%{_sysconfdir}/opensc.conf install -Dpm 644 etc/opensc.conf $RPM_BUILD_ROOT%{_sysconfdir}/opensc-%{_arch}.conf install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/p11-kit/modules/opensc.module -%if 0%{?rhel} <= 7 -install -Dpm 755 %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/pkcs11-switch -%endif # use NEWS file timestamp as reference for configuration file touch -r NEWS $RPM_BUILD_ROOT%{_sysconfdir}/opensc-%{_arch}.conf @@ -115,9 +111,6 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/org.opensc.notify.de %{_bindir}/opensc-notify %{_bindir}/piv-tool %{_bindir}/pkcs11-tool -%if 0%{?rhel} <= 7 -%{_bindir}/pkcs11-switch -%endif %{_bindir}/pkcs15-crypt %{_bindir}/pkcs15-init %{_bindir}/pkcs15-tool diff --git a/pkcs11-switch.sh b/pkcs11-switch.sh deleted file mode 100755 index ab2f59b..0000000 --- a/pkcs11-switch.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh - -# Paths, names and functions definitions -NSSDB="/etc/pki/nssdb/" -COOLKEY_NAME="CoolKey PKCS #11 Module" -COOLKEY_LIBRARY="libcoolkeypk11.so" -OPENSC_NAME="OpenSC PKCS #11 Module" -OPENSC_LIBRARY="opensc-pkcs11.so" - -add_module() { - CURRENT="$1" - NAME="$2" - LIBRARY="$3" - if [ ! "$CURRENT" = "opensc coolkey" ]; then - modutil -add "$NAME" -dbdir "$NSSDB" -libfile "$LIBRARY" - fi -} -remove_module() { - NAME="$1" - modutil -delete "$NAME" -dbdir "$NSSDB" -force -} - -# Parse arguments. If wrong, print usage -TARGET="$1" -if [ "$TARGET" = "" ]; then - # Print currently installed module - PRINT_CURRENT="1" -elif [ "$TARGET" = "opensc" ] || [ "$TARGET" = "coolkey" ]; then - : # Correct arguments -else - echo "Simple tool to switch between OpenSC and Coolkey PKCS#11 modules in main NSS DB." - echo "Usage: $0 [coolkey|opensc]" - echo " [coolkey|opensc] says which of the modules should be used." - echo " The other one will be removed from database." - echo - echo " If there is no argument specified, prints the current module in NSS DB" - exit 255 -fi - -if [ ! -x /usr/bin/modutil ]; then - echo "The modutil is not installed. Please install package nss-util" - exit 255 -fi - -# Find the current library in NSS DB -CURRENT="" # none -LIBS=$(modutil -rawlist -dbdir "$NSSDB" | grep "^library=") -if echo "$LIBS" | grep "$COOLKEY_NAME" > /dev/null; then - CURRENT="coolkey" -fi -if echo "$LIBS" | grep "$OPENSC_NAME" > /dev/null; then - if [ -n "$CURRENT" ]; then - CURRENT="opensc coolkey" - echo "There are both modules in NSS DB, which is not recommended." - echo "I will remove the other." - else - CURRENT="opensc" - fi -fi - -if [ "$PRINT_CURRENT" = "1" ]; then - echo "$CURRENT" - exit 0 -fi - -# Do we need to change something? -if [ "$CURRENT" = "$TARGET" ]; then - echo "The requested module is already in the NSS DB" - exit 0 -fi - -# Do the actual change -if [ "$TARGET" = "opensc" ]; then - add_module "$CURRENT" "$OPENSC_NAME" "$OPENSC_LIBRARY" - remove_module "$COOLKEY_NAME" -fi -if [ "$TARGET" = "coolkey" ]; then - add_module "$CURRENT" "$COOLKEY_NAME" "$COOLKEY_LIBRARY" - remove_module "$OPENSC_NAME" -fi