Compare commits
	
		
			13 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3f471af93a | |||
| 01c34480e7 | |||
| 3df0023bc4 | |||
| 3135588877 | |||
| b937b6f27f | |||
| 9dfdd821ae | |||
| 41a12a3b30 | |||
| 373b649237 | |||
| 51496bf9cd | |||
| 2c85f29da1 | |||
| 035d34babd | |||
| cfb302a00c | |||
| 8205ff46f9 | 
| @@ -3,8 +3,12 @@ | ||||
|  | ||||
| ((lua-mode | ||||
|   (fill-column . 80) | ||||
|   (tab-width . 3) | ||||
|   (tab-width . 4) | ||||
|   (indent-tabs-mode . t))) | ||||
|  | ||||
| ((sh-mode | ||||
| 	(fill-column . 80) | ||||
| 	(tab-width . 4) | ||||
| 	(indent-tabs-mode . t))) | ||||
|  | ||||
|  | ||||
|   | ||||
							
								
								
									
										12
									
								
								backup.sh
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								backup.sh
									
									
									
									
									
								
							| @@ -10,12 +10,12 @@ bak=$serverpath/backup | ||||
| world=$serverpath/minetest/worlds/$worldname | ||||
|  | ||||
| if [[ ! -d $bak ]]; then | ||||
|     mkdir -p $bak | ||||
| 	mkdir -p $bak | ||||
| fi | ||||
|  | ||||
| bak_tmp=/var/tmp/$servername | ||||
| if [[ ! -d $bak_tmp ]]; then | ||||
|     mkdir $bak_tmp | ||||
| 	mkdir $bak_tmp | ||||
| fi | ||||
|  | ||||
| cp $serverpath/minetest/minetest.conf $bak/ | ||||
| @@ -39,9 +39,9 @@ log_dir=$serverpath/logs | ||||
| [[ ! -d $log_dir ]] && mkdir $log_dir | ||||
| pushd $log_dir | ||||
| if [[ -f moredebug.log ]]; then | ||||
|     d=$(date +%Y-%m-%d.%H.%M.%S) | ||||
|     mv moredebug.log moredebug_$d.log | ||||
|     bzip2 moredebug_$d.log | ||||
|     tar --label=LOGS-$servername -rf moredebug-logs.tar --remove-files moredebug*.log.bz2 | ||||
| 	d=$(date +%Y-%m-%d.%H.%M.%S) | ||||
| 	mv moredebug.log moredebug_$d.log | ||||
| 	bzip2 moredebug_$d.log | ||||
| 	tar --label=LOGS-$servername -rf moredebug-logs.tar --remove-files moredebug*.log.bz2 | ||||
| fi | ||||
| popd | ||||
|   | ||||
							
								
								
									
										128
									
								
								genmap.sh
									
									
									
									
									
								
							
							
						
						
									
										128
									
								
								genmap.sh
									
									
									
									
									
								
							| @@ -5,75 +5,75 @@ | ||||
| # Script pour automatiser la création de la carte de nalc | ||||
|  | ||||
| strip() { | ||||
|     echo "$1" | cut -d \' -f 2 | ||||
| 	echo "$1" | cut -d \' -f 2 | ||||
| } | ||||
|  | ||||
| verif() { | ||||
|     if [ $? -gt 0 ]; then | ||||
| 	echo "Erreur ! Arrêt du script." | ||||
| 	exit 1 | ||||
|     fi | ||||
| 	if [ $? -gt 0 ]; then | ||||
| 		echo "Erreur ! Arrêt du script." | ||||
| 		exit 1 | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| error() { | ||||
|     if [ -n "$1" ]; then | ||||
| 	echo "ERREUR : $1 !" | ||||
|     else | ||||
| 	echo "ERREUR : paramètres invalides !" >&2 | ||||
| 	echo "utilisez l'option -h pour en savoir plus" >&2 | ||||
|     fi | ||||
|     exit 1 | ||||
| 	if [ -n "$1" ]; then | ||||
| 		echo "ERREUR : $1 !" | ||||
| 	else | ||||
| 		echo "ERREUR : paramètres invalides !" >&2 | ||||
| 		echo "utilisez l'option -h pour en savoir plus" >&2 | ||||
| 	fi | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| usage() { | ||||
|     echo "Usage : ./genmap.sh [-h|--help] server_path worldname destination_path" | ||||
|     echo "Génère la carte de nalc vers le fichier destination_path/nalc_map.png" | ||||
| 	echo "Usage : ./genmap.sh [-h|--help] server_path worldname destination_path" | ||||
| 	echo "Génère la carte de nalc vers le fichier destination_path/nalc_map.png" | ||||
| } | ||||
|  | ||||
| action() { | ||||
|     [ -z "$1" ] && error "Argument manquant" | ||||
|     local serverpath=$(strip "$1") | ||||
|     [ ! -d "$serverpath" ] && error "Le répertoire $serverpath n'existe pas" | ||||
| 	[ -z "$1" ] && error "Argument manquant" | ||||
| 	local serverpath=$(strip "$1") | ||||
| 	[ ! -d "$serverpath" ] && error "Le répertoire $serverpath n'existe pas" | ||||
|  | ||||
|     [ -z "$2" ] && error "Nom du world manquant" | ||||
|     local world_name=$(strip "$2") | ||||
|      | ||||
|     local world="$serverpath/minetest/worlds/$world_name" | ||||
|     [ ! -d "$world" ] && error "Le répertoire $world n'existe pas" | ||||
| 	[ -z "$2" ] && error "Nom du world manquant" | ||||
| 	local world_name=$(strip "$2") | ||||
|  | ||||
|     [ -z "$3" ] && error "Chemin de destination manquant" | ||||
|     local destination=$(strip "$3") | ||||
|     [ ! -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" | ||||
| 	local world="$serverpath/minetest/worlds/$world_name" | ||||
| 	[ ! -d "$world" ] && error "Le répertoire $world n'existe pas" | ||||
|  | ||||
|     # Copie du dossier leaftest vers /tmp puis on l'exécute de là | ||||
|     local config="$serverpath/minetest/minetest.conf" | ||||
|     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 | ||||
| 	[ -z "$3" ] && error "Chemin de destination manquant" | ||||
| 	local destination=$(strip "$3") | ||||
| 	[ ! -d "$destination" ] && error "Le répertoire $destination n'existe pas" | ||||
|  | ||||
|     # Copie de leaftest vers le dossier web distant normalement déjà monté | ||||
|     rm -rf "$destination/$world_name" | ||||
|     cp -rL $workdir/leaftest/www "$destination/$world_name" | ||||
|     popd | ||||
|      | ||||
|     rm -rf $workdir | ||||
| 	[ ! -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" | ||||
|  | ||||
| 	# Copie du dossier leaftest vers /tmp puis on l'exécute de là | ||||
| 	local config="$serverpath/minetest/minetest.conf" | ||||
| 	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é | ||||
| 	rm -rf "$destination/$world_name" | ||||
| 	cp -rL $workdir/leaftest/www "$destination/$world_name" | ||||
| 	popd | ||||
|  | ||||
| 	rm -rf $workdir | ||||
| } | ||||
|  | ||||
| # Pas de paramètre | ||||
| @@ -87,17 +87,17 @@ options=$(getopt -o h -l help -- "$@") | ||||
| set -- $options | ||||
|  | ||||
| while true; do | ||||
|     case "$1" in | ||||
| 	-h|--help) | ||||
| 	    usage | ||||
| 	    exit 0;; | ||||
| 	--) | ||||
| 	    shift;; | ||||
| 	*) | ||||
| 	    action $1 $2 $3 | ||||
| 	    exit 0 | ||||
| 	    shift;; | ||||
|     esac | ||||
| 	case "$1" in | ||||
| 		-h|--help) | ||||
| 			usage | ||||
| 			exit 0;; | ||||
| 		--) | ||||
| 			shift;; | ||||
| 		*) | ||||
| 			action $1 $2 $3 | ||||
| 			exit 0 | ||||
| 			shift;; | ||||
| 	esac | ||||
| done | ||||
|  | ||||
| exit 0 | ||||
|   | ||||
							
								
								
									
										857
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										857
									
								
								install.sh
									
									
									
									
									
								
							| @@ -3,442 +3,439 @@ | ||||
