-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·66 lines (44 loc) · 1.11 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
64
65
66
#!/usr/bin/env bash
# Run from this directory
cd "${0%/*}" || exit 1
# sudo powers required.
if [ "$(id -u)" != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi
# Uninstall previous version(s)
if [ -x "$(command -v bush)" ]; then
echo -e "Uninstalling previous version...\n"
./uninstall.sh
fi
BUSH="bush"
MAN="man/burning-bush.1"
EXIT_CODE=13
APP_PATH="/opt/burning_bush"
BIN_PATH="/usr/local/bin"
MAN_PATH="/usr/local/share/man/man1"
echo -e "Installing The Burning Bush 3.0 ..\n"
echo -e "Compiling..\n"
./compile.sh
CODE=$?
# Exit if compilation failed.
if [ $CODE == $EXIT_CODE ]; then
echo -e "Compilation Failed. Please resolve the issue and try again."
exit 1
fi
echo -e "Installing binaries..\n"
if [ ! -d "$APP_PATH" ]; then
mkdir -p "$APP_PATH"
fi
mv "$BUSH" "$APP_PATH/$BUSH"
chmod +x "$APP_PATH/$BUSH"
ln -s "$APP_PATH/$BUSH" "$BIN_PATH/$BUSH"
echo -e "Installing man pages..\n"
if [ ! -d "$MAN_PATH" ]; then
mkdir -p "$MAN_PATH"
fi
install -g 0 -o 0 -m 0644 "$MAN" "$MAN_PATH"
gzip "$MAN_PATH/burning-bush.1"
echo -e "Updating man database..\n"
mandb >/dev/null 2>&1
echo "All set."