-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.sh
executable file
·60 lines (55 loc) · 1.45 KB
/
setup.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
#!/bin/bash
repo_dir=$(dirname $0)
arduino_theme_dir=/Applications/Arduino.app/Contents/Java/lib
repo_theme=$repo_dir/theme
original_theme="$arduino_theme_dir/theme"
backup_theme="$arduino_theme_dir/theme_backup"
function showOptions() {
echo "-i, --install, Install dracula theme."
echo "-u, --uninstall, Uninstall dracula theme."
echo "-h, --help, Show this help message."
echo "Usage: $(basename $0) [Options]"
echo "Example: $(basename $0) --install"
}
function install() {
if [[ ! -d "$backup_theme" ]]; then
osascript -e 'tell application "Arduino" to quit'
echo -n "Backing up default theme... "
mv "$original_theme" "$backup_theme"
echo " Done."
echo -n "Installing dracula theme..."
cp -R "$repo_theme" "$original_theme"
echo " Done."
else
echo "Dracula theme is already installed."
echo
showOptions
exit 1
fi
}
function uninstall() {
if [[ -d "$backup_theme" ]]; then
osascript -e 'tell application "Arduino" to quit'
echo -n "Uninstalling dracula theme..."
rm -rf "$original_theme"
echo " Done."
echo -n "Restoring default theme..."
mv "$backup_theme" "$original_theme"
echo " Done."
else
echo "Dracula theme is not installed."
echo
showOptions
exit 1
fi
}
case "$1" in
--install|-i)
install
;;
--uninstall|-u)
uninstall
;;
--help|-h|*)
showOptions
esac