| # License: GPLv3 | ||||
|  | ||||
| usage() { | ||||
|     echo "Usage: ./install_nalc.sh [options] [--] [destination]" | ||||
|     echo | ||||
|     echo "Description:" | ||||
|     echo -e "\tDownload and install the files needed by the NALC server to the" | ||||
|     echo -e "\toptional [destination] folder. Otherwise the current directory" | ||||
|     echo -e "\twill be used." | ||||
|     echo | ||||
|     echo -e "\tBut, be carefull!" | ||||
|     echo -e "\tBy default the ~/.minetest dir will also be used and modified." | ||||
|     echo -e "\tSo, make a backup of your ~/.minetest directory before the" | ||||
|     echo -e "\tinstallation of this server or specify a new directory with the" | ||||
|     echo -e "\t --minetest-dir or -d option." | ||||
|     echo | ||||
|     echo "Requirements:" | ||||
|     echo -e "\t- Official Minetest server must be already installed on your system." | ||||
|     echo -e "\tIf it is not the case, please refers to the https://minetest.net" | ||||
|     echo -e "\twebsite for the installation instructions." | ||||
|     echo -e "\t- You'll also need git, cmake, make." | ||||
|     echo | ||||
|     echo "Options:" | ||||
|     echo -e "\t-h --help\t  This help." | ||||
|     echo -e "\t-b --minetest-bin <path> Minetest server executable path." | ||||
|     echo -e "\t-d --minetest-dir <dir>  Minetest directory to use for installing nalc mods, nalc game, minetest.conf…" | ||||
|     echo -e "\t-m --map-backend <sqlite3|leveldb|redis|postgresql|dummy>" | ||||
|     echo -e "\t-p --player-backend <sqlite3|leveldb|postgresql|dummy|files>" | ||||
|     echo -e "\t-a --auth-backend <sqlite3|leveldb|postgresql|files>" | ||||
|     echo -e "\t-s --mod-storage-backend <sqlite3|files|dummy>" | ||||
|     echo -e "\t-M --minetest-mapper Install with minetest mapper support." | ||||
|     echo -e "\t-w --world <name> Custom world name." | ||||
|     echo -e "\t-P --port <port> Custom server port number." | ||||
|     echo -e "\t--url <URL> Custom remote URL." | ||||
|     echo -e "\t--branch <stable|dev|exp> Choose the version to install (stable by default)" | ||||
|     echo | ||||
|     echo "License: GPLv3. Please read the LICENSE file." | ||||
|     echo "Author: Sys4 - https://sys4.fr#contact" | ||||
| 	echo "Usage: ./install_nalc.sh [options] [--] [destination]" | ||||
| 	echo | ||||
| 	echo "Description:" | ||||
| 	echo -e "\tDownload and install the files needed by the NALC server to the" | ||||
| 	echo -e "\toptional [destination] folder. Otherwise the current directory" | ||||
| 	echo -e "\twill be used." | ||||
| 	echo | ||||
| 	echo -e "\tBut, be carefull!" | ||||
| 	echo -e "\tBy default the ~/.minetest dir will also be used and modified." | ||||
| 	echo -e "\tSo, make a backup of your ~/.minetest directory before the" | ||||
| 	echo -e "\tinstallation of this server or specify a new directory with the" | ||||
| 	echo -e "\t --minetest-dir or -d option." | ||||
| 	echo | ||||
| 	echo "Requirements:" | ||||
| 	echo -e "\t- Official Minetest server must be already installed on your system." | ||||
| 	echo -e "\tIf it is not the case, please refers to the https://minetest.net" | ||||
| 	echo -e "\twebsite for the installation instructions." | ||||
| 	echo -e "\t- You'll also need git, cmake, make." | ||||
| 	echo | ||||
| 	echo "Options:" | ||||
| 	echo -e "\t-h --help\t  This help." | ||||
| 	echo -e "\t-b --minetest-bin <path> Minetest server executable path." | ||||
| 	echo -e "\t-d --minetest-dir <dir>  Minetest directory to use for installing nalc mods, nalc game, minetest.conf…" | ||||
| 	echo -e "\t-m --map-backend <sqlite3|leveldb|redis|postgresql|dummy>" | ||||
| 	echo -e "\t-p --player-backend <sqlite3|leveldb|postgresql|dummy|files>" | ||||
| 	echo -e "\t-a --auth-backend <sqlite3|leveldb|postgresql|files>" | ||||
| 	echo -e "\t-s --mod-storage-backend <sqlite3|files|dummy>" | ||||
| 	echo -e "\t-M --minetest-mapper Install with minetest mapper support." | ||||
| 	echo -e "\t-w --world <name> Custom world name." | ||||
| 	echo -e "\t-P --port <port> Custom server port number." | ||||
| 	echo -e "\t--url <URL> Custom remote URL." | ||||
| 	echo -e "\t--branch <stable|dev> Choose the version to install (stable by default)" | ||||
| 	echo | ||||
| 	echo "Notes:" | ||||
| 	echo -e "\tThis install script should be able to upgrade a current nalc-sever installation." | ||||
| 	echo | ||||
| 	echo "License: GPLv3. Please read the LICENSE file." | ||||
| 	echo "Author: Sys4 - https://sys4.fr#contact" | ||||
|  | ||||
|     exit 0 | ||||
| 	exit 0 | ||||
| } | ||||
|  | ||||
| strip() { | ||||
|     echo $1 | cut -d \' -f 2 | ||||
| 	echo $1 | cut -d \' -f 2 | ||||
| } | ||||
|  | ||||
| verif() { | ||||
|     if [[ $? -gt 0 ]]; then | ||||
| 	echo "Error! Exit." | ||||
| 	exit 1 | ||||
|     fi | ||||
| 	if [[ $? -gt 0 ]]; then | ||||
| 		echo "Error! Exit." | ||||
| 		exit 1 | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| error() { | ||||
|     if [[ -n $1 ]]; then | ||||
| 	echo "ERROR: $1"! >&2 | ||||
|     else | ||||
| 	echo "ERROR: Invalid option!" >&2 | ||||
| 	echo "Use -h option for help." >&2 | ||||
|     fi | ||||
|     exit 1 | ||||
| 	if [[ -n $1 ]]; then | ||||
| 		echo "ERROR: $1"! >&2 | ||||
| 	else | ||||
| 		echo "ERROR: Invalid option!" >&2 | ||||
| 		echo "Use -h option for help." >&2 | ||||
| 	fi | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| save_conf() { | ||||
|     local conf="$1" | ||||
|     echo "MINETEST_BIN=$MINETEST_BIN" > "$conf"     | ||||
|     echo "MINETEST_DIR=$MINETEST_DIR" >> "$conf" | ||||
|     echo "MAP_BACKEND=$MAP_BACKEND" >> "$conf" | ||||
|     echo "PLAYER_BACKEND=$PLAYER_BACKEND" >> "$conf" | ||||
|     echo "AUTH_BACKEND=$AUTH_BACKEND" >> "$conf" | ||||
|     echo "MOD_STORAGE_BACKEND=$MOD_STORAGE_BACKEND" >> "$conf" | ||||
|     echo "MINETEST_MAPPER=$MINETEST_MAPPER" >> "$conf" | ||||
|     echo "URL=$URL" >> "$conf" | ||||
|     echo "BRANCH=$BRANCH" >> "$conf" | ||||
|     echo "WORLD_NAME=$WORLD_NAME" >> "$conf" | ||||
|     echo "PORT=$PORT" >> "$conf" | ||||
| 	local conf="$1" | ||||
| 	echo "MINETEST_BIN=$MINETEST_BIN" > "$conf" | ||||
| 	echo "MINETEST_DIR=$MINETEST_DIR" >> "$conf" | ||||
| 	echo "MAP_BACKEND=$MAP_BACKEND" >> "$conf" | ||||
| 	echo "PLAYER_BACKEND=$PLAYER_BACKEND" >> "$conf" | ||||
| 	echo "AUTH_BACKEND=$AUTH_BACKEND" >> "$conf" | ||||
| 	echo "MOD_STORAGE_BACKEND=$MOD_STORAGE_BACKEND" >> "$conf" | ||||
| 	echo "MINETEST_MAPPER=$MINETEST_MAPPER" >> "$conf" | ||||
| 	echo "URL=$URL" >> "$conf" | ||||
| 	echo "BRANCH=$BRANCH" >> "$conf" | ||||
| 	echo "WORLD_NAME=$WORLD_NAME" >> "$conf" | ||||
| 	echo "PORT=$PORT" >> "$conf" | ||||
| } | ||||
|  | ||||
| load_conf() { | ||||
|     . "$1" | ||||
| 	. "$1" | ||||
| } | ||||
|  | ||||
| install_game() { | ||||
|     local game_dir="$MINETEST_DIR/games/nalc_game" | ||||
|     if [ -d "$game_dir" ]; then | ||||
| 	echo "Previous installation of NALC game detected." | ||||
| 	read -p "Upgrade? ([Y]es/[n]o/clean/[c]ancel) " continue | ||||
| 	case "$continue" in | ||||
| 	    [yY][eE][sS]|[yY]|"") | ||||
| 		echo "Upgrading…" | ||||
| 		pushd "$game_dir" | ||||
| 		git pull | ||||
| 		verif | ||||
| 		popd;; | ||||
| 	    [cC][lL][eE][aA][nN]) | ||||
| 		echo "Cleaning…" | ||||
| 		rm -rf "$game_dir" | ||||
| 		verif;; | ||||
| 	    [cC][aA][nN][cC][eE][lL]|[cC]) | ||||
| 		echo "Upgrade cancelled." | ||||
| 		exit 0;; | ||||
| 	esac | ||||
|     fi | ||||
|     if [ ! -d "$game_dir" ]; then | ||||
| 	local git_branch | ||||
| 	local depth | ||||
| 	case $BRANCH in | ||||
| 	    "stable") | ||||
| 		git_branch="-b master" | ||||
| 		depth="--depth 1" | ||||
| 		;; | ||||
| 	    "dev") | ||||
| 		git_branch="-b dev" | ||||
| 		;; | ||||
| 	    "exp") | ||||
| 		git_branch="-b experimental" | ||||
| 		;; | ||||
| 	esac | ||||
| 	[ -z "$git_branch" ] && error "Invalid branch" | ||||
| 	local game_dir="$MINETEST_DIR/games/nalc_game" | ||||
| 	if [ -d "$game_dir" ]; then | ||||
| 		echo "Previous installation of NALC game detected." | ||||
| 		read -p "Upgrade? ([Y]es/[n]o/clean/[c]ancel) " continue | ||||
| 		case "$continue" in | ||||
| 			[yY][eE][sS]|[yY]|"") | ||||
| 				echo "Upgrading…" | ||||
| 				pushd "$game_dir" | ||||
| 				git pull | ||||
| 				verif | ||||
| 				popd;; | ||||
| 			[cC][lL][eE][aA][nN]) | ||||
| 				echo "Cleaning…" | ||||
| 				rm -rf "$game_dir" | ||||
| 				verif;; | ||||
| 			[cC][aA][nN][cC][eE][lL]|[cC]) | ||||
| 				echo "Upgrade cancelled." | ||||
| 				exit 0;; | ||||
| 		esac | ||||
| 	fi | ||||
| 	if [ ! -d "$game_dir" ]; then | ||||
| 		local git_branch | ||||
| 		local depth | ||||
| 		case $BRANCH in | ||||
| 			"stable") | ||||
| 				git_branch="-b master" | ||||
| 				depth="--depth 1" | ||||
| 				;; | ||||
| 			"dev") | ||||
| 				git_branch="-b dev" | ||||
| 				;; | ||||
| 		esac | ||||
| 		[ -z "$git_branch" ] && error "Invalid branch" | ||||
|  | ||||
| 	echo "Cloning $URL""nalc/nalc_game.git to $game_dir…" | ||||
| 	mkdir -p "$MINETEST_DIR/games" | ||||
| 	verif | ||||
| 	git clone $depth $git_branch $URL"nalc/nalc_game.git" "$game_dir" | ||||
| 	verif | ||||
|     fi | ||||
|     echo "NALC game installed/upgraded." | ||||
| 		echo "Cloning $URL""nalc/nalc_game.git to $game_dir…" | ||||
| 		mkdir -p "$MINETEST_DIR/games" | ||||
| 		verif | ||||
| 		git clone $depth $git_branch $URL"nalc/nalc_game.git" "$game_dir" | ||||
| 		verif | ||||
| 	fi | ||||
| 	echo "NALC game installed/upgraded." | ||||
| } | ||||
|  | ||||
| install_mods() { | ||||
|     local mods_dir="$MINETEST_DIR/mods" | ||||
|     if [ -d "$mods_dir" ]; then | ||||
| 	echo "Mods directory is not empty." | ||||
| 	read -p "Upgrade? ([Y]es/[n]o/clean/[c]ancel) " continue | ||||
| 	case "$continue" in | ||||
| 	    [yY][eE][sS]|[yY]|"") | ||||
| 		echo "Upgrading…" | ||||
| 		"$SCRIPT_DIR"/upgrade.sh -m -s "$DESTINATION" | ||||
| 		verif | ||||
| 		;; | ||||
| 	    [cC][lL][eE][aA][nN]) | ||||
| 		echo "Cleaning…" | ||||
| 		rm -rf "$mods_dir" | ||||
| 		verif | ||||
| 		;; | ||||
| 	    [cC][aA][nN][cC][eE][lL]|[cC]) | ||||
| 		echo "Upgrade cancelled." | ||||
| 		exit 0;; | ||||
| 	esac | ||||
|     fi | ||||
|     if [ ! -d "$mods_dir" ]; then | ||||
| 	local git_branch | ||||
| 	local depth | ||||
| 	case $BRANCH in | ||||
| 	    "stable") | ||||
| 		git_branch="-b master" | ||||
| 		depth="--depth 1" | ||||
| 		;; | ||||
| 	    "dev") | ||||
| 		git_branch="-b dev" | ||||
| 		;; | ||||
| 	    "exp") | ||||
| 		git_branch="-b experimental" | ||||
| 		;; | ||||
| 	esac | ||||
| 	[ -z $git_branch ] && error "Invalid branch" | ||||
| 	local mods_dir="$MINETEST_DIR/mods" | ||||
| 	if [ -d "$mods_dir" ]; then | ||||
| 		echo "Mods directory is not empty." | ||||
| 		read -p "Upgrade? ([Y]es/[n]o/clean/[c]ancel) " continue | ||||
| 		case "$continue" in | ||||
| 			[yY][eE][sS]|[yY]|"") | ||||
| 				echo "Upgrading…" | ||||
| 				"$SCRIPT_DIR"/upgrade.sh -m -s "$DESTINATION" | ||||
| 				verif | ||||
| 				;; | ||||
| 			[cC][lL][eE][aA][nN]) | ||||
| 				echo "Cleaning…" | ||||
| 				rm -rf "$mods_dir" | ||||
| 				verif | ||||
| 				;; | ||||
| 			[cC][aA][nN][cC][eE][lL]|[cC]) | ||||
| 				echo "Upgrade cancelled." | ||||
| 				exit 0;; | ||||
| 		esac | ||||
| 	fi | ||||
| 	if [ ! -d "$mods_dir" ]; then | ||||
| 		local git_branch | ||||
| 		local depth | ||||
| 		case $BRANCH in | ||||
| 			"stable") | ||||
| 				git_branch="-b master" | ||||
| 				depth="--depth 1" | ||||
| 				;; | ||||
| 			"dev") | ||||
| 				git_branch="-b dev" | ||||
| 				;; | ||||
| 		esac | ||||
| 		[ -z $git_branch ] && error "Invalid branch" | ||||
|  | ||||
| 	echo "Cloning $URL/nalc-server-mods.git to $mods_dir…" | ||||
| 	git clone $depth $git_branch $URL"nalc/nalc-server-mods.git" "$mods_dir" | ||||
| 	verif | ||||
| 	pushd "$mods_dir" | ||||
| 	git submodule update --init --recursive | ||||
| 	verif | ||||
| 	popd | ||||
|     fi | ||||
|     echo "Mods for NALC installed/upgraded." | ||||
| 		echo "Cloning $URL/nalc-server-mods.git to $mods_dir…" | ||||
| 		git clone $depth $git_branch $URL"nalc/nalc-server-mods.git" "$mods_dir" | ||||
| 		verif | ||||
| 		pushd "$mods_dir" | ||||
| 		git submodule update --init --recursive | ||||
| 		verif | ||||
| 		popd | ||||
| 	fi | ||||
| 	echo "Mods for NALC installed/upgraded." | ||||
| } | ||||
|  | ||||
| install_world() { | ||||
|     local world_dir="$MINETEST_DIR/worlds/$WORLD_NAME" | ||||
|     if [ -d "$world_dir" ]; then | ||||
| 	echo "World $WORLD_NAME already exist." | ||||
| 	read -p "Upgrade $WORLD_NAME? ([Y]es/[n]o/[c]lean) " continue | ||||
| 	case "$continue" in | ||||
| 	    [yY][eE][sS]|[yY]|"") | ||||
| 		echo "Upgrading…" | ||||
| 		[ -d "$world_dir"_old ] && rm -rf "$world_dir"_old | ||||
| 		cp -r "$world_dir" "$world_dir"_old | ||||
| 		verif | ||||
| 		;; | ||||
| 	    [cC][lL][eE][aA][nN]|[cC]) | ||||
| 		echo "Cleaning…" | ||||
| 		[ -d "$world_dir"_old ] && rm -rf "$world_dir"_old | ||||
| 		mv "$world_dir" "$world_dir"_old | ||||
| 		verif | ||||
| 		;; | ||||
| 	    [nN][oO]|[nN]) | ||||
| 		echo "Skiping…" | ||||
| 		return | ||||
| 		;; | ||||
| 	esac | ||||
|     fi | ||||
|     if [ ! -d "$world_dir" ]; then | ||||
| 	mkdir -p "$world_dir/runes" | ||||
| 	verif | ||||
|  | ||||
| 	local mt=$world_dir/world.mt | ||||
| 	echo "Generating $mt""…" | ||||
| 	 | ||||
| 	echo "gameid = nalc_game" > $mt | ||||
| 	echo "enable_damage = true" >> $mt | ||||
| 	echo "creative_mod = false" >> $mt | ||||
|         case $MAP_BACKEND in | ||||
| 	    "sqlite3"|"") | ||||
| 		echo "backend = sqlite3" >> $mt | ||||
| 		;; | ||||
| 	    "leveldb") | ||||
| 		echo "backend = leveldb" >> $mt | ||||
| 		;; | ||||
| 	    "redis") | ||||
| 		echo "backend = redis" >> $mt | ||||
| 		read -p "redis_address? " val | ||||
| 		echo "redis_address = $val" >> $mt | ||||
| 		read -p "redis_hash? " val | ||||
| 		echo "redis_hash = $val" >> $mt | ||||
| 		read -p "redis_port? (6379) " val | ||||
| 		[ -z $val ] && val=6379 | ||||
| 		echo "redis_port = $val" >> $mt | ||||
| 		;; | ||||
| 	    "postgresql") | ||||
| 		echo "backend = postgresql" >> $mt | ||||
| 		read -p "DB address? " val | ||||
| 		read -p "DB user? " val2 | ||||
| 		read -p "DB password? " val3 | ||||
| 		read -p "DB name? " val4 | ||||
| 		read -p "DB port? (5432) " val5 | ||||
| 		[ -z $val5 ] && val5=5432 | ||||
| 		echo "pgsql_connection = host=$val port=$val5 user=$val2 password=$val3 dbname=$val4" >> $mt | ||||
| 		;; | ||||
| 	    "dummy") | ||||
| 		echo "backend = dummy" >> $mt | ||||
| 		;; | ||||
| 	    *) | ||||
| 		error "$MAP_BACKEND is not valid";; | ||||
| 	esac | ||||
| 	case $PLAYER_BACKEND in | ||||
| 	    "sqlite3"|"") | ||||
| 		echo "player_backend = sqlite3" >> $mt | ||||
| 		;; | ||||
| 	    "leveldb") | ||||
| 		echo "player_backend = leveldb" >> $mt | ||||
| 		;; | ||||
| 	    "postgresql") | ||||
| 		echo "player_backend = postgresql" >> $mt | ||||
| 		read -p "DB address? ($val) " vval | ||||
| 		read -p "DB user? ($val2) " vval2 | ||||
| 		read -p "DB password? ($val3) " vval3 | ||||
| 		read -p "DB name? (players-$val4) " vval4 | ||||
| 		read -p "DB port? ($val5) " vval5 | ||||
| 		[ -z $vval ] && vval=$val | ||||
| 		[ -z $vval2 ] && vval2=$val2 | ||||
| 		[ -z $vval3 ] && vval3=$val3 | ||||
| 		[ -z $vval4 ] && vval4="players-$val4" | ||||
| 		[ -z $vval5 ] && vval5=$val5 | ||||
| 		echo "pgsql_player_connection = host=$vval port=$vval5 user=$vval2 password=$vval3 dbname=$vval4" >> $mt | ||||
| 		;; | ||||
| 	    "dummy") | ||||
| 		echo "player_backend = dummy" >> $mt | ||||
| 		;; | ||||
| 	    "files") | ||||
| 		echo "player_backend = files" >> $mt | ||||
| 		;; | ||||
| 	    *) | ||||
| 		error "$PLAYER_BACKEND is not valid";; | ||||
| 	esac | ||||
| 	case $AUTH_BACKEND in | ||||
| 	    "sqlite3"|"") | ||||
| 		echo "auth_backend = sqlite3" >> $mt | ||||
| 		;; | ||||
| 	    "leveldb") | ||||
| 		echo "auth_backend = leveldb" >> $mt | ||||
| 		;; | ||||
| 	    "postgresql") | ||||
| 		echo "auth_backend = postgresql" >> $mt | ||||
| 		read -p "DB address? ($val) " vval | ||||
| 		read -p "DB user? ($val2) " vval2 | ||||
| 		read -p "DB password? ($val3) " vval3 | ||||
| 		read -p "DB name? (auth-$val4) " vval4 | ||||
| 		read -p "DB port? ($val5) " vval5 | ||||
| 		[ -z $vval ] && vval=$val | ||||
| 		[ -z $vval2 ] && vval2=$val2 | ||||
| 		[ -z $vval3 ] && vval3=$val3 | ||||
| 		[ -z $vval4 ] && vval4="auth-$val4" | ||||
| 		[ -z $vval5 ] && vval5=$val5 | ||||
| 		echo "pgsql_auth_connection = host=$vval port=$vval5 user=$vval2 password=$vval3 dbname=$vval4" >> $mt | ||||
| 		;; | ||||
| 	    "files") | ||||
| 		echo "auth_backend = files" >> $mt | ||||
| 		;; | ||||
| 	    *) | ||||
| 		error "$AUTH_BACKEND is not valid";; | ||||
| 	esac | ||||
| 	case $MOD_STORAGE_BACKEND in | ||||
| 	    "sqlite3"|"") | ||||
| 		echo "mod_storage_backend = sqlite3" >> $mt | ||||
| 		;; | ||||
| 	    "files") | ||||
| 		echo "mod_storage_backend = files" >> $mt | ||||
| 		;; | ||||
| 	    "dummy") | ||||
| 		echo "mod_storage_backend = dummy" >> $mt | ||||
| 		;; | ||||
| 	    *) | ||||
| 		error "$MOD_STORAGE_BACKEND is not valid";; | ||||
| 	esac | ||||
| 	read -p "Server announce? (y/N) " val | ||||
| 	if [[ $val =~ [yY][eE][sS]|[yY] ]]; then | ||||
| 	    echo "server_announce = true" >> $mt | ||||
| 	else | ||||
| 	    echo "server_announce = false" >> $mt | ||||
| 	local world_dir="$MINETEST_DIR/worlds/$WORLD_NAME" | ||||
| 	if [ -d "$world_dir" ]; then | ||||
| 		echo "World $WORLD_NAME already exist." | ||||
| 		read -p "Upgrade $WORLD_NAME? ([Y]es/[n]o/[c]lean) " continue | ||||
| 		case "$continue" in | ||||
| 			[yY][eE][sS]|[yY]|"") | ||||
| 				echo "Upgrading…" | ||||
| 				[ -d "$world_dir"_old ] && rm -rf "$world_dir"_old | ||||
| 				cp -r "$world_dir" "$world_dir"_old | ||||
| 				verif | ||||
| 				;; | ||||
| 			[cC][lL][eE][aA][nN]|[cC]) | ||||
| 				echo "Cleaning…" | ||||
| 				[ -d "$world_dir"_old ] && rm -rf "$world_dir"_old | ||||
| 				mv "$world_dir" "$world_dir"_old | ||||
| 				verif | ||||
| 				;; | ||||
| 			[nN][oO]|[nN]) | ||||
| 				echo "Skiping…" | ||||
| 				return | ||||
| 				;; | ||||
| 		esac | ||||
| 	fi | ||||
| 	if [ ! -d "$world_dir" ]; then | ||||
| 		mkdir -p "$world_dir/runes" | ||||
| 		verif | ||||
|  | ||||
| 		local mt=$world_dir/world.mt | ||||
| 		echo "Generating $mt""…" | ||||
|  | ||||
| 		echo "gameid = nalc_game" > $mt | ||||
| 		echo "enable_damage = true" >> $mt | ||||
| 		echo "creative_mod = false" >> $mt | ||||
| 		case $MAP_BACKEND in | ||||
| 			"sqlite3"|"") | ||||
| 				echo "backend = sqlite3" >> $mt | ||||
| 				;; | ||||
| 			"leveldb") | ||||
| 				echo "backend = leveldb" >> $mt | ||||
| 				;; | ||||
| 			"redis") | ||||
| 				echo "backend = redis" >> $mt | ||||
| 				read -p "redis_address? " val | ||||
| 				echo "redis_address = $val" >> $mt | ||||
| 				read -p "redis_hash? " val | ||||
| 				echo "redis_hash = $val" >> $mt | ||||
| 				read -p "redis_port? (6379) " val | ||||
| 				[ -z $val ] && val=6379 | ||||
| 				echo "redis_port = $val" >> $mt | ||||
| 				;; | ||||
| 			"postgresql") | ||||
| 				echo "backend = postgresql" >> $mt | ||||
| 				read -p "DB address? " val | ||||
| 				read -p "DB user? " val2 | ||||
| 				read -p "DB password? " val3 | ||||
| 				read -p "DB name? " val4 | ||||
| 				read -p "DB port? (5432) " val5 | ||||
| 				[ -z $val5 ] && val5=5432 | ||||
| 				echo "pgsql_connection = host=$val port=$val5 user=$val2 password=$val3 dbname=$val4" >> $mt | ||||
| 				;; | ||||
| 			"dummy") | ||||
| 				echo "backend = dummy" >> $mt | ||||
| 				;; | ||||
| 			*) | ||||
| 				error "$MAP_BACKEND is not valid";; | ||||
| 		esac | ||||
| 		case $PLAYER_BACKEND in | ||||
| 			"sqlite3"|"") | ||||
| 				echo "player_backend = sqlite3" >> $mt | ||||
| 				;; | ||||
| 			"leveldb") | ||||
| 				echo "player_backend = leveldb" >> $mt | ||||
| 				;; | ||||
| 			"postgresql") | ||||
| 				echo "player_backend = postgresql" >> $mt | ||||
| 				read -p "DB address? ($val) " vval | ||||
| 				read -p "DB user? ($val2) " vval2 | ||||
| 				read -p "DB password? ($val3) " vval3 | ||||
| 				read -p "DB name? (players-$val4) " vval4 | ||||
| 				read -p "DB port? ($val5) " vval5 | ||||
| 				[ -z $vval ] && vval=$val | ||||
| 				[ -z $vval2 ] && vval2=$val2 | ||||
| 				[ -z $vval3 ] && vval3=$val3 | ||||
| 				[ -z $vval4 ] && vval4="players-$val4" | ||||
| 				[ -z $vval5 ] && vval5=$val5 | ||||
| 				echo "pgsql_player_connection = host=$vval port=$vval5 user=$vval2 password=$vval3 dbname=$vval4" >> $mt | ||||
| 				;; | ||||
| 			"dummy") | ||||
| 				echo "player_backend = dummy" >> $mt | ||||
| 				;; | ||||
| 			"files") | ||||
| 				echo "player_backend = files" >> $mt | ||||
| 				;; | ||||
| 			*) | ||||
| 				error "$PLAYER_BACKEND is not valid";; | ||||
| 		esac | ||||
| 		case $AUTH_BACKEND in | ||||
| 			"sqlite3"|"") | ||||
| 				echo "auth_backend = sqlite3" >> $mt | ||||
| 				;; | ||||
| 			"leveldb") | ||||
| 				echo "auth_backend = leveldb" >> $mt | ||||
| 				;; | ||||
| 			"postgresql") | ||||
| 				echo "auth_backend = postgresql" >> $mt | ||||
| 				read -p "DB address? ($val) " vval | ||||
| 				read -p "DB user? ($val2) " vval2 | ||||
| 				read -p "DB password? ($val3) " vval3 | ||||
| 				read -p "DB name? (auth-$val4) " vval4 | ||||
| 				read -p "DB port? ($val5) " vval5 | ||||
| 				[ -z $vval ] && vval=$val | ||||
| 				[ -z $vval2 ] && vval2=$val2 | ||||
| 				[ -z $vval3 ] && vval3=$val3 | ||||
| 				[ -z $vval4 ] && vval4="auth-$val4" | ||||
| 				[ -z $vval5 ] && vval5=$val5 | ||||
| 				echo "pgsql_auth_connection = host=$vval port=$vval5 user=$vval2 password=$vval3 dbname=$vval4" >> $mt | ||||
| 				;; | ||||
| 			"files") | ||||
| 				echo "auth_backend = files" >> $mt | ||||
| 				;; | ||||
| 			*) | ||||
| 				error "$AUTH_BACKEND is not valid";; | ||||
| 		esac | ||||
| 		case $MOD_STORAGE_BACKEND in | ||||
| 			"sqlite3"|"") | ||||
| 				echo "mod_storage_backend = sqlite3" >> $mt | ||||
| 				;; | ||||
| 			"files") | ||||
| 				echo "mod_storage_backend = files" >> $mt | ||||
| 				;; | ||||
| 			"dummy") | ||||
| 				echo "mod_storage_backend = dummy" >> $mt | ||||
| 				;; | ||||
| 			*) | ||||
| 				error "$MOD_STORAGE_BACKEND is not valid";; | ||||
| 		esac | ||||
| 		read -p "Server announce? (y/N) " val | ||||
| 		if [[ $val =~ [yY][eE][sS]|[yY] ]]; then | ||||
| 			echo "server_announce = true" >> $mt | ||||
| 		else | ||||
| 			echo "server_announce = false" >> $mt | ||||
| 		fi | ||||
| 	fi | ||||
|     fi | ||||
| } | ||||
|  | ||||
| install_mtmapper() { | ||||
|     if [ ! -d "$DESTINATION/minetestmapper" ]; then | ||||
| 	echo "Clone Minetest mapper…" | ||||
| 	git clone --depth 1 $URL"/minetest/minetestmapper.git" "$DESTINATION/minetestmapper" | ||||
| 	verif | ||||
|     else | ||||
| 	echo "Upgrading Minetest mapper…" | ||||
| 	if [ ! -d "$DESTINATION/minetestmapper" ]; then | ||||
| 		echo "Clone Minetest mapper…" | ||||
| 		git clone --depth 1 $URL"/minetest/minetestmapper.git" "$DESTINATION/minetestmapper" | ||||
| 		verif | ||||
| 	else | ||||
| 		echo "Upgrading Minetest mapper…" | ||||
| 		pushd "$DESTINATION/minetestmapper" | ||||
| 		git pull | ||||
| 		verif | ||||
| 		popd | ||||
| 	fi | ||||
|  | ||||
| 	pushd "$DESTINATION/minetestmapper" | ||||
| 	git pull | ||||
| 	cmake . | ||||
| 	[ $? -eq 1 ] && error "CMake failed. Check dependencies" | ||||
| 	make -j$(nproc) | ||||
| 	verif | ||||
| 	popd | ||||
|     fi | ||||
|  | ||||
|     pushd "$DESTINATION/minetestmapper" | ||||
|     cmake . | ||||
|     [ $? -eq 1 ] && error "CMake failed. Check dependencies" | ||||
|     make -j$(nproc) | ||||
|     verif | ||||
|     popd | ||||
|  | ||||
|     if [ ! -d "$DESTINATION/leaftest" ]; then | ||||
| 	echo "Installing leaftest…" | ||||
| 	git clone --recursive --depth 1 $URL"nalc/leaftest.git" "$DESTINATION/leaftest" | ||||
| 	verif | ||||
|     else | ||||
| 	echo "Upgrading leaftest…" | ||||
| 	pushd "$DESTINATION/leaftest" | ||||
| 	git pull | ||||
| 	verif | ||||
| 	popd | ||||
|     fi | ||||
| 	if [ ! -d "$DESTINATION/leaftest" ]; then | ||||
| 		echo "Installing leaftest…" | ||||
| 		git clone --recursive --depth 1 $URL"nalc/leaftest.git" "$DESTINATION/leaftest" | ||||
| 		verif | ||||
| 	else | ||||
| 		echo "Upgrading leaftest…" | ||||
| 		pushd "$DESTINATION/leaftest" | ||||
| 		git pull | ||||
| 		verif | ||||
| 		popd | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| post_install() { | ||||
|     if [[ "$DESTINATION" != "$SCRIPT_DIR" ]]; then | ||||
| 	cp "$SCRIPT_DIR/mods_disabled.txt" "$DESTINATION" | ||||
|     fi | ||||
| 	if [[ "$DESTINATION" != "$SCRIPT_DIR" ]]; then | ||||
| 		cp "$SCRIPT_DIR/mods_disabled.txt" "$DESTINATION" | ||||
| 	fi | ||||
|  | ||||
|     "$SCRIPT_DIR"/upgrade.sh -w $WORLD_NAME -b $BRANCH -s "$DESTINATION" | ||||
|     "$SCRIPT_DIR"/upgrade.sh -w $WORLD_NAME -b $BRANCH -f mtconf -s "$DESTINATION" | ||||
| 	"$SCRIPT_DIR"/upgrade.sh -w $WORLD_NAME -b $BRANCH -s "$DESTINATION" | ||||
| 	"$SCRIPT_DIR"/upgrade.sh -w $WORLD_NAME -b $BRANCH -f mtconf -s "$DESTINATION" | ||||
|  | ||||
|     echo "Please, review and edit the following files:" | ||||
|     echo -e "\t- $MINETEST_DIR/minetest.conf" | ||||
|     echo -e "\t- $DESTINATION/mods_disabled.txt" | ||||
|     echo | ||||
|      | ||||
|     if [[ $MINETEST_MAPPER -eq 1 ]]; then | ||||
| 	echo "The use of Minetest Mapper needs ImageMagick with fontconfig and truetype dependencies." | ||||
| 	echo "You also need to allow read and write permissions for PS. The configuration can be found in the file that manage the security policy of ImageMagick." | ||||
|     fi | ||||
| 	echo "Please, review and edit the following files:" | ||||
| 	echo -e "\t- $MINETEST_DIR/minetest.conf" | ||||
| 	echo -e "\t- $DESTINATION/mods_disabled.txt" | ||||
| 	echo | ||||
|  | ||||
| 	if [[ $MINETEST_MAPPER -eq 1 ]]; then | ||||
| 		echo "The use of Minetest Mapper needs ImageMagick with fontconfig and truetype dependencies." | ||||
| 		echo "You also need to allow read and write permissions for PS. The configuration can be found in the file that manage the security policy of ImageMagick." | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| action() { | ||||
|     echo "Preparing the installation…" | ||||
|      | ||||
|     SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) | ||||
|     DESTINATION="$1" | ||||
|     [ -z $DESTINATION ] && DESTINATION="$SCRIPT_DIR" | ||||
| 	echo "Preparing the installation…" | ||||
|  | ||||
|     GIT=$(which git) | ||||
|     CMAKE=$(which cmake) | ||||
|     MAKE=$(which make) | ||||
|     [ ! -e "$GIT" ] && error "git not found" | ||||
|     [ ! -e "$CMAKE" ] && error "cmake not found" | ||||
|     [ ! -e "$MAKE" ] && error "make not found" | ||||
|          | ||||
|     if [ -e "$DESTINATION/nalc.conf" ]; then | ||||
| 	read -p "Previous installation is detected. Do you want to load previous settings? [Y/n] " continue	     | ||||
| 	if [ -z $continue ] || [[ "$continue" =~ ^[yY][eE][sS]|[yY]$ ]]; then | ||||
| 	    load_conf "$DESTINATION/nalc.conf" | ||||
| 	SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) | ||||
| 	DESTINATION="$1" | ||||
| 	[ -z $DESTINATION ] && DESTINATION="$SCRIPT_DIR" | ||||
|  | ||||
| 	GIT=$(which git) | ||||
| 	CMAKE=$(which cmake) | ||||
| 	MAKE=$(which make) | ||||
| 	[ ! -e "$GIT" ] && error "git not found" | ||||
| 	[ ! -e "$CMAKE" ] && error "cmake not found" | ||||
| 	[ ! -e "$MAKE" ] && error "make not found" | ||||
|  | ||||
| 	if [ -e "$DESTINATION/nalc.conf" ]; then | ||||
| 		read -p "Previous installation is detected. Do you want to load previous settings? [Y/n] " continue | ||||
| 		if [ -z $continue ] || [[ "$continue" =~ ^[yY][eE][sS]|[yY]$ ]]; then | ||||
| 			load_conf "$DESTINATION/nalc.conf" | ||||
| 		fi | ||||
| 	fi | ||||
|     fi | ||||
|  | ||||
|     [ -z $MINETEST_BIN ] && MINETEST_BIN=$(which minetestserver) | ||||
|     [ -z $MINETEST_DIR ] && MINETEST_DIR=~/.minetest | ||||
|     [ -z $MAP_BACKEND ] && MAP_BACKEND=sqlite3 | ||||
|     [ -z $PLAYER_BACKEND ] && PLAYER_BACKEND=sqlite3 | ||||
|     [ -z $AUTH_BACKEND ] && AUTH_BACKEND=sqlite3 | ||||
|     [ -z $MOD_STORAGE_BACKEND ] && MOD_STORAGE_BACKEND=sqlite3 | ||||
|     [ -z $MINETEST_MAPPER ] && MINETEST_MAPPER=0 | ||||
|     [ -z $PORT ] && PORT=30000 | ||||
|     [ -z $URL ] && URL="https://sys4.fr/gitea/" | ||||
|     [[ $URL =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]+$ ]] && URL="$URL:" | ||||
|     [ -z $BRANCH ] && BRANCH="stable" | ||||
|     [ -z $WORLD_NAME ] && WORLD_NAME="nalc" | ||||
|     [ ! -e $MINETEST_BIN ] && error "$MINETEST_BIN not found" | ||||
|     [ ! -d $MINETEST_DIR ] && error "$MINETEST_DIR not found" | ||||
| 	[ -z $MINETEST_BIN ] && MINETEST_BIN=$(which minetestserver) | ||||
| 	[ -z $MINETEST_DIR ] && MINETEST_DIR=~/.minetest | ||||
| 	[ -z $MAP_BACKEND ] && MAP_BACKEND=sqlite3 | ||||
| 	[ -z $PLAYER_BACKEND ] && PLAYER_BACKEND=sqlite3 | ||||
| 	[ -z $AUTH_BACKEND ] && AUTH_BACKEND=sqlite3 | ||||
| 	[ -z $MOD_STORAGE_BACKEND ] && MOD_STORAGE_BACKEND=sqlite3 | ||||
| 	[ -z $MINETEST_MAPPER ] && MINETEST_MAPPER=0 | ||||
| 	[ -z $PORT ] && PORT=30000 | ||||
| 	[ -z $URL ] && URL="https://sys4.fr/gitea/" | ||||
| 	[[ $URL =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]+$ ]] && URL="$URL:" | ||||
| 	[ -z $BRANCH ] && BRANCH="stable" | ||||
| 	[ -z $WORLD_NAME ] && WORLD_NAME="nalc" | ||||
| 	[ ! -e $MINETEST_BIN ] && error "$MINETEST_BIN not found" | ||||
| 	[ ! -d $MINETEST_DIR ] && error "$MINETEST_DIR not found" | ||||
|  | ||||
|      | ||||
|     echo "Installation summary:" | ||||
|     echo -e "\t- Server files will be downloaded from $URL" | ||||
|     echo -e "\t- NALC server will be installed to $DESTINATION." | ||||
|     echo -e "\t- World of NALC will be installed to $MINETEST_DIR/worlds/$WORLD_NAME" | ||||
|     echo -e "\t- The minetestserver executable $MINETEST_BIN will be used." | ||||
|     echo -e "\t- The $MINETEST_DIR directory will be used." | ||||
|     echo -e "\t- $MAP_BACKEND will be used as map backend." | ||||
|     echo -e "\t- $PLAYER_BACKEND will be used as player backend." | ||||
|     echo -e "\t- $AUTH_BACKEND will be used as auth backend." | ||||
|     echo -e "\t- $MOD_STORAGE_BACKEND will be used as mod storage backend." | ||||
|     echo -e "\t- Port used: $PORT." | ||||
|     [ $MINETEST_MAPPER -eq 1 ] && echo -e "\t- Minetest mapper support added." | ||||
|     echo | ||||
|  | ||||
|     read -p "Installation of NALC server will begin. Continue? [Y/n] " continue | ||||
|     if [ -z $continue ] || [[ "$continue" =~ ^[yY][eE][sS]|[yY]$ ]]; then | ||||
| 	save_conf "$DESTINATION/nalc.conf" | ||||
| 	install_game | ||||
| 	install_mods | ||||
| 	install_world | ||||
| 	[ $MINETEST_MAPPER -eq 1 ] && install_mtmapper | ||||
| 	post_install | ||||
|     fi | ||||
|      | ||||
|     echo "End of the NALC server installation. Good Bye!" | ||||
|     exit 0 | ||||
| 	echo "Installation summary:" | ||||
| 	echo -e "\t- Server files will be downloaded from $URL" | ||||
| 	echo -e "\t- NALC server will be installed to $DESTINATION." | ||||
| 	echo -e "\t- The $MINETEST_DIR directory will be used." | ||||
| 	echo -e "\t- World of NALC will be installed to $MINETEST_DIR/worlds/$WORLD_NAME" | ||||
| 	echo -e "\t- The minetestserver executable $MINETEST_BIN will be used." | ||||
| 	echo -e "\t- $MAP_BACKEND will be used as map backend." | ||||
| 	echo -e "\t- $PLAYER_BACKEND will be used as player backend." | ||||
| 	echo -e "\t- $AUTH_BACKEND will be used as auth backend." | ||||
| 	echo -e "\t- $MOD_STORAGE_BACKEND will be used as mod storage backend." | ||||
| 	echo -e "\t- Port used: $PORT." | ||||
| 	[ $MINETEST_MAPPER -eq 1 ] && echo -e "\t- Minetest mapper support added." | ||||
| 	echo | ||||
|  | ||||
| 	read -p "Installation of NALC server will begin. Continue? [Y/n] " continue | ||||
| 	if [ -z $continue ] || [[ "$continue" =~ ^[yY][eE][sS]|[yY]$ ]]; then | ||||
| 		save_conf "$DESTINATION/nalc.conf" | ||||
| 		install_game | ||||
| 		install_mods | ||||
| 		install_world | ||||
| 		[ $MINETEST_MAPPER -eq 1 ] && install_mtmapper | ||||
| 		post_install | ||||
| 	fi | ||||
|  | ||||
| 	echo "End of the NALC server installation. Good Bye!" | ||||
| 	exit 0 | ||||
| } | ||||
|  | ||||
| [ $# -lt 0 ] && usage | ||||
| @@ -447,47 +444,47 @@ OPT=$(getopt -o h,b:,d:,m:,p:,a:,s:,M,w:,P: -l help,minetest-bin:,minetest-dir:, | ||||
| set -- $OPT | ||||
|  | ||||
| while true; do | ||||
|     case "$1" in | ||||
| 	-h|--help) | ||||
| 	    usage;; | ||||
| 	-b|--minetest-bin) | ||||
| 	    MINETEST_BIN=$(strip "$2") | ||||
| 	    shift 2;; | ||||
| 	-d|--minetest-dir) | ||||
| 	    MINETEST_DIR=$(strip "$2") | ||||
| 	    shift 2;; | ||||
| 	-m|--map-backend) | ||||
| 	    MAP_BACKEND=$(strip "$2") | ||||
| 	    shift 2;; | ||||
| 	-p|--player-backend) | ||||
| 	    PLAYER_BACKEND=$(strip "$2") | ||||
| 	    shift 2;; | ||||
| 	-a|--auth-backend) | ||||
| 	    AUTH_BACKEND=$(strip "$2") | ||||
| 	    shift 2;; | ||||
| 	-s|--mod-storage-backend) | ||||
| 	    MOD_STORAGE_BACKEND=$(strip "$2") | ||||
| 	    shift 2;; | ||||
| 	-M|--minetest-mapper) | ||||
| 	    MINETEST_MAPPER=1 | ||||
| 	    shift 1;; | ||||
| 	-w|--world) | ||||
| 	    WORLD_NAME=$(strip "$2") | ||||
| 	    shift 2;; | ||||
| 	-P|--port) | ||||
| 	    PORT=$(strip $2) | ||||
| 	    shift 2;; | ||||
| 	--url) | ||||
| 	    URL=$(strip "$2") | ||||
| 	    shift 2;; | ||||
| 	--branch) | ||||
| 	    BRANCH=$(strip "$2") | ||||
| 	    shift 2;; | ||||
| 	--) | ||||
| 	    shift;; | ||||
| 	*) | ||||
| 	    action $(strip "$1") | ||||
| 	    shift;; | ||||
|     esac | ||||
| 	case "$1" in | ||||
| 		-h|--help) | ||||
| 			usage;; | ||||
| 		-b|--minetest-bin) | ||||
| 			MINETEST_BIN=$(strip "$2") | ||||
| 			shift 2;; | ||||
| 		-d|--minetest-dir) | ||||
| 			MINETEST_DIR=$(strip "$2") | ||||
| 			shift 2;; | ||||
| 		-m|--map-backend) | ||||
| 			MAP_BACKEND=$(strip "$2") | ||||
| 			shift 2;; | ||||
| 		-p|--player-backend) | ||||
| 			PLAYER_BACKEND=$(strip "$2") | ||||
| 			shift 2;; | ||||
| 		-a|--auth-backend) | ||||
| 			AUTH_BACKEND=$(strip "$2") | ||||
| 			shift 2;; | ||||
| 		-s|--mod-storage-backend) | ||||
| 			MOD_STORAGE_BACKEND=$(strip "$2") | ||||
| 			shift 2;; | ||||
| 		-M|--minetest-mapper) | ||||
| 			MINETEST_MAPPER=1 | ||||
| 			shift 1;; | ||||
| 		-w|--world) | ||||
| 			WORLD_NAME=$(strip "$2") | ||||
| 			shift 2;; | ||||
| 		-P|--port) | ||||
| 			PORT=$(strip $2) | ||||
| 			shift 2;; | ||||
| 		--url) | ||||
| 			URL=$(strip "$2") | ||||
| 			shift 2;; | ||||
| 		--branch) | ||||
| 			BRANCH=$(strip "$2") | ||||
| 			shift 2;; | ||||
| 		--) | ||||
| 			shift;; | ||||
| 		*) | ||||
| 			action $(strip "$1") | ||||
| 			shift;; | ||||
| 	esac | ||||
| done | ||||
|  | ||||
|   | ||||
| @@ -14,7 +14,7 @@ strict_protocol_version_checking = true | ||||
| enable_damage = true | ||||
| disallow_empty_password = true | ||||
| server_dedicated = true | ||||
| ipv6_server = true | ||||
| ipv6_server = false | ||||
| # 1 day-night cycle lasts 24 minutes instead of 20. | ||||
| time_speed = 30 | ||||
| # Slightly higher player limit by default. | ||||
| @@ -22,7 +22,7 @@ max_users = 12 | ||||
| max_names_per_ip = 2 | ||||
| # Give basics privileges to new players. | ||||
| default_privs = home, spawn | ||||
| basic_privs = areas, areas_high_limit, baker, ban, bring, diglocks, faction_admin, faction_user, fast, fly, fp_create, interact, inv, kick, megabuilder, nether, notice, openlocks, password, protection_bypass, rollback, shop, shout, sign_editor, teleport, warp_admin, warp_user, whois, worldedit | ||||
| basic_privs = areas, areas_high_limit, baker, ban, bring, diglocks, fast, fly, fp_create, interact, inv, kick, megabuilder, nether, notice, openlocks, password, protection_bypass, rollback, shop, shout, sign_editor, teleport, warp_admin, warp_user, whois, worldedit | ||||
| # If true, actions are recorded for rollback | ||||
| enable_rollback_recording = false | ||||
| # Activate fire | ||||
| @@ -138,6 +138,10 @@ log_mods = true | ||||
| ############## | ||||
| craftguide_progressive_mode = true | ||||
|  | ||||
| # playerfactions # | ||||
| ################## | ||||
| player_factions.mode_unique_faction = false | ||||
|  | ||||
| # moremesecons # | ||||
| ################ | ||||
| moremesecons_jammer.enable_lbm = true | ||||
| @@ -149,11 +153,14 @@ moremesecons_sayer.use_speech_dispatcher = false | ||||
| #initial_stuff = "default:axe_wood 1,default:torch 10,default:sapling 2,default:apple 5" | ||||
| # AREAS MOD | ||||
| areas.self_protection = true | ||||
| areas.use_smallest_area_precedence = true | ||||
| # MOBS | ||||
| remove_far_mobs = true | ||||
| mobs_spawn_protected = true | ||||
| mob_difficulty = 1.5 | ||||
| mob_chance_multiplier = 1 | ||||
| mobs_can_hear_node = true | ||||
| mobs_animal.eat_grass_block = true | ||||
| # MOBS custom spawn chance and number | ||||
| #mobs_animal:bee = 9000,2 | ||||
| #mobs_animal:bunny = 15000,2 | ||||
| @@ -331,8 +338,12 @@ mines_deep_min = -64 | ||||
| mines_deep_max = -13800 # default -380 | ||||
| mines_spawnfactor = 1.5 | ||||
|  | ||||
| #h2omes | ||||
| # h2omes | ||||
| h2omes.time_home = 60 | ||||
| h2omes.time_spawn = 150 | ||||
| h2omes.time_from_player = 150 | ||||
| h2omes.time_to_player = 150 | ||||
|  | ||||
| # spears | ||||
| spears_throw_speed = 13 | ||||
| spears_drag_coeff = 0.1 | ||||
|   | ||||
							
								
								
									
										84
									
								
								shutdown.sh
									
									
									
									
									
								
							
							
						
						
									
										84
									
								
								shutdown.sh
									
									
									
									
									
								
							| @@ -13,34 +13,34 @@ 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." | ||||
