Remove the NALC experimental branch support

This commit is contained in:
bri cassa 2023-11-26 12:59:33 +01:00
parent 860dacbaf7
commit 8205ff46f9
3 changed files with 128 additions and 125 deletions

View File

@ -34,7 +34,7 @@ usage() {
echo -e "\t-w --world <name> Custom world name." echo -e "\t-w --world <name> Custom world name."
echo -e "\t-P --port <port> Custom server port number." echo -e "\t-P --port <port> Custom server port number."
echo -e "\t--url <URL> Custom remote URL." echo -e "\t--url <URL> Custom remote URL."
echo -e "\t--branch <stable|dev|exp> Choose the version to install (stable by default)" echo -e "\t--branch <stable|dev> Choose the version to install (stable by default)"
echo echo
echo "License: GPLv3. Please read the LICENSE file." echo "License: GPLv3. Please read the LICENSE file."
echo "Author: Sys4 - https://sys4.fr#contact" echo "Author: Sys4 - https://sys4.fr#contact"
@ -114,9 +114,6 @@ install_game() {
"dev") "dev")
git_branch="-b dev" git_branch="-b dev"
;; ;;
"exp")
git_branch="-b experimental"
;;
esac esac
[ -z "$git_branch" ] && error "Invalid branch" [ -z "$git_branch" ] && error "Invalid branch"
@ -161,9 +158,6 @@ install_mods() {
"dev") "dev")
git_branch="-b dev" git_branch="-b dev"
;; ;;
"exp")
git_branch="-b experimental"
;;
esac esac
[ -z $git_branch ] && error "Invalid branch" [ -z $git_branch ] && error "Invalid branch"

View File

