#!/bin/sh -v

if ! (kextstat | grep SonnetSATA)
then
kextload "$3"/tmp/SonnetSATA.kext
fi
"$3"/tmp/SonnetSATAFlash "$3"/tmp/SonnetSATA.ROM
rm -fR "$3"/System/Library/Extensions/SonnetSATARoot.kext "$3"/System/Library/Extensions/SonnetSATA.kext
rm -fR "$3"/System/Library/Caches/com.apple.kernelcaches "$3"/System/Library/Caches/com.apple.romextensions
rm -f "$3"/System/Library/Extensions.mkext "$3"/System/Library/Extensions.kextcache
touch "$3"/System/Library/Extensions
#rm -fR "$3"/tmp/Sonnet*
