Update-TASTE.sh 2.43 KB
Newer Older
1
#!/bin/bash
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

if [ -t 1 ] ; then
    COLORON="\e[1m\e[32m"
    COLOROFF="\e[0m"
else
    COLORON=""
    COLOROFF=""
fi

function banner()
{
    echo -e "${COLORON}"
    echo "$1" | sed 's,.,=,g'
    echo "$1"
    echo "$1" | sed 's,.,=,g'
    echo -e "${COLOROFF}"
}

Maxime Perrotin's avatar
Maxime Perrotin committed
20
if [ -z "$GITLAB_CI" ] ; then
21 22 23 24 25 26 27 28 29 30 31 32 33
    git pull || exit 1
    if [ -z "$1" -o "$1" == "--stable" ] ; then
        git submodule init || exit 1
        git submodule update || exit 1
    else
        git submodule | awk '{print $2}' | while read FOLDER ; do
            cd "$FOLDER" || exit 1
            git fetch || exit 1
            git checkout master || exit 1
            git pull || exit 1
            cd ..
        done
    fi
34
else
Maxime Perrotin's avatar
Maxime Perrotin committed
35 36 37
    echo 'Updating TASTE in the CI container'
    #git submodule init || exit 1
    #git submodule update || exit 1
38
fi
39
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
40
export DISABLE_TASTE_BANNER=1
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
41
:> timings.log
42
for INSTALL_SCRIPT in install/[0-9]*sh ; do
43 44 45 46 47
    if [ ! -z "${TASTE_IN_DOCKER}" ] ; then
        if [ "${INSTALL_SCRIPT}" == "install/65_postgres.sh" ] ; then
            echo Skipping over postgres installation in Docker container.
            continue
        fi
48 49 50 51
    fi
    if [ "${INSTALL_SCRIPT}" == "install/92_Brave.sh" ] ; then
        echo Skipping over Brave installation.
        continue
52
    fi
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
53 54 55 56 57
    MSG="executing: ${INSTALL_SCRIPT}"
    banner "$MSG"
    echo -n "Calling ${INSTALL_SCRIPT} took: " >> timings.log
    bash -c "time -p ${INSTALL_SCRIPT}" > >(tee stdout.log) 2> >(tee stderr.log >&2) || { echo Failed in execution of "${INSTALL_SCRIPT}" ; exit 1 ; }
    grep ^real stderr.log | sed 's,real ,,' >> timings.log
58
done
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
59 60 61 62 63 64 65 66 67 68 69 70 71
echo -e "${COLORON}"
echo "==========================="
echo "Update completed - timings:"
echo "==========================="
echo -e "${COLOROFF}"
cat timings.log | column -t | sort -n -k 4
rm -f timings.log stdout.log stderr.log
echo -e "\e[1m\e[31m"
echo "====================================================="
echo "Please close this terminal and open a new one"
echo "(to make sure the environment variables are updated)."
echo "====================================================="
echo -e "${COLOROFF}"
Maxime Perrotin's avatar
Maxime Perrotin committed
72 73 74 75 76 77
if [ ! -f $HOME/.taste.shell.config.warning ] ; then
   touch $HOME/.taste.shell.config.warning
   echo -e "POST INSTALL: You must source ~/.bashrc.taste before you can start"
   echo -e "              using TASTE and modify your shell's configuration"
   echo -e "              (e.g. .bashrc) to always source it"
fi