@ -13,17 +13,17 @@ strip() {
verif() { verif() {
if [[ $? -gt 0 ]]; then if [[ $? -gt 0 ]]; then
echo "Erreur ! Arrêt du script." echo "Erreur ! Arrêt du script."
exit 1 exit 1
fi fi
} }
error() { error() {
if [[ -n $1 ]]; then if [[ -n $1 ]]; then
echo "ERREUR : $1 !" echo "ERREUR : $1 !"
else else
echo "ERREUR : paramètres invalides !" >&2 echo "ERREUR : paramètres invalides !" >&2
echo "utilisez l'option -h pour en savoir plus" >&2 echo "utilisez l'option -h pour en savoir plus" >&2
fi fi
exit 1 exit 1
} }
@ -69,34 +69,34 @@ regen_worldmt() {
# Créer un nouveau fichier temporaire sans les lignes commençant par load_mod # Créer un nouveau fichier temporaire sans les lignes commençant par load_mod
local i=0 local i=0
cat "$worldfile" | while read -r line; do cat "$worldfile" | while read -r line; do
local match=$(echo $line | grep load_mod_) local match=$(echo $line | grep load_mod_)
if [[ -z $match ]]; then if [[ -z $match ]]; then
if [[ $i -eq 0 ]]; then if [[ $i -eq 0 ]]; then
echo $line > /tmp/world.mt echo $line > /tmp/world.mt
else else
echo $line >> /tmp/world.mt echo $line >> /tmp/world.mt
fi fi
fi fi
i=$(( $i+1 )) i=$(( $i+1 ))
done done
# Recréation des liens symboliques des mods dans le dossier minetest # Recréation des liens symboliques des mods dans le dossier minetest
# et générer une ligne "load_mod_<mod> = true ou false" pour chaque mod # et générer une ligne "load_mod_<mod> = true ou false" pour chaque mod
# et l'ajouter au fichier # et l'ajouter au fichier
# local mods_path=$serverpath/nalc-server-mods # local mods_path=$serverpath/nalc-server-mods
local mods="$MINETEST_DIR/mods" local mods="$MINETEST_DIR/mods"
local mods_custom="$serverpath/custom/mods" local mods_custom="$serverpath/custom/mods"
# Suppression d'éventuels liens symboliques du dossier des mods # Suppression d'éventuels liens symboliques du dossier des mods
ls "$mods" | while read -r mod; do ls "$mods" | while read -r mod; do
[ -L "$mods/$mod" ] && rm -f "$mods/$mod" [ -L "$mods/$mod" ] && rm -f "$mods/$mod"
done done
if [ -d "$mods_custom" ]; then if [ -d "$mods_custom" ]; then
ls $mods_custom | while read -r mod; do ls $mods_custom | while read -r mod; do
[ -d $mods_custom/$mod ] && ln -s $mods_custom/$mod $mods/$mod [ -d $mods_custom/$mod ] && ln -s $mods_custom/$mod $mods/$mod
done done
fi fi
# Liste des mods à désactiver # Liste des mods à désactiver
@ -104,25 +104,25 @@ regen_worldmt() {
# Populate world.mt # Populate world.mt
ls "$mods" | while read -r mod; do ls "$mods" | while read -r mod; do
if [ -d $mods/$mod ]; then if [ -d $mods/$mod ]; then
if [ -e $mods/$mod/init.lua ]; then if [ -e $mods/$mod/init.lua ]; then
local mod_enable="true" local mod_enable="true"
for (( modn=0; modn<${#md[@]}; modn++ )); do for (( modn=0; modn<${#md[@]}; modn++ )); do
[ ${md[$modn]} == $mod ] && mod_enable="false" [ ${md[$modn]} == $mod ] && mod_enable="false"
done done
echo "load_mod_$mod = $mod_enable" >> /tmp/world.mt echo "load_mod_$mod = $mod_enable" >> /tmp/world.mt
else else
ls "$mods/$mod" | while read -r submod; do ls "$mods/$mod" | while read -r submod; do
if [ -d "$mods/$mod/$submod" ]; then if [ -d "$mods/$mod/$submod" ]; then
local mod_enable="true" local mod_enable="true"
for (( modn=0; modn<${#md[@]}; modn++ )); do for (( modn=0; modn<${#md[@]}; modn++ )); do
[ ${md[$modn]} == $submod ] && mod_enable="false" [ ${md[$modn]} == $submod ] && mod_enable="false"
done done
echo "load_mod_$submod = $mod_enable" >> /tmp/world.mt echo "load_mod_$submod = $mod_enable" >> /tmp/world.mt
fi fi
done done
fi fi
fi fi
done done
# Remplacement du l'ancien world.mt par le nouveau # Remplacement du l'ancien world.mt par le nouveau
@ -148,82 +148,81 @@ update_world() {
local world_dest="$MINETEST_DIR/worlds/$WORLD_NAME" local world_dest="$MINETEST_DIR/worlds/$WORLD_NAME"
if [ ! -d "$world_repos" ]; then if [ ! -d "$world_repos" ]; then
error "$world_repos not found" error "$world_repos not found"
fi fi
if [ ! -d "$world_dest" ]; then if [ ! -d "$world_dest" ]; then
error "$world_dest not found" error "$world_dest not found"
fi fi
if [ $WORLD_FILE == "all" ]; then if [ $WORLD_FILE == "all" ]; then
WORLD_FILE="moretrees news technic fbn fbnp bitchange christmas randommsg worldmt" WORLD_FILE="moretrees news technic fbn fbnp bitchange christmas randommsg worldmt"
fi fi
for w_file in $WORLD_FILE; do for w_file in $WORLD_FILE; do
local file="" local file=""
local file_dest="" local file_dest=""
local do_copy=1 local do_copy=1
case $w_file in case $w_file in
moretrees) moretrees)
file_dest=$world_dest/moretrees_settings.txt file_dest=$world_dest/moretrees_settings.txt
file=$world_repos/moretrees_settings-$BRANCH.txt;; file=$world_repos/moretrees_settings-$BRANCH.txt;;
news) news)
file_dest=$world_dest/news.txt file_dest=$world_dest/news.txt
file=$world_repos/news-$BRANCH.txt;; file=$world_repos/news-$BRANCH.txt;;
technic) technic)
file_dest=$world_dest/technic.conf file_dest=$world_dest/technic.conf
file=$world_repos/technic-$BRANCH.conf;; file=$world_repos/technic-$BRANCH.conf;;
fbn) fbn)
file_dest=$world_dest/forbidden_names.txt file_dest=$world_dest/forbidden_names.txt
file=$world_repos/forbidden_names-$BRANCH.txt;; file=$world_repos/forbidden_names-$BRANCH.txt;;
fbnp) fbnp)
file_dest=$world_dest/forbidden_names_patterns.txt file_dest=$world_dest/forbidden_names_patterns.txt
file=$world_repos/forbidden_names_patterns-$BRANCH.txt;; file=$world_repos/forbidden_names_patterns-$BRANCH.txt;;
bitchange) bitchange)
file_dest=$world_dest/bitchange_config.txt file_dest=$world_dest/bitchange_config.txt
file=$world_repos/bitchange_config-$BRANCH.txt;; file=$world_repos/bitchange_config-$BRANCH.txt;;
christmas) christmas)
file_dest=$world_dest/christmas_craft.conf file_dest=$world_dest/christmas_craft.conf
file=$world_repos/christmas_craft-$BRANCH.conf;; file=$world_repos/christmas_craft-$BRANCH.conf;;
randommsg) randommsg)
file_dest=$world_dest/random_messages file_dest=$world_dest/random_messages
file=$world_repos/random_messages-$BRANCH;; file=$world_repos/random_messages-$BRANCH;;
worldmt) worldmt)
do_copy=0 do_copy=0
regen_worldmt;; regen_worldmt;;
mtconf) # Exception ici car n'est pas un fichier world. Doit être appelé seul. mtconf) # Exception ici car n'est pas un fichier world. Doit être appelé seul.
file_dest="$MINETEST_DIR/minetest.conf" file_dest="$MINETEST_DIR/minetest.conf"
file="$SCRIPT_DIR/minetest-$BRANCH.conf";; file="$SCRIPT_DIR/minetest-$BRANCH.conf";;
*) *)
error;; error;;
esac esac
if [ $do_copy -eq 1 ]; then if [ $do_copy -eq 1 ]; then
[ ! -e $file ] && error "Le fichier $file n'existe pas" [ ! -e $file ] && error "Le fichier $file n'existe pas"
echo "Copie de $file vers $file_dest" echo "Copie de $file vers $file_dest"
cp -up $file $file_dest cp -up $file $file_dest
fi fi
done done
} }
action() { action() {
[ ! -d "$serverpath" ] && error "$serverpath not found" [ ! -d "$serverpath" ] && error "$serverpath not found"
. "$serverpath/nalc.conf" . "$serverpath/nalc.conf"
[[ $BRANCH == "exp" ]] && BRANCH="experimental"
if [ $UP_MODS -eq 1 ]; then if [ $UP_MODS -eq 1 ]; then
echo "Updating $MINETEST_DIR/mods…" echo "Updating $MINETEST_DIR/mods…"
update_mods update_mods
echo "Mods updated." echo "Mods updated."
exit 0 exit 0
fi fi
if [ -n $WORLD_NAME ] && [ -n $BRANCH ]; then if [ -n $WORLD_NAME ] && [ -n $BRANCH ]; then
echo "Updating $WORLD_FILE from $WORLD_NAME and branch $BRANCH" echo "Updating $WORLD_FILE from $WORLD_NAME and branch $BRANCH"
update_world update_world
echo "World files updated." echo "World files updated."
elif [ -n $WORLD_NAME ] || [ -n $BRANCH ]; then elif [ -n $WORLD_NAME ] || [ -n $BRANCH ]; then
error error
fi fi
} }
@ -239,30 +238,30 @@ set -- $options
while true; do while true; do
case "$1" in case "$1" in
-h|--help) -h|--help)
usage usage
exit 0;; exit 0;;
-s|--serverpath) -s|--serverpath)
serverpath=$(strip $2) serverpath=$(strip $2)
shift 2;; shift 2;;
-m|--mods) -m|--mods)
UP_MODS=1 UP_MODS=1
shift;; shift;;
-w|--world) -w|--world)
WORLD_NAME=$(strip $2) WORLD_NAME=$(strip $2)
shift 2;; shift 2;;
-b|--branch) -b|--branch)
BRANCH=$(strip $2) BRANCH=$(strip $2)
shift 2;; shift 2;;
-f|--world-file) -f|--world-file)
WORLD_FILE=$(strip $2) WORLD_FILE=$(strip $2)
shift 2;; shift 2;;
--) --)
shift;; shift;;
*) *)
action action
exit 0 exit 0
shift;; shift;;
esac esac
done done

View File

@ -2,7 +2,17 @@
Pour voir le détail d'une révision, se rendre sur https://sys4.fr/gitea puis aller dans le dépôt nalc-server-mods de l'organisation nalc. Dans la vue des révisions vous pouvez chercher la description d'une révision dont le numéro se trouve dans le tableaux des révisions ci-dessous : Pour voir le détail d'une révision, se rendre sur https://sys4.fr/gitea puis aller dans le dépôt nalc-server-mods de l'organisation nalc. Dans la vue des révisions vous pouvez chercher la description d'une révision dont le numéro se trouve dans le tableaux des révisions ci-dessous :
===] 1.6.1/1.6.0/master/dev [=== ===] dev [===
* Revision| Date | Description
—————————————————————————————————————————
* e61ef53 | 25/11/23| Mods update
* 8998ddf | 11/6/23 | Mods update
* 912d2c6 | 10/6/23 | [snow] Fix skins mod support detection
* 6a64c32 | 9/6/23 | Remove craftguide and mods update
===] 1.6.1/1.6.0/master [===
* Révision| Date | Description * Révision| Date | Description
————————————————————————————————————————— —————————————————————————————————————————