#!/bin/bash

if [ "$#" -ne 1 ]; then
	>&2 echo "usage:" sudo $0 driver-path.driver
	exit 1
fi

DRIVER_PATH="$1"
DST=/Library/Audio/Plug-Ins/HAL
DRIVER=`basename "$DRIVER_PATH"`

echo installing $DRIVER_PATH to $DST/

mkdir -p "$DST"
rm -rf "$DST/$DRIVER"
cp -r "$DRIVER_PATH" "$DST/" || exit 1

launchctl kickstart -k system/com.apple.audio.coreaudiod
