-
-
Save qwertychouskie/2acf5648c086992c0e549475f6b368c4 to your computer and use it in GitHub Desktop.
Simple STK git updater
This file contains hidden or 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
BASEDIR=/home/qwerty/stk # Dir with stk-code and stk-assets inside | |
compiler=/usr/bin/clang # Your C compiler | |
compilerplusplus=/usr/bin/clang++ # Your C++ compiler | |
jobscount=4 # Count of build jobs | |
# Hint: you can use ping for setting up distributed builds | |
# Manually create "$BASEDIR"/stk-code/needtoupdate to force rebuild |
This file contains hidden or 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
#!/bin/bash | |
assetstriger=false | |
codetriger=false | |
compiler=gcc | |
compilerplusplus=g++ | |
. /etc/stk-update | |
startupdate(){ | |
BUILD_DIR="$BASEDIR"/stk-code/cmake_build | |
cd $BUILD_DIR | |
cmake -DCMAKE_INSTALL_PREFIX=/usr -DSERVER_ONLY=ON -DCMAKE_CXX_COMPILER="$compilerplusplus" -DCMAKE_C_COMPILER="$compiler" -DCMAKE_BUILD_TYPE=RelWithDebInfo .. | |
make -j $jobscount | |
killall supertuxkart 2>/dev/null && sleep 5 | |
pkexec sh -c "cd ${BUILD_DIR} && make install" | |
rm -f "$BASEDIR"/stk-code/needtoupdate | |
} | |
checkupdate(){ | |
cd "$BASEDIR"/stk-assets | |
if [ $(svn update | wc -l) -gt 2 ] | |
then | |
assetstriger=true | |
fi | |
cd "$BASEDIR"/stk-code | |
old_hash=$(git rev-parse HEAD) | |
git pull | |
if [ $old_hash != $(git rev-parse HEAD) ] # Last commit is different | |
then | |
codetriger=true | |
fi | |
if $codetriger || $assetstriger | |
then | |
return 0 | |
else | |
return 1 | |
fi | |
} | |
if checkupdate || [ -e "$BASEDIR"/stk-code/needtoupdate ] | |
then | |
startupdate | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment