Blame misc/migrate_from_2.1_to_2.2.sh

Packit 8681c6
#!/bin/sh
Packit 8681c6
#
Packit 8681c6
# COPYRIGHT (c) International Business Machines Corp. 2006-2017
Packit 8681c6
#
Packit 8681c6
# This program is provided under the terms of the Common Public License,
Packit 8681c6
# version 1.0 (CPL-1.0). Any use, reproduction or distribution for this software
Packit 8681c6
# constitutes recipient's acceptance of CPL-1.0 terms which can be found
Packit 8681c6
# in the file LICENSE file or at https://opensource.org/licenses/cpl1.0.php
Packit 8681c6
#
Packit 8681c6
Packit 8681c6
# This script should be run after installing openCryptoki version 2.2.x on a
Packit 8681c6
# machine where openCryptoki version 2.1.x has already been installed.
Packit 8681c6
Packit 8681c6
# Make sure that no copies of pkcsslotd are running
Packit 8681c6
ps -ef | grep pkcsslotd | grep sbin &> /dev/null
Packit 8681c6
RES=$?
Packit 8681c6
if [ $RES = 0 ]; then
Packit 8681c6
    killall pkcsslotd
Packit 8681c6
fi
Packit 8681c6
Packit 8681c6
# Copy files from /etc/pkcs11/ to /var/lib/opencryptoki/
Packit 8681c6
if [ -e "/etc/pkcs11" ]; then
Packit 8681c6
    mkdir -p /var/lib/opencryptoki
Packit 8681c6
    cp -aR /etc/pkcs11/* /var/lib/opencryptoki/
Packit 8681c6
    cp -a /etc/pkcs11/.slotpid /var/lib/opencryptoki/
Packit 8681c6
fi
Packit 8681c6
Packit 8681c6
# Run startup script
Packit 8681c6
/usr/sbin/pkcs11_startup
Packit 8681c6
Packit 8681c6
# Restart pkcsslotd if it was running before this script was run
Packit 8681c6
if [ $RES = 0 ]; then
Packit 8681c6
    /usr/sbin/pkcsslotd
Packit 8681c6
fi