forked from muldjord/skyscraper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_skyscraper.sh
executable file
·54 lines (51 loc) · 1.25 KB
/
update_skyscraper.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
#!/bin/bash
LATEST=`wget -q -O - "https://api.github.com/repos/muldjord/skyscraper/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'`
if [ ! -f VERSION ]
then
echo "VERSION=0.0.0" > VERSION
fi
source VERSION
if [ "$LATEST" != "$VERSION" ]
then
echo "--- Fetching Skyscraper v.${LATEST} ---"
wget -N https://github.com/muldjord/skyscraper/archive/${LATEST}.tar.gz
if [ $? != 0 ]
then
exit
fi
echo "--- Unpacking ---"
tar xvzf ${LATEST}.tar.gz --strip-components 1 --overwrite
if [ $? != 0 ]
then
rm VERSION
exit
fi
rm ${LATEST}.tar.gz
echo "--- Cleaning out old build if one exists ---"
make clean
rm .qmake.stash
qmake
if [ $? != 0 ]
then
rm VERSION
exit
fi
echo "--- Building Skyscraper v.${LATEST} ---"
make
if [ $? != 0 ]
then
rm VERSION
exit
fi
echo "--- Installing Skyscraper v.${LATEST} ---"
sudo make install
if [ $? != 0 ]
then
rm VERSION
exit
fi
echo "--- Skyscraper has been updated to v.${LATEST} ---"
else
echo "--- Skyscraper is already the latest version, exiting ---"
echo "You can force a reinstall by removing the VERSION file by running 'rm VERSION'. Then rerun './update_skyscraper.sh' afterwards."
fi