#!/bin/sh

#  If the StartupItems directory has not been created yes, create
#  it and set the owner to root:wheel with the standard 0x755 permissions.

if [ ! -d /Library/StartupItems ] ; then
    sudo mkdir /Library/StartupItems
    sudo chown root:wheel /Library/StartupItems
    sudo chmod 755 /Library/StartupItems
fi

# Create a directory for the startup scripts themselves

if [ ! -d /Library/StartupItems/SATARaid5Daemon ] ; then
    sudo mkdir /Library/StartupItems/SATARaid5Daemon
    sudo chown root:wheel /Library/StartupItems/SATARaid5Daemon
    sudo chmod 755 /Library/StartupItems/SATARaid5Daemon
fi

sudo cp -rpf /Applications/Utilities/Silicon\ Image/SATARaid5/StartupItems/* /Library/StartupItems/SATARaid5Daemon

#  Now that the daemon has been installed, start it running in the background

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