|     echo -e "\t-m --regen-map\tRégénère une carte du monde." | ||||
|     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() { | ||||
|     kill -s TERM $(pidof minetestserver) | ||||
|     sleep 10 | ||||
| 	kill -s TERM $(pidof minetestserver) | ||||
| 	sleep 10 | ||||
|  | ||||
|     kill -s TERM $(pidof -x $serverpath/start.sh) | ||||
| 	kill -s TERM $(pidof -x $serverpath/start.sh) | ||||
|  | ||||
|     [[ $bak -eq 1 ]] && $serverpath/backup.sh | ||||
|     if [ $regenmap -eq 1 ]; then | ||||
| 	mount $mountpoint | ||||
| 	sleep 3 | ||||
| 	$serverpath/genmap.sh $serverpath $world $mapdest | ||||
| 	umount $mountpoint | ||||
|     fi | ||||
| 	[[ $bak -eq 1 ]] && $serverpath/backup.sh | ||||
| 	if [ $regenmap -eq 1 ]; then | ||||
| 		mount $mountpoint | ||||
| 		sleep 3 | ||||
| 		$serverpath/genmap.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& | ||||
| 	[[ $update -eq 1 ]] && $serverpath/upgrade.sh -s $serverpath -m -w $world -b $branch -f $world_file | ||||
| 	[[ $restart -eq 1 ]] && $serverpath/start.sh& | ||||
|  | ||||
|     exit 0 | ||||
| 	exit 0 | ||||
| } | ||||
|  | ||||
| # Pas de paramètre | ||||
| @@ -56,25 +56,25 @@ OPT=$(getopt -o b,r,h,u,m -l bak,restart,help,update,regen-map -- "$@") | ||||
| set -- $OPT | ||||
|  | ||||
| while true; do | ||||
|     case "$1" in | ||||
|         -b|--bak) | ||||
|             bak=1 | ||||
|             shift;; | ||||
|         -r|--restart) | ||||
|             restart=1 | ||||
|             shift;; | ||||
| 	-h|--help) | ||||
| 	    usage;; | ||||
| 	-u|--update) | ||||
| 	    update=1 | ||||
| 	    shift;; | ||||
| 	-m|--regen-map) | ||||
| 	    regenmap=1 | ||||
| 	    shift;; | ||||
|         --) | ||||
|             shift;; | ||||
|         *) | ||||
|             action | ||||
|             shift;; | ||||
|     esac | ||||
| 	case "$1" in | ||||
| 		-b|--bak) | ||||
| 			bak=1 | ||||
| 			shift;; | ||||
| 		-r|--restart) | ||||
| 			restart=1 | ||||
| 			shift;; | ||||
| 		-h|--help) | ||||
| 			usage;; | ||||
| 		-u|--update) | ||||
| 			update=1 | ||||
| 			shift;; | ||||
| 		-m|--regen-map) | ||||
| 			regenmap=1 | ||||
| 			shift;; | ||||
| 		--) | ||||
| 			shift;; | ||||
| 		*) | ||||
| 			action | ||||
| 			shift;; | ||||
| 	esac | ||||
| done | ||||
|   | ||||
| @@ -12,10 +12,10 @@ | ||||
| serverdir="$1" | ||||
| [ -z "$serverdir" ] && serverdir="$(pwd)" | ||||
| if [ ! -e "$serverdir/nalc.conf" ]; then | ||||
|     echo "ERROR: nalc.conf not found!" | ||||
|     exit 1 | ||||
| 	echo "ERROR: nalc.conf not found!" | ||||
| 	exit 1 | ||||
| else | ||||
|     . "$serverdir/nalc.conf" | ||||
| 	. "$serverdir/nalc.conf" | ||||
| fi | ||||
|  | ||||
| #DEBUG=$serverdir/logs/debug.log | ||||
| @@ -27,13 +27,13 @@ fi | ||||
| #        echo "Server restarted at "`date` >>$MOREDEBUG | ||||
| #        echo "----------------------" >>$MOREDEBUG | ||||
|  | ||||
|         echo "0" >/tmp/players_c.txt | ||||
| echo "0" >/tmp/players_c.txt | ||||
|  | ||||
|         "$MINETEST_BIN" \ | ||||
|                 --world "$MINETEST_DIR/worlds/$WORLD_NAME/" \ | ||||
|                 --config "$MINETEST_DIR/minetest.conf" \ | ||||
|                 --gameid nalc_game \ | ||||
|                 --port $PORT \ | ||||
| #                --logfile $DEBUG | ||||
| "$MINETEST_BIN" \ | ||||
| 	--world "$MINETEST_DIR/worlds/$WORLD_NAME/" \ | ||||
| 	--config "$MINETEST_DIR/minetest.conf" \ | ||||
| 	--gameid nalc_game \ | ||||
| 	--port $PORT \ | ||||
| #	--logfile $DEBUG | ||||
|  | ||||
| #done &>> $MOREDEBUG | ||||
|   | ||||
							
								
								
									
										411
									
								
								upgrade.sh
									
									
									
									
									
								
							
							
						
						
									
										411
									
								
								upgrade.sh
									
									
									
									
									
								
							| @@ -8,223 +8,222 @@ UP_MODS=0 | ||||
