Skip to content

Instantly share code, notes, and snippets.

@qwertychouskie
Forked from v1993/stk-update
Last active November 1, 2018 18:07
Show Gist options
  • Select an option

  • Save qwertychouskie/2acf5648c086992c0e549475f6b368c4 to your computer and use it in GitHub Desktop.

Select an option

Save qwertychouskie/2acf5648c086992c0e549475f6b368c4 to your computer and use it in GitHub Desktop.

Revisions

  1. qwertychouskie revised this gist Nov 1, 2018. 3 changed files with 47 additions and 52 deletions.
    50 changes: 0 additions & 50 deletions stk-update
    Original file line number Diff line number Diff line change
    @@ -1,50 +0,0 @@
    #!/bin/bash
    assetstriger=false
    codetriger=false
    compiler=g++
    . /etc/stk-update

    startupdate(){
    if zenity --question --title=SuperTuxKart --text='Есть обновления SuperTuxKart. Поставить?' --icon-name=supertuxkart --ok-label=Поставить --cancel-label=Потом --modal
    then
    BUILD_DIR="$BASEDIR"/stk-code/cmake_build
    cd $BUILD_DIR
    cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_CXX_COMPILER="$compiler" ..
    make -j $jobscount | tee /dev/stderr | grep -o --line-buffered '\[.*\%\]' | grep --line-buffered -oE '[0-9]*' | zenity --progress --auto-kill --title="Компилятор" --text="Компиляция supertuxkart"
    killall supertuxkart 2>/dev/null && sleep 5
    pkexec sh -c "cd ${BUILD_DIR} && make install"
    rm -f "$BASEDIR"/stk-code/needtoupdate
    else
    touch "$BASEDIR"/stk-code/needtoupdate
    echo "Aborted." 1>/dev/stderr
    return 0
    fi
    }

    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
    5 changes: 3 additions & 2 deletions stk-update (in etc)
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    BASEDIR=/home/v/compile # Dir with stk-code and stk-assets inside
    compiler=/usr/bin/zapcc++ # Your C++ compiler
    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
    44 changes: 44 additions & 0 deletions stk-update.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    #!/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
  2. @v1993 v1993 revised this gist Oct 8, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion stk-update (in etc)
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    BASEDIR=/home/v/compile # Dir with stc-code and stc-assets inside
    BASEDIR=/home/v/compile # Dir with stk-code and stk-assets inside
    compiler=/usr/bin/zapcc++ # Your C++ compiler
    jobscount=4 # Count of build jobs
    # Hint: you can use ping for setting up distributed builds
  3. @v1993 v1993 created this gist Oct 8, 2018.
    50 changes: 50 additions & 0 deletions stk-update
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    #!/bin/bash
    assetstriger=false
    codetriger=false
    compiler=g++
    . /etc/stk-update

    startupdate(){
    if zenity --question --title=SuperTuxKart --text='Есть обновления SuperTuxKart. Поставить?' --icon-name=supertuxkart --ok-label=Поставить --cancel-label=Потом --modal
    then
    BUILD_DIR="$BASEDIR"/stk-code/cmake_build
    cd $BUILD_DIR
    cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_CXX_COMPILER="$compiler" ..
    make -j $jobscount | tee /dev/stderr | grep -o --line-buffered '\[.*\%\]' | grep --line-buffered -oE '[0-9]*' | zenity --progress --auto-kill --title="Компилятор" --text="Компиляция supertuxkart"
    killall supertuxkart 2>/dev/null && sleep 5
    pkexec sh -c "cd ${BUILD_DIR} && make install"
    rm -f "$BASEDIR"/stk-code/needtoupdate
    else
    touch "$BASEDIR"/stk-code/needtoupdate
    echo "Aborted." 1>/dev/stderr
    return 0
    fi
    }

    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
    5 changes: 5 additions & 0 deletions stk-update (in etc)
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    BASEDIR=/home/v/compile # Dir with stc-code and stc-assets inside
    compiler=/usr/bin/zapcc++ # 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