#!/bin/sh

echo "source package path: $1"
echo "package destination: $2"
echo "mount point of dest: $3"
echo "installer framework: $4"

/usr/sbin/chown -R root:wheel "$2"

"$3/bin/rm" -rf "$3/System/Library/Caches/com.apple.kernelcaches"
"$3/bin/rm" -rf "$3/System/Library/Extensions.kextcache"
"$3/bin/rm" -rf "$3/System/Library/Extensions.mkext"
"$3/usr/bin/touch $3/System/Library/Extensions"
"$3/usr/sbin/kextcache" -k "$3/System/Library/Extensions"

"$3/bin/cp" -f "$1/Contents/Resources/HSDPA Support" "/Library/Modem Scripts/HSDPA Support"
"$3/bin/cp" -f "$1/Contents/Resources/EVDO Support" "/Library/Modem Scripts/EVDO Support"

PID=`ps -ax | awk '{print $1" "$5}' | grep kextd | awk '{print $1}'`
"$3/bin/kill" -1 $PID


exit 0
