-
Notifications
You must be signed in to change notification settings - Fork 4
/
mac-onyx-inst
executable file
·49 lines (43 loc) · 1.38 KB
/
mac-onyx-inst
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
#!/bin/sh
# Copyright 2019 Cameron Kaiser.
# All rights reserved.
#
# This script was originally written in Perl, but now is written in sh to
# prepare for the new sucky world of Catalina where scripting languages
# are deprecated and Tim Cook smiles his mysterious venomous smile. In
# particular, prepare for zsh instead of bash actually being /bin/sh.
if [ -n "$ZSH_VERSION" ]; then emulate -L ksh; fi
JSON_DIR="$HOME/Library/Application Support/Mozilla/NativeMessagingHosts"
echo "Onyx Installer Tool (C)2019 Cameron Kaiser"
echo "Installing to: $JSON_DIR"
echo " "
if [ ! -x "/Applications/Onyx.app/Contents/MacOS/onyx" ]; then
echo "Onyx.app must be in /Applications."
exit 255
fi
if [ -e "$JSON_DIR/onyx.json" ]; then
echo "Onyx appears to be already installed for this user."
exit 254
fi
echo "Creating destination directory."
/bin/mkdir -p "$JSON_DIR"
if [ ! -d "$JSON_DIR" ]; then
echo "Unable to create Onyx connection file."
exit 253
fi
echo "Creating connector file."
cat <<EOF >"$JSON_DIR/onyx.json"
{
"name": "onyx",
"description": "OverbiteNX Gopher system component",
"path": "/Applications/Onyx.app/Contents/MacOS/onyx",
"type": "stdio",
"allowed_extensions": [ "[email protected]" ]
}
EOF
if [ -e "$JSON_DIR/onyx.json" ]; then
echo "Onyx was successfully installed for this user."
exit 0
fi
echo "Onyx was unable to install its connector to Firefox."
exit 128