Ajoute génération automatique d'une carte avec minetestmapper

This commit is contained in:
2021-08-27 01:44:15 +02:00
parent 0d2289bf42
commit 5291494df1
3 changed files with 134 additions and 14 deletions

View File

@@ -5,18 +5,22 @@ serverpath=/home/minetest/nalc-stable
world=nalc-stable
world_file=all # news|technic|fbn|fbnp|bitchange|christmas|randommsg
branch=stable # 1.0|1.1|dev
mountpoint=/mnt/demonix.fr
mapdest=$mountpoint/www
bak=0
update=0
restart=0
regenmap=0
usage() {
echo "usage: ./shutdown.sh [-h|--help] [-r|--restart] [-b|--bak] [-u|--update]"
echo "Options:"
echo -e "\t-h --help\tAffiche cette aide."
echo -e "\t-r --restart\tRedémarre le serveur après arrêt."
echo -e "\t-b --bak\tRéalise une sauvegarde après arrêt."
echo -e "\t-u --update\tRéalise une mise à jour après arrêt."
exit 0
echo "usage: ./shutdown.sh [-h|--help] [-r|--restart] [-b|--bak] [-u|--update]"
echo "Options:"
echo -e "\t-h --help\tAffiche cette aide."
echo -e "\t-r --restart\tRedémarre le serveur après arrêt."
echo -e "\t-b --bak\tRéalise une sauvegarde après arrêt."
echo -e "\t-u --update\tRéalise une mise à jour après arrêt."
echo -e "\t-m --regen-map\tRégénère une carte du monde."
exit 0
}
action() {
@@ -26,7 +30,14 @@ action() {
kill -s TERM $(pidof -x $serverpath/start.sh)
[[ $bak -eq 1 ]] && $serverpath/backup.sh
[[ $update -eq 1 ]] && $serverpath/upgrade.sh -s $serverpath -m -w $world -b $branch -f $world_file
if [ $regenmap -eq 1 ]; then
mount $mountpoint
sleep 5
$serverpath/regen_map.sh $serverpath $world $mapdest
umount $mountpoint
fi
[[ $update -eq 1 ]] && $serverpath/upgrade.sh -s $serverpath -m -w $world -b $branch -f $world_file
[[ $restart -eq 1 ]] && $serverpath/start.sh&
exit 0
@@ -39,7 +50,7 @@ action() {
# -o : Options courtes
# -l : options longues
OPT=$(getopt -o b,r,h,u -l bak,restart,help,update -- "$@")
OPT=$(getopt -o b,r,h,u,m -l bak,restart,help,update,regen-map -- "$@")
# éclatement de $options en $1, $2...
set -- $OPT
@@ -52,11 +63,14 @@ while true; do
-r|--restart)
restart=1
shift;;
-h|--help)
usage;;
-u|--update)
update=1
shift;;
-h|--help)
usage;;
-u|--update)
update=1
shift;;
-m|--regen-map)
regenmap=1
shift;;
--)
shift;;
*)