#!/bin/bash

# get the Mac OS X major version. Example: El Capitan 10.11 -> 10011
MAC_VERSION=$(sw_vers -productVersion | awk -F '.' '{print $1 * 1000 + $2}')

if [ 10011 -gt $MAC_VERSION ]
then
	# Mac OS X < 10.11
	DROPDIR="/usr/libexec/SmartCardServices/drivers"
else
	# Mac OS X >= 10.11 (El Capitan)
	DROPDIR="/usr/local/libexec/SmartCardServices/drivers"
fi

mkdir -p $DROPDIR
ln -sf "/Library/VirtualSmartCard/${DROPDIR}/ifd-vpcd.bundle" "${DROPDIR}"

for f in /Library/VirtualSmartCard/bin/*
do
	ln -sf $f /usr/local/bin
done

mkdir -p /usr/local/lib/python2.7/site-packages
for f in /Library/VirtualSmartCard/lib/python2.7/site-packages/*
do
	ln -sf $f /usr/local/lib/python2.7/site-packages
done
