script to install from git minetest on linux

Post Reply
pdussault
New member
Posts: 1
Joined: Sun Feb 04, 2018 17:10
GitHub: pdussault
IRC: pdussault
In-game: pdussault

script to install from git minetest on linux

by pdussault » Post

Hi,

Please find attached a bash script to install from git the minetest from git, if it can be useful for someone. As I install it on many machines, that helps me to avoid retyping everything.
:

Code: Select all

#!/bin/bash

# set -x

CMAKE=`type -P cmake`
DATE=`date +%Y%m%d`
GIT=`type -P git`
MAKE=`type -P make`

if [ -z "$DATE" ]
then
    echo "Cannot set the date. Stopping the program."
    exit 1
elif [ -z "$CMAKE" ]
then
     echo "Please install cmake program. Stopping the program."
     exit 1
elif [ -z "$GIT" ]
then
     echo "Please install git program. Stopping the program."
     exit 1
elif [ -z "$MAKE" ]
then
     echo "Please install make program. Stopping the program."
     exit 1
else

    # Configure mintest with : not in place, server, client, freetype, gettext, gles, spatial, sound, luajit, gmp, jsoncpp, and version
    
    CMAKEOPTIONS="-DRUN_IN_PLACE=FALSE -DBUILD_SERVER=TRUE -DBUILD_CLIENT=TRUE -DENABLE_FREETYPE=TRUE -DENABLE_GETTEXT=TRUE -DENABLE_GLES=TRUE -DENABLE_SPATIAL=TRUE -DENABLE_SOUND=TRUE -DENABLE_LUAJIT=TRUE -DENABLE_SYSTEM_GMP=TRUE -DENABLE_SYSTEM_JSONCPP=TRUE -DVERSION_EXTRA=${DATE}"
    INSTALLDIR=/usr/local
    MINETEST=$INSTALLDIR/minetest
    MINETESTGAME=games/minetest_game
    MINETESTGIT=https://github.com/minetest/minetest.git
    MINETESTGAMEGIT=https://github.com/minetest/minetest_game.git

    if [ -d $INSTALLDIR ]
    then
	cd $INSTALLDIR

	# backup existing folder
	
	if [ -d $MINETEST ]
	   then
	   echo "There's already an installation. Backing up the old one."
	   mv $MINETEST $MINETEST.$DATE
	fi

	# get most recent version of Minetest

	echo "Get the most recent version of Minetest"
	$GIT clone --depth 1 $MINETESTGIT 

	# compile Minetest

	if [ -d $MINETEST ]
	then

	    echo "Compiling Minetest"
	    cd $MINETEST
	    $GIT clone --depth 1 $MINETESTGAMEGIT $MINETESTGAME
	    $CMAKE . $CMAKEOPTIONS
	    $MAKE -j 3
	    echo "Minetest compiled and installed with success"
	    echo "To launch Minetest ; " $MINETEST/"bin/minetest" 
	else
	    echo "Check that directory " $INSTALLDIR\$MINETEST " is reachable."
	    exit 1
	fi
    else
	echo "The directory " $INSTALLDIR " isn't reachable. Stopping the program."
	exit 1
    fi
    exit 0
fi



Patrick

User avatar
Lejo
Member
Posts: 718
Joined: Mon Oct 19, 2015 16:32
GitHub: Lejo1
In-game: Lejo

Re: script to install from git minetest on linux

by Lejo » Post

nice script
+1

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 13 guests