Update install script

This commit is contained in:
sys4-fr 2018-03-31 16:13:41 +02:00
parent 71f8f0a446
commit 7ce0a58314

View File

@ -77,7 +77,7 @@ postgresql() {
install_0.4() { install_0.4() {
if [[ -d server-0.4 ]]; then if [[ -d server-0.4 ]]; then
echo "Installation précédente détecté. Voulez-vous faire la mise à jour ?" echo "Installation précédente détecté. Voulez-vous faire la mise à jour ?"
read -p "Continuer ? (y or n) " continuer read -p "Votre choix ? (y, n, clean) " continuer
if [[ $continuer == "y" ]]; then if [[ $continuer == "y" ]]; then
cd server-0.4 cd server-0.4
git pull git pull
@ -85,6 +85,14 @@ install_0.4() {
git submodule update --remote --recursive git submodule update --remote --recursive
verif verif
cd .. cd ..
elif [[ $continuer == "clean" ]]; then
rm -rf server-0.4
git clone https://github.com/sys4-fr/server-nalc.git server-0.4
verif
cd server-0.4
git submodule update --init --recursive
verif
cd ..
else else
echo "Mise à jour annulé." echo "Mise à jour annulé."
fi fi
@ -128,11 +136,11 @@ install_minetest() {
fi fi
if [[ ! -d minetest ]]; then if [[ ! -d minetest ]]; then
local branch="-b master"
if [[ $ver == "0.4" ]]; then if [[ $ver == "0.4" ]]; then
git clone -b backport-0.4 https://github.com/minetest/minetest.git branch="-b backport-0.4"
else
git clone $URL/minetest.git
fi fi
git clone $branch $URL/minetest.git
verif verif
fi fi
@ -146,7 +154,7 @@ install_minetest() {
} }
install_minetest_game() { install_minetest_game() {
if [[ -d minetest_game && ! $ver == "0.4" ]]; then if [[ -d minetest_game ]]; then
echo "Installation précédente du jeux Minetest détecté." echo "Installation précédente du jeux Minetest détecté."
read -p "Mettre à jour ? (y,n,clean,cancel) " continue read -p "Mettre à jour ? (y,n,clean,cancel) " continue
if [[ $continue == "y" ]]; then if [[ $continue == "y" ]]; then
@ -172,21 +180,16 @@ install_minetest_game() {
fi fi
if [[ ! -d minetest_game ]]; then if [[ ! -d minetest_game ]]; then
local branch="-b master"
if [[ ! $ver == "0.4" ]]; then if [[ ! $ver == "0.4" ]]; then
git clone $URL/minetest_game.git branch="-b backport-0.4"
verif
echo "Clonage de minetest_game terminé."
else
ln -s $(pwd)/server-0.4/minetest_game minetest_game
fi fi
elif [[ $ver == "0.4" ]]; then git clone $branch $URL/minetest_game.git
if [[ -a minetest_game ]]; then verif
rm minetest_game echo "Clonage de minetest_game terminé."
fi
ln -s $(pwd)/server-0.4/minetest_game minetest_game
fi fi
if [[ ! -a minetest/games/minetest_game ]]; then if [[ ! -L minetest/games/minetest_game ]]; then
ln -s $(pwd)/minetest_game minetest/games/minetest_game ln -s $(pwd)/minetest_game minetest/games/minetest_game
echo "Lien symbolique minetest/games/minetest_game vers $(pwd)/minetest_game créé." echo "Lien symbolique minetest/games/minetest_game vers $(pwd)/minetest_game créé."
fi fi
@ -218,6 +221,11 @@ install_world() {
if [[ ! -d minetest/worlds/nalc ]]; then if [[ ! -d minetest/worlds/nalc ]]; then
mkdir -p minetest/worlds/nalc mkdir -p minetest/worlds/nalc
if [[ -n $pg_dbname ]]; then
createdb $pg_dbname
createdb players-$pg_dbname
fi
if [[ $ver == "0.4" ]]; then if [[ $ver == "0.4" ]]; then
ln -s $(pwd)/server-0.4/worlds/minetestforfun/world.mt minetest/worlds/nalc/world.mt ln -s $(pwd)/server-0.4/worlds/minetestforfun/world.mt minetest/worlds/nalc/world.mt
else else
@ -228,10 +236,46 @@ install_world() {
install_mods() { install_mods() {
if [[ $ver == "0.4" ]]; then if [[ $ver == "0.4" ]]; then
local i=0
local md[1]="" # Mods to disable
for mod in "mysql_auth watershed mobs_old magicmithril obsidian eventobjects player_inactive random_messages irc irc_commands profilerdumper profnsched"; do
i=$(( $i+1 ))
md[$i]=$mod
done
if [[ -d minetest/mods ]]; then if [[ -d minetest/mods ]]; then
rm -rf minetest/mods rm -rf minetest/mods
ln -s $(pwd)/server-0.4/mods minetest/mods ln -s $(pwd)/server-0.4/mods minetest/mods
fi fi
if [[ -a world.mt ]]; then
rm world.mt
fi
cp worldmt.conf world.mt
ls server-0.4/mods | while read -r mod; do
if [[ -a server-0.4/mods/$mod/modpack.txt ]]; then
ls server-0.4/mods/$mod | while read -r submod; do
if [[ -d server-0.4/mods/$mod/$submod ]]; then
local mod_enable="true"
for (( modn=1; modn<$i; modn++ )); do
if [[ ${md[$modn]} == $submod ]]; then
mod_enable="false"
fi
done
echo "load_mod_$submod = $mod_enable" >> world.mt
fi
done
else
local mod_enable="true"
for (( modn=1; modn<$i; modn++ )); do
if [[ ${md[$modn]} == $mod ]]; then
mod_enable="false"
fi
done
echo "load_mod_$mod = $mod_enable" >> world.mt
fi
done
else else
if [[ -d nalc-server-mods ]]; then if [[ -d nalc-server-mods ]]; then
echo "Le dossier de mods est déjà présent. Que souhaitez-vous faire ?" echo "Le dossier de mods est déjà présent. Que souhaitez-vous faire ?"