Modification du script d'installation et de fermeture du serveur.

* ./install.sh : Modification des arguments de ligne de commande,
* ./shutdown.sh : Ajout d'arguments pour pouvoir faire une sauvegarde du
  serveur et/ou le redémarrer.
* Ajout de minetest-dev.conf et minetest-stable.conf
* Renommage de minetest-0.4.conf vers minetest-1.0.conf
This commit is contained in:
2019-04-07 18:20:06 +02:00
parent f4ee59b66f
commit 6cc32d5eec
5 changed files with 671 additions and 57 deletions

View File

@@ -19,7 +19,7 @@ error() {
}
usage() {
echo "Usage: ./install.sh [options] [--] <arg>"
echo "Usage: ./install.sh [options] [--] <version>"
echo "Options :"
echo -e "\t-h --help\tAffiche l'aide."
echo -e "\t-j --makeopt\tNombre de threads de compilation."
@@ -28,10 +28,10 @@ usage() {
echo -e "\t\tSi l'option --ssh est passée en option, il s'agira du chemin distant."
echo -e "\t-i --irrlicht\tChemin personnalisé des sources irrlicht."
echo -e "\t-p --postgresql\tSi vous voulez que le serveur soit configuré avec postgresql"
echo "Arguments :"
echo -e "\t5.0 : Installation du serveur avec minetest-5.x. Suivez les instructions... (Non stable !)"
echo -e "\t0.4 : Installation du serveur avec minetest-0.4.x. Suivez les instructions... (Stable)"
echo -e "\tmaster : Installation du serveur avec la branche master de minetest. Suivez les instructions... (Non Stable !)"
echo "version :"
echo -e "\tstable : Installation du serveur depuis sa branche stable. Suivez les instructions... (À priori stable)"
echo -e "\t1.0 : Installation du serveur compatible avec minetest-0.4.17.x. Suivez les instructions... (Stable)"
echo -e "\tdev : Installation de la version en cours de developpement du serveur. Suivez les instructions... (Non Stable !)"
exit 0
}
@@ -75,38 +75,6 @@ postgresql() {
echo "pgsql_player_connection = host=$pg_url user=$pg_user password=$pg_password dbname=players-$pg_dbname" >> world.mt
}
install_0.4() {
if [[ -d server-0.4 ]]; then
echo "Installation précédente détecté. Voulez-vous faire la mise à jour ?"
read -p "Votre choix ? (y, n, clean) " continuer
if [[ $continuer == "y" ]]; then
cd server-0.4
git pull
verif
git -c http.sslVerify=false submodule update --init --recursive
verif
cd ..
elif [[ $continuer == "clean" ]]; then
rm -rf server-0.4
git -c http.sslVerify=false clone --depth 1 $URL/server-nalc.git server-0.4
verif
cd server-0.4
git -c http.sslVerify=false submodule update --init --recursive
verif
cd ..
else
echo "Mise à jour annulée"
fi
else
git -c http.sslVerify=false clone --depth 1 $URL/server-nalc.git server-0.4
verif
cd server-0.4
git -c http.sslVerify=false submodule update --init --recursive
verif
cd ..
fi
}
install_minetest() {
if [[ -z $makeopt ]]; then
local makeopt=$(grep -c processor /proc/cpuinfo)
@@ -138,12 +106,12 @@ install_minetest() {
if [[ ! -d minetest ]]; then
local branch="-b master"
if [[ $ver == "0.4" ]]; then
if [[ $ver == "stable" || $ver == "1.0" ]]; then
branch="-b stable-0.4"
elif [[ $ver == "5.0" ]]; then
branch="-b stable-5.0"
elif [[ $ver == "dev" ]]; then
branch="-b stable-5"
fi
git clone --depth 1 $branch https://github.com/minetest/minetest.git
git clone --depth 1 $branch https://gitlab.com/minetest/minetest.git
verif
fi
@@ -185,10 +153,12 @@ install_minetest_game() {
if [[ ! -d nalc_game ]]; then
local branch="-b master"
if [[ $ver == "0.4" ]]; then
if [[ $ver == "1.0" ]]; then
branch="-b nalc-1.0.0"
elif [[ $ver == "stable" ]];then
branch="-b nalc"
elif [[ $ver == "5.0" ]]; then
branch="-b stable-5.0"
elif [[ $ver == "dev" ]]; then
branch="-b nalc-dev"
fi
git clone --depth 1 $branch $URL/nalc_game.git
verif
@@ -204,7 +174,7 @@ install_minetest_game() {
}
install_world() {
local world_name="nalc"
local world_name="nalc-$ver"
if [[ -n $pg_dbname ]]; then
world_name=$pg_dbname
fi
@@ -239,8 +209,6 @@ install_world() {
ln -s $(pwd)/world.mt minetest/worlds/$world_name/world.mt
cp -r world/* minetest/worlds/$world_name/
mkdir minetest/worlds/$world_name/runes
fi
}
@@ -264,7 +232,14 @@ install_mods() {
fi
if [[ ! -d nalc-server-mods ]]; then
git clone $URL/nalc-server-mods.git
local branch="master"
if [[ $ver == "dev" ]]; then
branch="dev"
elif [[ $ver == "1.0" ]]; then
branch="stable-1.0"
fi
git clone -b $branch $URL/nalc-server-mods.git
verif
cd nalc-server-mods
git submodule update --init --recursive
@@ -290,7 +265,11 @@ install_mods() {
local i=0
local md[1]="" # Mods to disable
for mod in 3d_armor_ip 3d_armor_sfinv worldedit_brush; do
local mods="3d_armor_ip 3d_armor_sfinv worldedit_brush"
if [[ $ver == "dev" ]]; then
mods="3d_armor_ip 3d_armor_sfinv"
fi
for mod in $mods; do
i=$(( $i+1 ))
md[$i]=$mod
done
@@ -384,7 +363,7 @@ init() {
action() {
local arg=$(strip $1)
if [[ $arg == "5.0" || $arg == "0.4" || $arg == "master" ]]; then
if [[ $arg == "dev" || $arg == "stable" || $arg == "1.0" ]]; then
init $arg
else
error