Update scripts
This commit is contained in:
parent
7ce0a58314
commit
a03e3de743
31
backup.sh
Executable file
31
backup.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
bak=/home/minetest/nalc-server-0.4/backup
|
||||||
|
if [[ ! -d $bak ]]; then
|
||||||
|
mkdir $bak
|
||||||
|
fi
|
||||||
|
|
||||||
|
bak_tmp=/var/tmp/nalc-0.4_dump
|
||||||
|
if [[ ! -d $bak_tmp ]]; then
|
||||||
|
mkdir $bak_tmp
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -r /home/minetest/nalc-server-0.4/minetest/worlds/nalc/rollback.sqlite
|
||||||
|
tar -I pbzip2 -cvf $bak/world.tar.bz2 /home/minetest/nalc-server-0.4/minetest/worlds/nalc
|
||||||
|
|
||||||
|
pg_dump nalc-0.4 > $bak_tmp/nalc-0.4.sql
|
||||||
|
pg_dump players-nalc-0.4 > $bak_tmp/players-nalc-0.4.sql
|
||||||
|
|
||||||
|
if [[ -e $bak/dump_sql.tar.bz2 ]]; then
|
||||||
|
cd $bak
|
||||||
|
tar -jxvf dump_sql.tar.bz2
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
|
||||||
|
rdiff-backup --no-file-statistics $bak_tmp $bak
|
||||||
|
|
||||||
|
cd $bak
|
||||||
|
tar -I pbzip2 -cvf dump_sql.tar.bz2 --remove-files *.sql
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
rm -rf $bak_tmp
|
33
install.sh
33
install.sh
@ -25,9 +25,9 @@ usage() {
|
|||||||
echo "--makeopt | -j : Passer des options à make."
|
echo "--makeopt | -j : Passer des options à make."
|
||||||
echo "--ssh <user@host>: Identifiants ssh."
|
echo "--ssh <user@host>: Identifiants ssh."
|
||||||
echo "--url <URL>: URL distante personnalisée."
|
echo "--url <URL>: URL distante personnalisée."
|
||||||
|
echo -e "\tSi l'option --ssh est passée en option, il s'agira du chemin distant."
|
||||||
echo "--irrlicht | -i : Chemin personnalisé des sources irrlicht."
|
echo "--irrlicht | -i : Chemin personnalisé des sources irrlicht."
|
||||||
echo "--postgresql | -p : Si vous voulez que le serveur soit configuré avec postgresql"
|
echo "--postgresql | -p : Si vous voulez que le serveur soit configuré avec postgresql"
|
||||||
echo -e "\tSi l'option --ssh est passée en option, il s'agira du chemin distant."
|
|
||||||
echo "Commandes :"
|
echo "Commandes :"
|
||||||
echo -e "\t0.5 : Installation du serveur avec minetest-0.5.x. Suivez les instructions..."
|
echo -e "\t0.5 : Installation du serveur avec minetest-0.5.x. Suivez les instructions..."
|
||||||
echo -e "\t0.4 : Installation du serveur avec minetest-0.4.x. Suivez les instructions..."
|
echo -e "\t0.4 : Installation du serveur avec minetest-0.4.x. Suivez les instructions..."
|
||||||
@ -67,11 +67,11 @@ postgresql() {
|
|||||||
read -p "Indiquez le mot de passe : " pg_password
|
read -p "Indiquez le mot de passe : " pg_password
|
||||||
read -p "Indiquez le nom de la BDD à utiliser : " pg_dbname
|
read -p "Indiquez le nom de la BDD à utiliser : " pg_dbname
|
||||||
|
|
||||||
echo "gameid = minetest_game" > worldmt.conf
|
echo "gameid = minetest_game" > world.mt
|
||||||
echo "backend = postgresql" >> worldmt.conf
|
echo "backend = postgresql" >> world.mt
|
||||||
echo "player_backend = postgresql" >> worldmt.conf
|
echo "player_backend = postgresql" >> world.mt
|
||||||
echo "pgsql_connection = host=$pg_url user=$pg_user password=$pg_password dbname=$pg_dbname" >> worldmt.conf
|
echo "pgsql_connection = host=$pg_url user=$pg_user password=$pg_password dbname=$pg_dbname" >> world.mt
|
||||||
echo "pgsql_player_connection = host=$pg_url user=$pg_user password=$pg_password dbname=players-$pg_dbname" >> worldmt.conf
|
echo "pgsql_player_connection = host=$pg_url user=$pg_user password=$pg_password dbname=players-$pg_dbname" >> world.mt
|
||||||
}
|
}
|
||||||
|
|
||||||
install_0.4() {
|
install_0.4() {
|
||||||
@ -181,7 +181,7 @@ install_minetest_game() {
|
|||||||
|
|
||||||
if [[ ! -d minetest_game ]]; then
|
if [[ ! -d minetest_game ]]; then
|
||||||
local branch="-b master"
|
local branch="-b master"
|
||||||
if [[ ! $ver == "0.4" ]]; then
|
if [[ $ver == "0.4" ]]; then
|
||||||
branch="-b backport-0.4"
|
branch="-b backport-0.4"
|
||||||
fi
|
fi
|
||||||
git clone $branch $URL/minetest_game.git
|
git clone $branch $URL/minetest_game.git
|
||||||
@ -226,19 +226,15 @@ install_world() {
|
|||||||
createdb players-$pg_dbname
|
createdb players-$pg_dbname
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $ver == "0.4" ]]; then
|
|
||||||
ln -s $(pwd)/server-0.4/worlds/minetestforfun/world.mt minetest/worlds/nalc/world.mt
|
|
||||||
else
|
|
||||||
ln -s $(pwd)/world.mt minetest/worlds/nalc/world.mt
|
ln -s $(pwd)/world.mt minetest/worlds/nalc/world.mt
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_mods() {
|
install_mods() {
|
||||||
if [[ $ver == "0.4" ]]; then
|
if [[ $ver == "0.4" ]]; then
|
||||||
local i=0
|
local i=0
|
||||||
local md[1]="" # Mods to disable
|
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
|
for mod in mysql_auth watershed mobs_old magicmithril obsidian eventobjects player_inactive random_messages irc irc_commands profilerdumper profnsched; do
|
||||||
i=$(( $i+1 ))
|
i=$(( $i+1 ))
|
||||||
md[$i]=$mod
|
md[$i]=$mod
|
||||||
done
|
done
|
||||||
@ -248,17 +244,17 @@ install_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
|
if [[ -a world.mt && -z $pg_dbname ]]; then
|
||||||
rm world.mt
|
rm world.mt
|
||||||
fi
|
|
||||||
cp worldmt.conf world.mt
|
cp worldmt.conf world.mt
|
||||||
|
fi
|
||||||
|
|
||||||
ls server-0.4/mods | while read -r mod; do
|
ls server-0.4/mods | while read -r mod; do
|
||||||
if [[ -a server-0.4/mods/$mod/modpack.txt ]]; then
|
if [[ -a server-0.4/mods/$mod/modpack.txt ]]; then
|
||||||
ls server-0.4/mods/$mod | while read -r submod; do
|
ls server-0.4/mods/$mod | while read -r submod; do
|
||||||
if [[ -d server-0.4/mods/$mod/$submod ]]; then
|
if [[ -d server-0.4/mods/$mod/$submod ]]; then
|
||||||
local mod_enable="true"
|
local mod_enable="true"
|
||||||
for (( modn=1; modn<$i; modn++ )); do
|
for (( modn=1; modn<=$i; modn++ )); do
|
||||||
if [[ ${md[$modn]} == $submod ]]; then
|
if [[ ${md[$modn]} == $submod ]]; then
|
||||||
mod_enable="false"
|
mod_enable="false"
|
||||||
fi
|
fi
|
||||||
@ -268,7 +264,7 @@ install_mods() {
|
|||||||
done
|
done
|
||||||
else
|
else
|
||||||
local mod_enable="true"
|
local mod_enable="true"
|
||||||
for (( modn=1; modn<$i; modn++ )); do
|
for (( modn=1; modn<=$i; modn++ )); do
|
||||||
if [[ ${md[$modn]} == $mod ]]; then
|
if [[ ${md[$modn]} == $mod ]]; then
|
||||||
mod_enable="false"
|
mod_enable="false"
|
||||||
fi
|
fi
|
||||||
@ -306,11 +302,10 @@ install_mods() {
|
|||||||
# Recréation des liens symboliques et du fichier world.mt (dans tous les cas)
|
# Recréation des liens symboliques et du fichier world.mt (dans tous les cas)
|
||||||
rm minetest/mods/*
|
rm minetest/mods/*
|
||||||
|
|
||||||
if [[ -a world.mt ]]; then
|
if [[ -a world.mt && -z $pg_dbname ]]; then
|
||||||
rm world.mt
|
rm world.mt
|
||||||
fi
|
|
||||||
|
|
||||||
cp worldmt.conf world.mt
|
cp worldmt.conf world.mt
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -d custom/mods ]]; then
|
if [[ -d custom/mods ]]; then
|
||||||
ls custom/mods | while read -r mod; do
|
ls custom/mods | while read -r mod; do
|
||||||
|
Loading…
Reference in New Issue
Block a user