| WORLD_FILE=all | ||||
|  | ||||
| strip() { | ||||
|     echo $1 | cut -d \' -f 2 | ||||
| 	echo $1 | cut -d \' -f 2 | ||||
| } | ||||
|  | ||||
| verif() { | ||||
|     if [[ $? -gt 0 ]]; then | ||||
| 	echo "Erreur ! Arrêt du script." | ||||
| 	exit 1 | ||||
|     fi | ||||
| 	if [[ $? -gt 0 ]]; then | ||||
| 		echo "Erreur ! Arrêt du script." | ||||
| 		exit 1 | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| error() { | ||||
|     if [[ -n $1 ]]; then | ||||
| 	echo "ERREUR : $1 !" | ||||
|     else | ||||
| 	echo "ERREUR : paramètres invalides !" >&2 | ||||
| 	echo "utilisez l'option -h pour en savoir plus" >&2 | ||||
|     fi | ||||
|     exit 1 | ||||
| 	if [[ -n $1 ]]; then | ||||
| 		echo "ERREUR : $1 !" | ||||
| 	else | ||||
| 		echo "ERREUR : paramètres invalides !" >&2 | ||||
| 		echo "utilisez l'option -h pour en savoir plus" >&2 | ||||
| 	fi | ||||
| 	exit 1 | ||||
| } | ||||
|  | ||||
| usage() { | ||||
|     echo "Usage : ./upgrade.sh [-h|--help] | [-s|--serverpath <path>] [-m|--mods] [ -w|--world <world> < -b|--branch <branch> [-f|--world-file <arg>] > ]" | ||||
|     echo "WARNING: This is for an experimental usage. Don't use it!" | ||||
|     echo "Options:" | ||||
|     echo -e "\t-h --help\t\tAffiche cette aide" | ||||
|     echo -e "\t-s --serverpath <path>\tRépertoire racine du serveur" | ||||
|     echo -e "\t-m --mods\t\tMet à jour les mods" | ||||
|     echo -e "\t-w --world <name>\tNom de la carte" | ||||
|     echo -e "\t-b --branch <branch>\tBranche concerné" | ||||
|     echo -e "\t-f --world-file <arg>\tFichier(s) a mettre à jour :" | ||||
|     echo -e "\t<arg> doit être une des valeur suivante :" | ||||
|     echo -e "\tall\t\tToutes les mise à jour suivantes seront executés sauf 'mtconf'" | ||||
|     echo -e "\tnews\t\tLes news du serveur" | ||||
|     echo -e "\ttechnic\t\tLes paramètres de technic" | ||||
|     echo -e "\tfbn\t\tLes paramètres de forbidden_names" | ||||
|     echo -e "\tfbnp\t\tLes paramètres de forbidden_names_patterns" | ||||
|     echo -e "\tbitchange\tLes paramètres de bitchange" | ||||
|     echo -e "\tchristmas\tLes paramètres de christmas_craft" | ||||
|     echo -e "\trandommsg\tLes messages aléatoires" | ||||
|     echo -e "\tworldmt\tRégénère le fichier world.mt (peut-être utile avec l'option -m)" | ||||
|     echo -e "\tmtconf\tMet à jour le fichier minetest.conf" | ||||
|     echo "Exemples:" | ||||
|     echo -e "\tMise à jour des mods :" | ||||
|     echo -e "\t$ ./upgrade.sh -m" | ||||
|     echo -e "\tMise à jour du fichier minetest.conf :" | ||||
|     echo -e "\t$ ./upgrade.sh -w nalc-stable -b stable -f mtconf" | ||||
|     echo -e "\tMise à jour complète (mods et fichiers world, sauf minetest.conf) :" | ||||
|     echo -e "\t$ ./upgrade.sh -m -w nalc-stable -b stable" | ||||
| 	echo "Usage : ./upgrade.sh [-h|--help] | [-s|--serverpath <path>] [-m|--mods] [ -w|--world <world> < -b|--branch <branch> [-f|--world-file <arg>] > ]" | ||||
| 	echo "WARNING: This is for an experimental usage. Don't use it!" | ||||
| 	echo "Options:" | ||||
| 	echo -e "\t-h --help\t\tAffiche cette aide" | ||||
| 	echo -e "\t-s --serverpath <path>\tRépertoire racine du serveur" | ||||
| 	echo -e "\t-m --mods\t\tMet à jour les mods" | ||||
| 	echo -e "\t-w --world <name>\tNom de la carte" | ||||
| 	echo -e "\t-b --branch <branch>\tBranche concerné" | ||||
| 	echo -e "\t-f --world-file <arg>\tFichier(s) a mettre à jour :" | ||||
| 	echo -e "\t<arg> doit être une des valeur suivante :" | ||||
| 	echo -e "\tall\t\tToutes les mise à jour suivantes seront executés sauf 'mtconf'" | ||||
| 	echo -e "\tnews\t\tLes news du serveur" | ||||
| 	echo -e "\ttechnic\t\tLes paramètres de technic" | ||||
| 	echo -e "\tfbn\t\tLes paramètres de forbidden_names" | ||||
| 	echo -e "\tfbnp\t\tLes paramètres de forbidden_names_patterns" | ||||
| 	echo -e "\tbitchange\tLes paramètres de bitchange" | ||||
| 	echo -e "\tchristmas\tLes paramètres de christmas_craft" | ||||
| 	echo -e "\trandommsg\tLes messages aléatoires" | ||||
| 	echo -e "\tworldmt\tRégénère le fichier world.mt (peut-être utile avec l'option -m)" | ||||
| 	echo -e "\tmtconf\tMet à jour le fichier minetest.conf" | ||||
| 	echo "Exemples:" | ||||
| 	echo -e "\tMise à jour des mods :" | ||||
| 	echo -e "\t$ ./upgrade.sh -m" | ||||
| 	echo -e "\tMise à jour du fichier minetest.conf :" | ||||
| 	echo -e "\t$ ./upgrade.sh -w nalc-stable -b stable -f mtconf" | ||||
| 	echo -e "\tMise à jour complète (mods et fichiers world, sauf minetest.conf) :" | ||||
| 	echo -e "\t$ ./upgrade.sh -m -w nalc-stable -b stable" | ||||
| } | ||||
|  | ||||
| regen_worldmt() { | ||||
|     local worldfile="$MINETEST_DIR/worlds/$WORLD_NAME/world.mt" | ||||
| 	local worldfile="$MINETEST_DIR/worlds/$WORLD_NAME/world.mt" | ||||
|  | ||||
|     echo "Regénération du fichier $worldfile..." | ||||
| 	echo "Regénération du fichier $worldfile..." | ||||
|  | ||||
|     # Faire une sauvegarde du fichier world.mt actuel | ||||
|     cp "$worldfile" "$worldfile".bak | ||||
|      | ||||
|     # Créer un nouveau fichier temporaire sans les lignes commençant par load_mod | ||||
|     local i=0 | ||||
|     cat "$worldfile" | while read -r line; do | ||||
| 	local match=$(echo $line | grep load_mod_) | ||||
| 	if [[ -z $match ]]; then | ||||
| 	    if [[ $i -eq 0 ]]; then | ||||
| 		echo $line > /tmp/world.mt | ||||
| 	    else | ||||
| 		echo $line >> /tmp/world.mt | ||||
| 	    fi | ||||
| 	fi | ||||
| 	# Faire une sauvegarde du fichier world.mt actuel | ||||
| 	cp "$worldfile" "$worldfile".bak | ||||
|  | ||||
| 	i=$(( $i+1 )) | ||||
|     done | ||||
|      | ||||
|     # 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 l'ajouter au fichier | ||||
| #    local mods_path=$serverpath/nalc-server-mods | ||||
|     local mods="$MINETEST_DIR/mods" | ||||
|     local mods_custom="$serverpath/custom/mods" | ||||
|      | ||||
|     # Suppression d'éventuels liens symboliques du dossier des mods | ||||
|     ls "$mods" | while read -r mod; do | ||||
| 	[ -L "$mods/$mod" ] && rm -f "$mods/$mod" | ||||
|     done | ||||
| 	# Créer un nouveau fichier temporaire sans les lignes commençant par load_mod | ||||
| 	local i=0 | ||||
| 	cat "$worldfile" | while read -r line; do | ||||
| 		local match=$(echo $line | grep load_mod_) | ||||
| 		if [[ -z $match ]]; then | ||||
| 			if [[ $i -eq 0 ]]; then | ||||
| 				echo $line > /tmp/world.mt | ||||
| 			else | ||||
| 				echo $line >> /tmp/world.mt | ||||
| 			fi | ||||
| 		fi | ||||
|  | ||||
|     if [ -d "$mods_custom" ]; then | ||||
| 	ls $mods_custom | while read -r mod; do | ||||
| 	    [ -d $mods_custom/$mod ] && ln -s $mods_custom/$mod $mods/$mod | ||||
| 		i=$(( $i+1 )) | ||||
| 	done | ||||
|     fi | ||||
|  | ||||
|     # Liste des mods à désactiver | ||||
|     readarray -t md < "$serverpath/mods_disabled.txt" | ||||
| 	# 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 l'ajouter au fichier | ||||
| 	#    local mods_path=$serverpath/nalc-server-mods | ||||
| 	local mods="$MINETEST_DIR/mods" | ||||
| 	local mods_custom="$serverpath/custom/mods" | ||||
|  | ||||
|     # Populate world.mt | ||||
|     ls "$mods" | while read -r mod; do | ||||
| 	if [ -d $mods/$mod ]; then | ||||
| 	    if [ -e $mods/$mod/init.lua ]; then | ||||
| 		local mod_enable="true" | ||||
| 		for (( modn=0; modn<${#md[@]}; modn++ )); do | ||||
| 		    [ ${md[$modn]} == $mod ] && mod_enable="false" | ||||
| 	# Suppression d'éventuels liens symboliques du dossier des mods | ||||
| 	ls "$mods" | while read -r mod; do | ||||
| 		[ -L "$mods/$mod" ] && rm -f "$mods/$mod" | ||||
| 	done | ||||
|  | ||||
| 	if [ -d "$mods_custom" ]; then | ||||
| 		ls $mods_custom | while read -r mod; do | ||||
| 			[ -d $mods_custom/$mod ] && ln -s $mods_custom/$mod $mods/$mod | ||||
| 		done | ||||
| 		echo "load_mod_$mod = $mod_enable" >> /tmp/world.mt | ||||
| 	    else | ||||
| 		ls "$mods/$mod" | while read -r submod; do | ||||
| 		    if [ -d "$mods/$mod/$submod" ]; then | ||||
| 			local mod_enable="true" | ||||
| 			for (( modn=0; modn<${#md[@]}; modn++ )); do | ||||
| 			    [ ${md[$modn]} == $submod ] && mod_enable="false" | ||||
| 			done | ||||
| 			echo "load_mod_$submod = $mod_enable" >> /tmp/world.mt | ||||
| 		    fi | ||||
| 		done | ||||
| 	    fi | ||||
| 	fi | ||||
|     done | ||||
|  | ||||
|     # Remplacement du l'ancien world.mt par le nouveau | ||||
|     mv /tmp/world.mt "$MINETEST_DIR/worlds/$WORLD_NAME/world.mt" | ||||
| 	# Liste des mods à désactiver | ||||
| 	readarray -t md < "$serverpath/mods_disabled.txt" | ||||
|  | ||||
|     echo "Regénération terminé." | ||||
| 	# Populate world.mt | ||||
| 	ls "$mods" | while read -r mod; do | ||||
| 		if [ -d $mods/$mod ]; then | ||||
| 			if [ -e $mods/$mod/init.lua ]; then | ||||
| 				local mod_enable="true" | ||||
| 				for (( modn=0; modn<${#md[@]}; modn++ )); do | ||||
| 					[ ${md[$modn]} == $mod ] && mod_enable="false" | ||||
| 				done | ||||
| 				echo "load_mod_$mod = $mod_enable" >> /tmp/world.mt | ||||
| 			else | ||||
| 				ls "$mods/$mod" | while read -r submod; do | ||||
| 					if [ -d "$mods/$mod/$submod" ]; then | ||||
| 						local mod_enable="true" | ||||
| 						for (( modn=0; modn<${#md[@]}; modn++ )); do | ||||
| 							[ ${md[$modn]} == $submod ] && mod_enable="false" | ||||
| 						done | ||||
| 						echo "load_mod_$submod = $mod_enable" >> /tmp/world.mt | ||||
| 					fi | ||||
| 				done | ||||
| 			fi | ||||
| 		fi | ||||
| 	done | ||||
|  | ||||
| 	# Remplacement du l'ancien world.mt par le nouveau | ||||
| 	mv /tmp/world.mt "$MINETEST_DIR/worlds/$WORLD_NAME/world.mt" | ||||
|  | ||||
| 	echo "Regénération terminé." | ||||
| } | ||||
|  | ||||
| update_mods() { | ||||
|     local mods_path="$MINETEST_DIR/mods" | ||||
|     [ ! -d "$mods_path" ] && error "$mods_path not found" | ||||
| 	local mods_path="$MINETEST_DIR/mods" | ||||
| 	[ ! -d "$mods_path" ] && error "$mods_path not found" | ||||
|  | ||||
|     pushd "$mods_path" > /dev/null 2>&1 | ||||
|     git pull | ||||
|     verif | ||||
|     git submodule update --init --recursive | ||||
|     verif | ||||
|     popd > /dev/null 2>&1 | ||||
| 	pushd "$mods_path" > /dev/null 2>&1 | ||||
| 	git pull | ||||
| 	verif | ||||
| 	git submodule update --init --recursive | ||||
| 	verif | ||||
| 	popd > /dev/null 2>&1 | ||||
| } | ||||
|  | ||||
| update_world() { | ||||
|     local world_repos="$SCRIPT_DIR/world" | ||||
|     local world_dest="$MINETEST_DIR/worlds/$WORLD_NAME" | ||||
| 	local world_repos="$SCRIPT_DIR/world" | ||||
| 	local world_dest="$MINETEST_DIR/worlds/$WORLD_NAME" | ||||
|  | ||||
|     if [ ! -d "$world_repos" ]; then | ||||
| 	error "$world_repos not found" | ||||
|     fi | ||||
|     if [ ! -d "$world_dest" ]; then | ||||
| 	error "$world_dest not found" | ||||
|     fi | ||||
|  | ||||
|     if [ $WORLD_FILE == "all" ]; then | ||||
| 	WORLD_FILE="moretrees news technic fbn fbnp bitchange christmas randommsg worldmt" | ||||
|     fi | ||||
|  | ||||
|     for w_file in $WORLD_FILE; do | ||||
| 	local file="" | ||||
| 	local file_dest="" | ||||
| 	local do_copy=1 | ||||
| 	case $w_file in | ||||
| 	    moretrees) | ||||
| 		file_dest=$world_dest/moretrees_settings.txt | ||||
| 		file=$world_repos/moretrees_settings-$BRANCH.txt;; | ||||
| 	    news) | ||||
| 		file_dest=$world_dest/news.txt | ||||
| 		file=$world_repos/news-$BRANCH.txt;; | ||||
| 	    technic) | ||||
| 		file_dest=$world_dest/technic.conf | ||||
| 		file=$world_repos/technic-$BRANCH.conf;; | ||||
| 	    fbn) | ||||
| 		file_dest=$world_dest/forbidden_names.txt | ||||
| 		file=$world_repos/forbidden_names-$BRANCH.txt;; | ||||
| 	    fbnp) | ||||
| 		file_dest=$world_dest/forbidden_names_patterns.txt | ||||
| 		file=$world_repos/forbidden_names_patterns-$BRANCH.txt;; | ||||
| 	    bitchange) | ||||
| 		file_dest=$world_dest/bitchange_config.txt | ||||
| 		file=$world_repos/bitchange_config-$BRANCH.txt;; | ||||
| 	    christmas) | ||||
| 		file_dest=$world_dest/christmas_craft.conf | ||||
| 		file=$world_repos/christmas_craft-$BRANCH.conf;; | ||||
| 	    randommsg) | ||||
| 		file_dest=$world_dest/random_messages | ||||
| 		file=$world_repos/random_messages-$BRANCH;; | ||||
| 	    worldmt) | ||||
| 		do_copy=0 | ||||
| 		regen_worldmt;; | ||||
| 	    mtconf) # Exception ici car n'est pas un fichier world. Doit être appelé seul. | ||||
| 		file_dest="$MINETEST_DIR/minetest.conf" | ||||
| 		file="$SCRIPT_DIR/minetest-$BRANCH.conf";; | ||||
| 	    *) | ||||
| 		error;; | ||||
| 	esac | ||||
|  | ||||
| 	if [ $do_copy -eq 1 ]; then | ||||
| 	    [ ! -e $file ] && error "Le fichier $file n'existe pas" | ||||
| 	     | ||||
| 	    echo "Copie de $file vers $file_dest" | ||||
| 	    cp -up $file $file_dest | ||||
| 	if [ ! -d "$world_repos" ]; then | ||||
| 		error "$world_repos not found" | ||||
| 	fi | ||||
|     done | ||||
| 	if [ ! -d "$world_dest" ]; then | ||||
| 		error "$world_dest not found" | ||||
| 	fi | ||||
|  | ||||
| 	if [ $WORLD_FILE == "all" ]; then | ||||
| 		WORLD_FILE="moretrees news technic fbn fbnp bitchange christmas randommsg worldmt" | ||||
| 	fi | ||||
|  | ||||
| 	for w_file in $WORLD_FILE; do | ||||
| 		local file="" | ||||
| 		local file_dest="" | ||||
| 		local do_copy=1 | ||||
| 		case $w_file in | ||||
| 			moretrees) | ||||
| 				file_dest=$world_dest/moretrees_settings.txt | ||||
| 				file=$world_repos/moretrees_settings-$BRANCH.txt;; | ||||
| 			news) | ||||
| 				file_dest=$world_dest/news.txt | ||||
| 				file=$world_repos/news-$BRANCH.txt;; | ||||
| 			technic) | ||||
| 				file_dest=$world_dest/technic.conf | ||||
| 				file=$world_repos/technic-$BRANCH.conf;; | ||||
| 			fbn) | ||||
| 				file_dest=$world_dest/forbidden_names.txt | ||||
| 				file=$world_repos/forbidden_names-$BRANCH.txt;; | ||||
| 			fbnp) | ||||
| 				file_dest=$world_dest/forbidden_names_patterns.txt | ||||
| 				file=$world_repos/forbidden_names_patterns-$BRANCH.txt;; | ||||
| 			bitchange) | ||||
| 				file_dest=$world_dest/bitchange_config.txt | ||||
| 				file=$world_repos/bitchange_config-$BRANCH.txt;; | ||||
| 			christmas) | ||||
| 				file_dest=$world_dest/christmas_craft.conf | ||||
| 				file=$world_repos/christmas_craft-$BRANCH.conf;; | ||||
| 			randommsg) | ||||
| 				file_dest=$world_dest/random_messages | ||||
| 				file=$world_repos/random_messages-$BRANCH;; | ||||
| 			worldmt) | ||||
| 				do_copy=0 | ||||
| 				regen_worldmt;; | ||||
| 			mtconf) # Exception ici car n'est pas un fichier world. Doit être appelé seul. | ||||
| 				file_dest="$MINETEST_DIR/minetest.conf" | ||||
| 				file="$SCRIPT_DIR/minetest-$BRANCH.conf";; | ||||
| 			*) | ||||
| 				error;; | ||||
| 		esac | ||||
|  | ||||
| 		if [ $do_copy -eq 1 ]; then | ||||
| 			[ ! -e $file ] && error "Le fichier $file n'existe pas" | ||||
|  | ||||
| 			echo "Copie de $file vers $file_dest" | ||||
| 			cp -up $file $file_dest | ||||
| 		fi | ||||
| 	done | ||||
| } | ||||
|  | ||||
| action() { | ||||
|     [ ! -d "$serverpath" ] && error "$serverpath not found" | ||||
|     . "$serverpath/nalc.conf" | ||||
|     [[ $BRANCH == "exp" ]] && BRANCH="experimental" | ||||
| 	[ ! -d "$serverpath" ] && error "$serverpath not found" | ||||
| 	. "$serverpath/nalc.conf" | ||||
|  | ||||
|     if [ $UP_MODS -eq 1 ]; then | ||||
| 	echo "Updating $MINETEST_DIR/mods…" | ||||
| 	update_mods | ||||
| 	echo "Mods updated." | ||||
| 	exit 0 | ||||
|     fi | ||||
| 	if [ $UP_MODS -eq 1 ]; then | ||||
| 		echo "Updating $MINETEST_DIR/mods…" | ||||
| 		update_mods | ||||
| 		echo "Mods updated." | ||||
| 		exit 0 | ||||
| 	fi | ||||
|  | ||||
|     if [ -n $WORLD_NAME ] && [ -n $BRANCH ]; then | ||||
| 	echo "Updating $WORLD_FILE from $WORLD_NAME and branch $BRANCH"… | ||||
| 	update_world | ||||
| 	echo "World files updated." | ||||
|     elif [ -n $WORLD_NAME ] || [ -n $BRANCH ]; then | ||||
| 	error | ||||
|     fi | ||||
| 	if [ -n $WORLD_NAME ] && [ -n $BRANCH ]; then | ||||
| 		echo "Updating $WORLD_FILE from $WORLD_NAME and branch $BRANCH"… | ||||
| 		update_world | ||||
| 		echo "World files updated." | ||||
| 	elif [ -n $WORLD_NAME ] || [ -n $BRANCH ]; then | ||||
| 		error | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| # Pas de paramètre | ||||
| @@ -238,32 +237,32 @@ options=$(getopt -o h,s:,m,w:,b:,f: -l help,serverpath:,mods,world:,branch:,worl | ||||
| set -- $options | ||||
|  | ||||
| while true; do | ||||
|     case "$1" in | ||||
| 	-h|--help) | ||||
| 	    usage | ||||
| 	    exit 0;; | ||||
| 	-s|--serverpath) | ||||
| 	    serverpath=$(strip $2) | ||||
| 	    shift 2;; | ||||
| 	-m|--mods) | ||||
| 	    UP_MODS=1 | ||||
| 	    shift;; | ||||
| 	-w|--world) | ||||
| 	    WORLD_NAME=$(strip $2) | ||||
| 	    shift 2;; | ||||
| 	-b|--branch) | ||||
| 	    BRANCH=$(strip $2) | ||||
| 	    shift 2;; | ||||
| 	-f|--world-file) | ||||
| 	    WORLD_FILE=$(strip $2) | ||||
| 	    shift 2;; | ||||
| 	--) | ||||
| 	    shift;; | ||||
| 	*) | ||||
| 	    action | ||||
| 	    exit 0 | ||||
| 	    shift;; | ||||
|     esac | ||||
| 	case "$1" in | ||||
| 		-h|--help) | ||||
| 			usage | ||||
| 			exit 0;; | ||||
| 		-s|--serverpath) | ||||
| 			serverpath=$(strip $2) | ||||
| 			shift 2;; | ||||
| 		-m|--mods) | ||||
| 			UP_MODS=1 | ||||
| 			shift;; | ||||
| 		-w|--world) | ||||
| 			WORLD_NAME=$(strip $2) | ||||
| 			shift 2;; | ||||
| 		-b|--branch) | ||||
| 			BRANCH=$(strip $2) | ||||
| 			shift 2;; | ||||
| 		-f|--world-file) | ||||
| 			WORLD_FILE=$(strip $2) | ||||
| 			shift 2;; | ||||
| 		--) | ||||
| 			shift;; | ||||
| 		*) | ||||
| 			action | ||||
| 			exit 0 | ||||
| 			shift;; | ||||
| 	esac | ||||
| done | ||||
|  | ||||
| exit 0 | ||||
|   | ||||
| @@ -2,27 +2,15 @@ | ||||
|  | ||||
| -- Enable the various kinds of trees. | ||||
|  | ||||
| moretrees.enable_apple_tree		= false | ||||
| moretrees.enable_oak			= false | ||||
| moretrees.enable_sequoia		= false | ||||
| moretrees.enable_palm			= false | ||||
| moretrees.enable_date_palm		= false | ||||
| moretrees.enable_cedar			= false | ||||
| moretrees.enable_rubber_tree	= false | ||||
| moretrees.enable_willow			= false | ||||
| moretrees.enable_birch			= false | ||||
| moretrees.enable_spruce			= false | ||||
| moretrees.enable_jungle_tree	= false | ||||
| moretrees.enable_fir			= false | ||||
| moretrees.enable_poplar			= false | ||||
| moretrees.enable_beech			= false | ||||
| moretrees.spawn_enabled = false | ||||
| moretrees.grow_legacy_saplings = true | ||||
|  | ||||
| -- set this to true to make moretrees spawn saplings at mapgen time instead | ||||
| -- of fully-grown trees, which will grow into full trees after a very short | ||||
| -- delay.  This reduces mapgen lag in some situations, and fixes situations | ||||
| -- where the mapgen conflicts with the tree generator. | ||||
|  | ||||
| moretrees.spawn_saplings		= true | ||||
| moretrees.spawn_saplings		= false | ||||
|  | ||||
| -- Set this to true to allow defining stairs/slabs/etc.  If Moreblocks is | ||||
| -- installed, this will use that mod's Stairs Plus component.  Otherwise, it | ||||
|   | ||||
| @@ -2,7 +2,34 @@ | ||||
|  | ||||
|   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 | ||||
| ————————————————————————————————————————— | ||||
| * e9a6991 | 29/3/25 | [moretrees] Allows to disable saplings spawn | ||||
| * 51cef35 | 23/3/25 | Add craftguide again | ||||
| * 5335389 | 23/3/25 | Add nalc_dyes mod to fix dyes crafting #123 | ||||
| * a343352 | 23/3/25 | Replace factions mod by playerfactions mod | ||||
| * 337430f | 21/3/25 | [mobs_monster] add sand variation in sand monster drops, same with dirt monster | ||||
| * 29a01ad | 21/3/25 | Rename lighting_monoids to lighting_monoid | ||||
| * 7d9d1d1 | 21/3/25 | Add lighting_monoids mod | ||||
| * 3288334 | 20/3/25 | Mods update | ||||
| * a888b81 | 19/9/24 | [areas] Fix startup crash | ||||
| * 211bb82 | 15/9/24 | Add fakelib module as submodule | ||||
| * 41af8b1 | 15/9/24 | Add xcompat mod as submodule | ||||
| * 51f6256 | 15/9/24 | Change URL of regional_weather submodule | ||||
| * 34ec80c | 15/9/24 | Mods update | ||||
| * 5b1807b | 13/12/23| [unifiedbricks] Fix missing textures | ||||
| * c92191e | 13/12/23| Mods update | ||||
| * 9b8eedd | 26/11/23| [moreplants] Fix blueflower biome spawn | ||||
| * ef549a8 | 26/11/23| [plantfife_modpack] Fix startup crash | ||||
| * dfcb790 | 26/11/23| [unifiedbricks] Fix missing dependency to moreblocks | ||||
| * 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 | ||||
| ————————————————————————————————————————— | ||||
|   | ||||
		Reference in New Issue
	
	Block a user