-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.sh
53 lines (47 loc) · 1.32 KB
/
update.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
#!/bin/bash
if [[ $1 != "recurse" ]]; then
echo "Getting latest files and updating application..."
git pull
bash update.sh recurse
exit 0
fi
echo -e "Building project..."
if [[ ! -d "build" ]]; then
mkdir build
fi
cd gui
if [[ ! -d "build" ]]; then
mkdir build
fi
cd ..
make clean
make
if [[ $? != 0 ]]; then
echo -e "\nError building project.\n"
exit 1
fi
echo -e "\nInstalling executable at /usr/local/bin/jackdaw..."
if [[ ! -d "/usr/local/bin" ]]; then
sudo mkdir -p /usr/local/bin
if [[ $? != 0 ]]; then
echo -e "\nError creating /usr/local/bin directory.\n"
exit 1
fi
fi
sudo mv jackdaw /usr/local/bin
if [[ $? != 0 ]]; then
echo -e "\nError moving the 'jackdaw' executable to /usr/local/bin.\n"
exit 1
fi
if ! grep -q 'export PATH="/usr/local/bin:$PATH"' ~/.bashrc; then
echo -e "Adding install dir to PATH in ~/.bashrc..."
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! grep -q 'export PATH="/usr/local/bin:$PATH"' ~/.zshrc; then
echo -e "Adding install dir to PATH in ~/.zshrc..."
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc
fi
fi
export PATH="/usr/local/bin:$PATH"
echo -e "\nDone! Run the program by typing 'jackdaw' on the command line in a bash or zsh terminal.\n"