| 1 | #!/bin/bash |
| 2 | # |
| 3 | |
| 4 | # $1: full path to the installation package |
| 5 | # $2: full path to the installation destination |
| 6 | # $3: mountpoint of the destination volume |
| 7 | # $4: root directory / for the current System folder |
| 8 | |
| 9 | #echo "Start postinstall script" |
| 10 | |
| 11 | # if the script to enable debug output in pcscd is available, run it |
| 12 | ENABLEDEBUGOUTPUTSCRIPT=`dirname "$0"`/EnableDebugPCSCD.sh |
| 13 | if [ -f "${ENABLEDEBUGOUTPUTSCRIPT}" ]; then |
| 14 | "${ENABLEDEBUGOUTPUTSCRIPT}" |
| 15 | fi |
| 16 | |
| 17 | # fix permissions |
| 18 | # /usr/sbin/chown root:wheel "/" |
| 19 | # /usr/sbin/chown root:wheel "/usr" |
| 20 | # /usr/sbin/chown root:wheel "/usr/libexec" |
| 21 | # /usr/sbin/chown root:wheel "/usr/libexec/SmartCardServices" |
| 22 | # /usr/sbin/chown root:wheel "/usr/libexec/SmartCardServices/drivers" |
| 23 | # /usr/sbin/chown root "/Library" |
| 24 | |
| 25 | #/usr/sbin/chown -R root:wheel "/usr/libexec/SmartCardServices/drivers/libifd-cyberjack.bundle" |
| 26 | #/usr/sbin/chown -R root:wheel "/usr/local/libexec/SmartCardServices/drivers/libifd-cyberjack.bundle" |
| 27 | |
| 28 | #cp /usr/libexec/SmartCardServices/drivers/libifd-cyberjack.bundle/Contents/Resources/cyberjack.conf.default /etc |
| 29 | |
| 30 | ## check if the ifd-ccid.bundle is there, in this case remove the cyberjack info |
| 31 | #if [ -d "/usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle" ]; then |
| 32 | # "$1/Contents/Resources/RemoveFromCCID" |
| 33 | #fi |
| 34 | |
| 35 | |
| 36 | #if [ $(/usr/bin/sw_vers -productVersion | awk -F '.' '{ print $1 }') -ge 10 -a $(/usr/bin/sw_vers -productVersion | awk -F '.' '{ print $2 }') -ge 5 ]; then |
| 37 | # # install LaunchAgent |
| 38 | # mkdir -p /Library/LaunchAgents && |
| 39 | # cp "${1}/Contents/Resources/de.reiner-sct.cyberjack.gui.plist" /Library/LaunchAgents/ && |
| 40 | # chmod 444 /Library/LaunchAgents/de.reiner-sct.cyberjack.gui.plist && |
| 41 | # chown root:wheel /Library/LaunchAgents/de.reiner-sct.cyberjack.gui.plist && |
| 42 | # ( |
| 43 | # # make sure LaunchAgents are running |
| 44 | # LAUNCHAGENTSFAILED=0 |
| 45 | # LOGGEDINUSERS=$(/bin/ps -x -a -o user,pid,gid,command | grep loginwindow | grep -v grep | awk '{print $1":"$3":"$2;}') |
| 46 | # for u in ${LOGGEDINUSERS}; do |
| 47 | # USERNAME=$(echo "$u" | awk -F ':' '{print $1}') |
| 48 | # USERGROUP=$(echo "$u" | awk -F ':' '{print $2}') |
| 49 | # BSPID=$(echo "$u" | awk -F ':' '{print $3}') |
| 50 | # if [ "${USERNAME}" != "root" -a "${USERNAME}" != "loginwindow" ]; then |
| 51 | # echo "launching CyberJack launch agent for user: ${USERNAME}, group ${USERGROUP}, bs_pid ${BSPID}" |
| 52 | # /bin/launchctl bsexec ${BSPID} /usr/sbin/chroot -u ${USERNAME} -g ${USERGROUP} / /bin/launchctl load -S Aqua /Library/LaunchAgents/de.reiner-sct.cyberjack.gui.plist || ((++LAUNCHAGENTSFAILED)) |
| 53 | # fi |
| 54 | # done |
| 55 | # if [ ${LAUNCHAGENTSFAILED} -gt 0 ]; then |
| 56 | # echo "failed to launch some launch agents - PIN dialogs may not work until user logs out and in again" >&2 |
| 57 | # # FIXME: should we display an alert to the user? |
| 58 | # fi |
| 59 | # ) |
| 60 | # |
| 61 | # # Smartcard Services installed as launchd daemon |
| 62 | # # check if the Smartcard Services are running. If so then restart them so our ifd-handler is recognized |
| 63 | ## if [ -d "/tmp/pcsc" ]; then |
| 64 | ## echo "Restarting Smartcard Services" |
| 65 | ## SystemStarter restart SmartcardServices |
| 66 | ## fi |
| 67 | #fi |
| 68 | |
| 69 | exit 0 |