1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minetest_ynh.git synced 2024-09-03 20:36:00 +02:00
This commit is contained in:
Rafi594 2019-10-23 12:06:42 +02:00
parent f1a7402f37
commit 9a03ac105f
12 changed files with 153 additions and 27 deletions

View file

@ -61,7 +61,7 @@ You can't migrate directly with an update.
* Start the Minetest service `sudo systemctl start minetest` * Start the Minetest service `sudo systemctl start minetest`
* Installing mods * Installing mods
* For installing mods you need to create a mods folder in /home/yunohost.app/minetest/.minetest * For installing mods you need to create a worldmods folder in /home/yunohost.app/minetest/.minetest/worlds/world/.
* Clone the repo of the mod in this folder (ex: git clone https://github.com/minetest-mods/mesecons) * Clone the repo of the mod in this folder (ex: git clone https://github.com/minetest-mods/mesecons)
* Edit /home/yunohost.app/minetest/.minetest/worlds/world/world.mt and add at the end ```load_mod_mesecons = true``` * Edit /home/yunohost.app/minetest/.minetest/worlds/world/world.mt and add at the end ```load_mod_mesecons = true```
* Restart Minetest with ```sudo systemctl restart minetest``` * Restart Minetest with ```sudo systemctl restart minetest```

View file

@ -22,7 +22,7 @@
setup_public=0 setup_public=0
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=1
incorrect_path=0 incorrect_path=0
port_already_use=1 port_already_use=1
change_url=0 change_url=0

93
conf/README_fr.md Normal file
View file

@ -0,0 +1,93 @@
# Minetest for YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/minetest.svg)](https://dash.yunohost.org/appci/app/minetest)](https://dash.yunohost.org/appci/app/minetest)
[![Installer Minetest avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=minetest)(https://install-app.yunohost.org/?app=minetest)
*[Read this readme in English.](./README.md)*
> *Ce package vous permet d'installer Minetest rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, veuillez consulter[ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Aperçu
Minetest est un moteur de jeu voxel open-source gratuit avec modding et création de jeu faciles.
**Version livrée:** 5.1.0
## Captures d'écran
![](https://www.minetest.net/media/gallery/1.jpg)
## Démo
Pas de démo mais vous pouvez tester avec des serveurs sur https://servers.minetest.net/
## Configuration
Comment configurer cette application : par SSH
## Documentation
* Documentation officielle : https://wiki.minetest.net/
* Documentation YunoHost : https://yunohost.org/#/minetest
## Caractéristiques spécifiques de YunoHost
#### Support multi-utilisateurs
Les authentifications LDAP et HTTP sont-elles prises en charge ? Non
L'application peut-elle être utilisée par plusieurs utilisateurs ? Oui
##### Architectures supportées
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/minetest%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/minetest/)](https://ci-apps.yunohost.org/ci/apps/minetest/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/minetest%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/minetest/)](https://ci-apps-arm.yunohost.org/ci/apps/minetest/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/minetest%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/minetest/)](https://ci-stretch.nohost.me/ci/apps/minetest/)
## Limitations
* Cette application n'est pas compatible avec LDAP.
## Renseignements supplémentaires
* Migration de l'ancien paquet
Vous ne pouvez pas migrer directement avec une mise à jour.
* Avant d'installer le nouveau paquetage, vous devez télécharger ce dossier depuis votre serveur `/var/games/minetest-server/.minetest/worlds/world` (ce dossier contient toutes les données mondiales)
* Désinstallez l'ancien paquetage `sudo yunohost application remove minetest`.
* Installez le nouveau `sudo yunohost yunohost application install https://github.com/YunoHost-Apps/minetest_ynh``
* Stop Minetest service `sudo systemctl systemctl stop minetest`
* Copiez le dossier que vous avez copié auparavant dans `/home/yunohost.app/minetest/.minetest/.worlds'.
* Démarrer le service Minetest `sudo systemctl démarre minetest`.
* Installer les mods
* Pour installer les mods, vous devez créer un dossier worldmods dans /home/yunohost.app/minetest/.minetest/worlds/world/.
* Cloner le repo du mod dans ce dossier (ex : git clone https://github.com/minetest-mods/mesecons)
* Editez /home/yunohost.app/minetest/.minetest/worlds/world/world/world.mt et ajoutez à la fin ````load_mod_mesecons = true```.
* Redémarrer Minetest avec ```sudo systemctl restart minetest```
* Le mod est maintenant installé :)
**Plus d'informations sur la page documentation:**
https://yunohost.org/packaging_apps
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/minetest_ynh/issues
* Site Web de l'application : https://minetest.net/
* Site web de YunoHost : https://yunohost.org/
---
Infos développeurs
----------------
**Uniquement si vous voulez utiliser une branche de test pour le codage, au lieu de fusionner directement dans le master.**
Veuillez faire votre demande de tirage à la[succursale de test] (https://github.com/YunoHost-Apps/minetest_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost installent l'application https://github.com/YunoHost-Apps/minetest_ynh/tree/testing --debug
ou
sudo yunohost mise à jour de l'application minetest -u https://github.com/YunoHost-Apps/minetest_ynh/tree/testing --debug
```

View file

@ -41,7 +41,7 @@ serverlist_url = servers.minetest.net
default_game = minetest default_game = minetest
# World directory (everything in the world is stored here) # World directory (everything in the world is stored here)
map-dir = /home/yunohost.app/minetest/.minetest/worlds/world map-dir = /home/yunohost.app/__APP__/.minetest/worlds/world
# Message of the Day # Message of the Day
motd = Welcome to Minetest. Enjoy your stay! motd = Welcome to Minetest. Enjoy your stay!

6
conf/minetest_game.src Normal file
View file

@ -0,0 +1,6 @@
SOURCE_URL=https://github.com/minetest/minetest_game/archive/5.1.0.tar.gz
SOURCE_SUM=f165fac0081bf4797cf9094282cc25034b2347b3ea94e6bb8d9329c5ee63f41b
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=false
SOURCE_FILENAME=minetest_game-5.1.0.tar.gz

View file

@ -2,11 +2,11 @@
Description=Minetest multiplayer server minetest.conf server config Description=Minetest multiplayer server minetest.conf server config
Documentation=man:minetestserver(6) Documentation=man:minetestserver(6)
After=network.target After=network.target
RequiresMountsFor=/home/yunohost.app/minetest RequiresMountsFor=/home/yunohost.app/__APP__
[Service] [Service]
Restart=on-failure Restart=on-failure
User=minetest User=__APP__
Group=minetest Group=__APP__
ExecStart=/opt/yunohost/minetest/bin/minetestserver --config /home/yunohost.app/minetest/.minetest/minetest.conf --logfile /var/log/minetest/minetest.log ExecStart=__FINALPATH__/bin/minetestserver --config /home/yunohost.app/__APP__/.minetest/minetest.conf --logfile /var/log/__APP__/minetest.log
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -22,7 +22,7 @@
"requirements": { "requirements": {
"yunohost": ">= 3.5" "yunohost": ">= 3.5"
}, },
"multi_instance": false, "multi_instance": true,
"services": [ "services": [
"nginx" "nginx"
], ],

View file

@ -33,7 +33,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
# Stop Minetest before backup... # Stop Minetest before backup...
systemctl stop minetest systemctl stop $app
ynh_print_info --message="Backing up the main app directory..." ynh_print_info --message="Backing up the main app directory..."
@ -66,6 +66,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
# Restart Minetest # Restart Minetest
systemctl start minetest systemctl start $app
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -50,8 +50,8 @@ change_path=0
# SPECIFIC MODIFICATIONS # SPECIFIC MODIFICATIONS
#================================================= #=================================================
ynh_print_info --message="Stop Minetest..." ynh_print_info --message="Stop Minetest..."
systemctl stop minetest systemctl stop $app
ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="/home/yunohost.app/minetest/.minetest/minetest.conf" ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="/home/yunohost.app/$app/.minetest/minetest.conf"
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
@ -60,7 +60,7 @@ ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" -
#================================================= #=================================================
ynh_print_info --message="Reloading Minetest..." ynh_print_info --message="Reloading Minetest..."
systemctl start minetest systemctl start $app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -156,14 +156,15 @@ ynh_add_systemd_config
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
# Compile Minetest # Compile Minetest
cd /opt/yunohost/$app pushd /opt/yunohost/$app
# Download Minetest Game # Download Minetest Game
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game -b stable-5 ynh_setup_source --dest_dir=/opt/yunohost/$app/games/minetest_game --source_id=minetest_game
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
make -j$(nproc) make -j$(nproc)
popd
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
@ -172,6 +173,7 @@ make -j$(nproc)
### `ynh_replace_string` is used to replace a string in a file. ### `ynh_replace_string` is used to replace a string in a file.
### (It's compatible with sed regular expressions syntax) ### (It's compatible with sed regular expressions syntax)
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$home_path/.minetest/minetest.conf" ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__SERVERNAME__" --replace_string="$servername" --target_file="$home_path/.minetest/minetest.conf" ynh_replace_string --match_string="__SERVERNAME__" --replace_string="$servername" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$home_path/.minetest/minetest.conf" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$home_path/.minetest/minetest.conf"
@ -194,9 +196,9 @@ mkdir /var/log/$app
fi fi
# Set permissions on logs # Set permissions on logs
chown -R minetest:minetest /var/log/minetest chown -R $app:$app /var/log/$app
systemctl start minetest systemctl start $app
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # STORE THE CONFIG FILE CHECKSUM
@ -221,7 +223,7 @@ ynh_store_file_checksum --file="$home_path/.minetest/minetest.conf"
# Set permissions to app files # Set permissions to app files
chown -R root: $final_path chown -R root: $final_path
chown -R minetest: $home_path chown -R $app: $home_path
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
@ -260,7 +262,7 @@ yunohost service add $app --log "/var/log/$app/$app.log"
#================================================= #=================================================
ynh_print_info --message="Reloading minetest..." ynh_print_info --message="Reloading minetest..."
ynh_systemd_action --action=restart --line_match="Server for gameid=minetest listening on :::30000." --log_path="/var/log/minetest/minetest.log" ynh_systemd_action --action=restart --line_match="Server for gameid=minetest listening on :::30000." --log_path="/var/log/$app/minetest.log"
sleep 1 sleep 1
#================================================= #=================================================

View file

@ -64,7 +64,7 @@ ynh_restore_file --origin_path="$home_path"
# Restore permissions on app files # Restore permissions on app files
chown -R root: $final_path chown -R root: $final_path
chown -R minetest: /home/yunohost.app/minetest chown -R $app: /home/yunohost.app/$app
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
@ -104,8 +104,8 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
ynh_print_info --message="Reloading minetest..." ynh_print_info --message="Reloading minetest..."
systemctl restart minetest systemctl restart $app
ynh_systemd_action -l "ACTION[Main]: Server for gameid="minetest" listening on 0.0.0.0:30000." -p "/var/log/minetest/minetest.log" ynh_systemd_action -l "ACTION[Main]: Server for gameid="minetest" listening on 0.0.0.0:30000." -p "/var/log/$app/minetest.log"
sleep 1 sleep 1
#================================================= #=================================================

View file

@ -17,9 +17,15 @@ ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
is_public=$(ynh_app_setting_get --app=$app --key=is_public) is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
home_path=$(ynh_app_setting_get --app=$app --key=home_path) home_path=$(ynh_app_setting_get --app=$app --key=home_path)
pvp=$(ynh_app_setting_get --app=$app --key=pvp)
creative=$(ynh_app_setting_get --app=$app --key=creative)
damage=$(ynh_app_setting_get --app=$app --key=damage)
servername=$(ynh_app_setting_get --app=$app --key=servername)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
@ -37,7 +43,7 @@ fi
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z $final_path ]; then if [ -z $final_path ]; then
final_path=/var/www/$app final_path=/opt/yunohost/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
@ -95,20 +101,38 @@ ynh_add_systemd_config
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
# Compile Minetest # Compile Minetest
cd /opt/yunohost/$app pushd /opt/yunohost/$app
# Download Minetest Game # Download Minetest Game
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game -b stable-5 ynh_setup_source --dest_dir=/opt/yunohost/$app/games/minetest_game --source_id=minetest_game
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
make -j$(nproc) make -j$(nproc)
popd
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE" ynh_backup_if_checksum_is_different --file="$home_path/.minetest/minetest.conf"
# Recalculate and store the checksum of the file for the next upgrade. # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$home_path/.minetest/minetest.conf" ynh_store_file_checksum --file="$home_path/.minetest/minetest.conf"
#=================================================
# MODIFY A CONFIG FILE
#=================================================
### `ynh_replace_string` is used to replace a string in a file.
### (It's compatible with sed regular expressions syntax)
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__SERVERNAME__" --replace_string="$servername" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__ANNOUNCE__" --replace_string="$is_public" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__PVP__" --replace_string="$pvp" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__CREATIVE__" --replace_string="$creative" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__DAMAGE__" --replace_string="$damage" --target_file="$home_path/.minetest/minetest.conf"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
@ -127,13 +151,14 @@ ynh_use_logrotate --non-append
# Set permissions on app files # Set permissions on app files
chown -R root: $final_path chown -R root: $final_path
chown -R $app: $home_path
#================================================= #=================================================
# RELOAD MINETEST # RELOAD MINETEST
#================================================= #=================================================
ynh_print_info --message="Restarting Minetest..." ynh_print_info --message="Restarting Minetest..."
systemctl restart minetest systemctl restart $app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT