-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·50 lines (42 loc) · 1.02 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
#!/bin/bash
set -e
if [ $# != "1" ]; then
echo "No scheduler IP address provided! Cannot install daemon" >&2
exit 1
fi
if [ $UID != "0" ]; then
echo "Must be run as root" >&2
exit 1
fi
# Compute the install directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
set -x
DIR="$DIR"
IP="$1"
PLIST="/Library/LaunchDaemons/org.icecream.iceccd.plist"
{ set +x; } 2> /dev/null
# Create the plist in /Library/LaunchDaemons/
cat > "$PLIST" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.icecream.iceccd</string>
<key>ProgramArguments</key>
<array>
<string>$DIR/icecc/iceccd</string>
<string>-s</string>
<string>$1</string>
</array>
<key>KeepAlive</key>
<true/>
<key>UserName</key>
<string>root</string>
</dict>
</plist>
EOF
set -x
launchctl load "$PLIST"
{ set +x; } 2> /dev/null
echo "done"