From d7f3eecfaa5efdc1839cd68eb0b280e405aae320 Mon Sep 17 00:00:00 2001 From: sys4 Date: Fri, 27 Aug 2021 23:58:10 +0200 Subject: [PATCH] =?UTF-8?q?Modifie=20g=C3=A9n=C3=A9ration=20de=20carte=20p?= =?UTF-8?q?our=20utiliser=20leaftest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genmap.sh | 31 ++++++++++++++++++++++++------- install.sh | 15 +++++++++++++++ shutdown.sh | 2 +- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/genmap.sh b/genmap.sh index faa80c2..eea13fc 100755 --- a/genmap.sh +++ b/genmap.sh @@ -46,15 +46,32 @@ action() { [ ! -d "$destination" ] && error "Le répertoire $destination n'existe pas" [ ! -d "$serverpath/minetestmapper" ] && error "minetestmapper ne semble pas installé" + [ ! -d "$serverpath/leaftest" ] && error "leaftest ne semble pas installé" [ ! -e "$serverpath/colors.txt" ] && error "$serverpath/colors.txt manquant" - - pushd "$serverpath/minetestmapper" - ./minetestmapper -i "$world" -o /tmp/nalc_map.png --colors "$serverpath/colors.txt" --min-y -25 --max-y 300 --geometry -5000:-5000+10000+10000 - verif - popd - mv /tmp/nalc_map.png "$destination/" - verif + # Copie du dossier leaftest vers /tmp puis on l'exécute de là + local workdir=$(mktemp -d "/tmp/minetest-mapper.XXXXXXXXX") + local spawn=$(grep "static_spawnpoint" $config | tr -d " " | cut -f 2 -d "="); + local spawnx=$(cut -f 1 -d "," <<<$spawn) + local spawnz=$(cut -f 3 -d "," <<<$spawn) + local mapsize=12288 + + cp -a "$serverpath/leaftest" $workdir + cp "$serverpath/colors.txt" $workdir/leaftest + + pushd $workdir/leaftest + + MAPPERDIR="$serverpath/minetestmapper" \ + MAPPERPARAMS="--colors $serverpath/colors.txt \ + --min-y -25 --max-y 300" \ + JOBNUM=$(nproc) \ + $workdir/leaftest/mapper.sh "$world" $spawnx,$spawnz $mapsize + + # Copie de leaftest vers le dossier web distant normalement déjà monté + cp -aL $workdir/leaftest/www "$destination/$world_name" + popd + + rm -rf $workdir } # Pas de paramètre diff --git a/install.sh b/install.sh index 8e124a1..f1938b8 100755 --- a/install.sh +++ b/install.sh @@ -262,6 +262,9 @@ post_install() { echo "Veuillez éditer le fichier $(pwd)/start.sh" echo "Veuillez éditer le fichier $(pwd)/backup.sh" echo "Veuillez éditer le fichier $(pwd)/shutdown.sh" + echo "" + echo "Pour utiliser la génération de la carte, installer ImageMagick avec la dépendance fontconfig et truetype." + echo "Il faudra aussi autoriser lecture et écriture pour PS. Dans le fichier de gestion de la police de sécurité d'ImageMagick." fi } @@ -280,8 +283,20 @@ install_mtmapper() { pushd "$(pwd)/minetestmapper" git pull cmake . + [ $? -eq 1 ] && echo "Vérifier les dépendances de minetestmapper puis recompiler." make -j$makeopt popd + + if [ -n $ssh ]; then + URL=$ssh\:nalc + else + URL="https://sys4.fr/gitea/nalc" + fi + + if [ ! -d "$(pwd)/leaftest" ]; then + git clone --recursive --depth 1 $URL/leaftest.git + verif + fi } init() { diff --git a/shutdown.sh b/shutdown.sh index c009428..cd3331e 100755 --- a/shutdown.sh +++ b/shutdown.sh @@ -32,7 +32,7 @@ action() { [[ $bak -eq 1 ]] && $serverpath/backup.sh if [ $regenmap -eq 1 ]; then mount $mountpoint - sleep 5 + sleep 3 $serverpath/genmap.sh $serverpath $world $mapdest umount $mountpoint fi