From 9a03ac105ff32e0822bc861dad0c74568ef41c56 Mon Sep 17 00:00:00 2001 From: Rafi594 Date: Wed, 23 Oct 2019 12:06:42 +0200 Subject: [PATCH] Fixes --- README.md | 2 +- check_process | 2 +- conf/README_fr.md | 93 ++++++++++++++++++++++++++++++++++++++++++ conf/minetest.conf | 2 +- conf/minetest_game.src | 6 +++ conf/systemd.service | 8 ++-- manifest.json | 2 +- scripts/backup | 4 +- scripts/change_url | 6 +-- scripts/install | 14 ++++--- scripts/restore | 6 +-- scripts/upgrade | 35 +++++++++++++--- 12 files changed, 153 insertions(+), 27 deletions(-) create mode 100644 conf/README_fr.md create mode 100644 conf/minetest_game.src diff --git a/README.md b/README.md index 3fe1517..45233b4 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ You can't migrate directly with an update. * Start the Minetest service `sudo systemctl start minetest` * 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) * 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``` diff --git a/check_process b/check_process index f8d85fb..b05c831 100644 --- a/check_process +++ b/check_process @@ -22,7 +22,7 @@ setup_public=0 upgrade=1 backup_restore=1 - multi_instance=0 + multi_instance=1 incorrect_path=0 port_already_use=1 change_url=0 diff --git a/conf/README_fr.md b/conf/README_fr.md new file mode 100644 index 0000000..0992f06 --- /dev/null +++ b/conf/README_fr.md @@ -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 +``` \ No newline at end of file diff --git a/conf/minetest.conf b/conf/minetest.conf index 2db8b34..b76f8a2 100644 --- a/conf/minetest.conf +++ b/conf/minetest.conf @@ -41,7 +41,7 @@ serverlist_url = servers.minetest.net default_game = minetest # 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 motd = Welcome to Minetest. Enjoy your stay! diff --git a/conf/minetest_game.src b/conf/minetest_game.src new file mode 100644 index 0000000..f7da171 --- /dev/null +++ b/conf/minetest_game.src @@ -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 \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index 7d2d9b8..c9e53e2 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -2,11 +2,11 @@ Description=Minetest multiplayer server minetest.conf server config Documentation=man:minetestserver(6) After=network.target -RequiresMountsFor=/home/yunohost.app/minetest +RequiresMountsFor=/home/yunohost.app/__APP__ [Service] Restart=on-failure -User=minetest -Group=minetest -ExecStart=/opt/yunohost/minetest/bin/minetestserver --config /home/yunohost.app/minetest/.minetest/minetest.conf --logfile /var/log/minetest/minetest.log +User=__APP__ +Group=__APP__ +ExecStart=__FINALPATH__/bin/minetestserver --config /home/yunohost.app/__APP__/.minetest/minetest.conf --logfile /var/log/__APP__/minetest.log [Install] WantedBy=multi-user.target diff --git a/manifest.json b/manifest.json index d5734f4..35dda9b 100644 --- a/manifest.json +++ b/manifest.json @@ -22,7 +22,7 @@ "requirements": { "yunohost": ">= 3.5" }, - "multi_instance": false, + "multi_instance": true, "services": [ "nginx" ], diff --git a/scripts/backup b/scripts/backup index 4b6445f..f81bbf5 100755 --- a/scripts/backup +++ b/scripts/backup @@ -33,7 +33,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) # BACKUP THE APP MAIN DIR #================================================= # Stop Minetest before backup... -systemctl stop minetest +systemctl stop $app 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 #================================================= # 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)." diff --git a/scripts/change_url b/scripts/change_url index 10fe9e2..776d535 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -50,8 +50,8 @@ change_path=0 # SPECIFIC MODIFICATIONS #================================================= ynh_print_info --message="Stop Minetest..." -systemctl stop minetest -ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="/home/yunohost.app/minetest/.minetest/minetest.conf" +systemctl stop $app +ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="/home/yunohost.app/$app/.minetest/minetest.conf" #================================================= # GENERIC FINALISATION @@ -60,7 +60,7 @@ ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" - #================================================= ynh_print_info --message="Reloading Minetest..." -systemctl start minetest +systemctl start $app #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 37d0376..229489f 100755 --- a/scripts/install +++ b/scripts/install @@ -156,14 +156,15 @@ ynh_add_systemd_config # SPECIFIC SETUP #================================================= # Compile Minetest -cd /opt/yunohost/$app +pushd /opt/yunohost/$app # 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 make -j$(nproc) +popd #================================================= # MODIFY A CONFIG FILE @@ -172,6 +173,7 @@ make -j$(nproc) ### `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" @@ -194,9 +196,9 @@ mkdir /var/log/$app fi # 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 @@ -221,7 +223,7 @@ ynh_store_file_checksum --file="$home_path/.minetest/minetest.conf" # Set permissions to app files chown -R root: $final_path -chown -R minetest: $home_path +chown -R $app: $home_path #================================================= # SETUP LOGROTATE @@ -260,7 +262,7 @@ yunohost service add $app --log "/var/log/$app/$app.log" #================================================= 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 #================================================= diff --git a/scripts/restore b/scripts/restore index 238e74a..17af4e3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -64,7 +64,7 @@ ynh_restore_file --origin_path="$home_path" # Restore permissions on app files chown -R root: $final_path -chown -R minetest: /home/yunohost.app/minetest +chown -R $app: /home/yunohost.app/$app #================================================= # SPECIFIC RESTORATION @@ -104,8 +104,8 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= ynh_print_info --message="Reloading minetest..." -systemctl restart minetest -ynh_systemd_action -l "ACTION[Main]: Server for gameid="minetest" listening on 0.0.0.0:30000." -p "/var/log/minetest/minetest.log" +systemctl restart $app +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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 26dafe5..5962e1f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,9 +17,15 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME 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) final_path=$(ynh_app_setting_get --app=$app --key=final_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 @@ -37,7 +43,7 @@ fi # If final_path doesn't exist, create it 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 fi @@ -95,20 +101,38 @@ ynh_add_systemd_config # SPECIFIC UPGRADE #================================================= # Compile Minetest -cd /opt/yunohost/$app +pushd /opt/yunohost/$app # 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 make -j$(nproc) +popd + ### 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. -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. 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 #================================================= @@ -127,13 +151,14 @@ ynh_use_logrotate --non-append # Set permissions on app files chown -R root: $final_path +chown -R $app: $home_path #================================================= # RELOAD MINETEST #================================================= ynh_print_info --message="Restarting Minetest..." -systemctl restart minetest +systemctl restart $app #================================================= # END OF SCRIPT