-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·63 lines (51 loc) · 1.25 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/bash
set -euo pipefail
msg() {
echo "-- $*"
}
cmd() {
echo "$*"
"$@"
}
if [ "${EUID}" -ne 0 ]
then
echo "This script must be run as root"
exit 1
fi
cd "$(dirname "$0")"/..
drivers=($(find examples \
-type d -not -name '_*' -mindepth 1 -maxdepth 1 -exec basename {} ';'))
install_dir="/Library/Audio/Plug-Ins/HAL"
build_dir="$(pwd)/build/Examples"
mode="install"
while getopts ":u" opt
do
case "${opt}" in
u)
mode="uninstall"
;;
esac
done
case "${mode}" in
install)
for driver in "${drivers[@]}"
do
msg "Installing ${driver}.driver"
cmd rm -rf "${install_dir}/${driver}.driver"
cmd cp -fr "${build_dir}/${driver}/${driver}.driver" "${install_dir}"
done
msg "Restarting audio server"
cmd launchctl kickstart -k system/com.apple.audio.coreaudiod \
|| cmd killall -9 coreaudiod
;;
uninstall)
for driver in "${drivers[@]}"
do
msg "Uninstalling ${driver}.driver"
cmd rm -rf "${install_dir}/${driver}.driver"
done
msg "Restarting audio server"
cmd launchctl kickstart -k system/com.apple.audio.coreaudiod
;;
esac
msg "All done"