#!/bin/sh

# ************
#
# Driver Installation
#
# Package Maker will place files into the tmp directory.
# The following command will copy the file and assign appropriate permissions
#
sudo scp -r /tmp/SiliconImage3132r5.kext /System/Library/Extensions
sudo chmod 755 /System/Library/Extensions/SiliconImage3132r5.kext/Content 
sudo chmod 755 /System/Library/Extensions/SiliconImage3132r5.kext/Contents/MacOS 
sudo chmod 644 /System/Library/Extensions/SiliconImage3132r5.kext/Contents/MacOS/SiliconImage3132r5 
sudo chmod 644 /System/Library/Extensions/SiliconImage3132r5.kext/Contents/Info.plist 
sudo chmod 644 /System/Library/Extensions/SiliconImage3132r5.kext/Contents/version.plist 
sudo chown -R root:wheel /System/Library/Extensions/SiliconImage3132r5.kext 
sudo touch /System/Library/Extensions
sudo touch /System/Library/Extensions.kextcache
sudo kextload /System/Library/Extensions/SiliconImage3132r5.kext 
#sudo kextcache -e 
sudo rm -rf /tmp/SiliconImage3132r5.kext

# *************
#
# SiCoreService Installation
#
# 
sudo cp -f /tmp/10_4u/SiCoreService /usr/sbin/
sudo cp -rf /tmp/StartupItems/SiCoreService /Library/StartupItems/.
sudo chmod -R 755 /usr/sbin/SiCoreService
sudo chmod -R 755 /Library/StartupItems/SiCoreService
sudo chown -R root:wheel /usr/sbin/SiCoreService
sudo chown -R root:wheel /Library/StartupItems/SiCoreService
sudo rm -rf /tmp/10_4u
sudo rm -rf /tmp/StartupItems
sudo /Library/StartupItems/SiCoreService/SiCoreService start

# If the GUI daemon directory exists try to restart the daemon
if [ -d /Library/StartupItems/SATARaid5Daemon ] ; then
ConsoleMessage "driver postflight Starting SATARaid5Daemon"

    /Applications/Utilities/Silicon\ Image/SATARaid5/SATARaid5Daemon &
fi

