-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added brackets to ensure it is loaded into ram before execution
- Loading branch information
Showing
1 changed file
with
35 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,40 @@ | ||
#!/bin/bash | ||
{ | ||
LATEST=`wget -q -O - "https://api.github.com/repos/muldjord/skyscraper/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'` | ||
|
||
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 [ ! -f VERSION ] | ||
then | ||
echo "VERSION=0.0.0" > VERSION | ||
fi | ||
source VERSION | ||
handle_error () { | ||
local EXITCODE=$? | ||
local ACTION=$1 | ||
rm --force VERSION | ||
echo "--- Failed to $ACTION Skyscraper v.${LATEST}, exiting with code $EXITCODE ---" | ||
exit $EXITCODE | ||
} | ||
|
||
handle_error () { | ||
local EXITCODE=$? | ||
local ACTION=$1 | ||
rm --force VERSION | ||
echo "--- Failed to $ACTION Skyscraper v.${LATEST}, exiting with code $EXITCODE ---" | ||
exit $EXITCODE | ||
if [ $LATEST != $VERSION ] | ||
then | ||
echo "--- Fetching Skyscraper v.$LATEST ---" | ||
wget -N https://github.com/muldjord/skyscraper/archive/${LATEST}.tar.gz || handle_error "fetch" | ||
echo "--- Unpacking ---" | ||
tar xvzf ${LATEST}.tar.gz --strip-components 1 --overwrite || handle_error "unpack" | ||
rm ${LATEST}.tar.gz | ||
echo "--- Cleaning out old build if one exists ---" | ||
make --ignore-errors clean | ||
rm --force .qmake.stash | ||
qmake || handle_error "clean old" | ||
echo "--- Building Skyscraper v.$LATEST ---" | ||
make -j$(nproc) || handle_error "build" | ||
echo "--- Installing Skyscraper v.$LATEST ---" | ||
sudo make install || handle_error "install" | ||
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 | ||
exit | ||
} | ||
|
||
if [ $LATEST != $VERSION ] | ||
then | ||
echo "--- Fetching Skyscraper v.$LATEST ---" | ||
wget -N https://github.com/muldjord/skyscraper/archive/${LATEST}.tar.gz || handle_error "fetch" | ||
echo "--- Unpacking ---" | ||
tar xvzf ${LATEST}.tar.gz --strip-components 1 --overwrite || handle_error "unpack" | ||
rm ${LATEST}.tar.gz | ||
echo "--- Cleaning out old build if one exists ---" | ||
make --ignore-errors clean | ||
rm --force .qmake.stash | ||
qmake || handle_error "clean old" | ||
echo "--- Building Skyscraper v.$LATEST ---" | ||
make -j$(nproc) || handle_error "build" | ||
echo "--- Installing Skyscraper v.$LATEST ---" | ||
sudo make install || handle_error "install" | ||
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 |