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:
Éric Gaspar 2024-01-08 13:29:31 +01:00
parent 5e3ed220af
commit 74ab0698df
9 changed files with 40 additions and 507 deletions

View file

@ -1,49 +0,0 @@
;; Test complet minetest_game
; Manifest
domain="domain.tld"
is_public=0
game="minetest_game"
servername="packagecheck"
pvp=1
creative=0
damage=1
port="30000"
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=0
setup_nourl=1
setup_private=0
setup_public=0
upgrade=1
# 5.4.1~ynh2
upgrade=1 from_commit=bd09fd83cb3f127d242f551786d49202a434c4b2
backup_restore=1
multi_instance=1
incorrect_path=0
port_already_use=1
change_url=0
;; Test complet capturetheflag
; Manifest
domain="domain.tld"
is_public=0
game="capturetheflag"
servername="packagecheck"
pvp=1
creative=0
damage=1
port="30000"
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=0
setup_nourl=1
setup_private=0
setup_public=0
upgrade=1
backup_restore=1
multi_instance=1
incorrect_path=0
port_already_use=1
change_url=0

View file

@ -1,14 +1,15 @@
[Unit] [Unit]
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/__APP__ RequiresMountsFor=__DATA_DIR__
[Service] [Service]
Restart=on-failure Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
ExecStart=__INSTALL_DIR__/bin/minetestserver --config __DATA_DIR__/.minetest/minetest.conf --logfile /var/log/__APP__/__APP__.log ExecStart=__INSTALL_DIR__/bin/minetestserver --gameid __GAME__ --config __DATA_DIR__/.minetest/minetest.conf --logfile /var/log/__APP__/__APP__.log
Restart=on-failure
# Sandboxing options to harden security # Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these # Depending on specificities of your service/app, you may need to tweak these

View file

@ -1,92 +0,0 @@
{
"name": "Minetest",
"id": "minetest",
"packaging_format": 1,
"description": {
"en": "Voxel game engine and game. Need a client to connect to the server",
"fr": "Moteur de jeu de type « bac à sable ». Nécessite un client pour se connecter au serveur"
},
"version": "5.5.1~ynh2",
"url": "http://www.minetest.net/",
"upstream": {
"license": "MIT",
"website": "http://www.minetest.net",
"code": "https://github.com/minetest/minetest",
"cpe": "cpe:2.3:a:minetest:minetest"
},
"license": "MIT",
"maintainer": {
"name": "",
"email": ""
},
"requirements": {
"yunohost": ">= 11.2"
},
"multi_instance": true,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "is_public",
"type": "boolean",
"default": false
},
{
"name": "game",
"type": "string",
"ask": {
"en": "Choose a game for your server",
"fr": "Choissisez un jeu pour votre serveur"
},
"choises": [
"minetest_game",
"capturetheflag"
],
"default": "minetest_game",
"hint": "Minetest_game is the minetest default game. / Capture The Flag player vs player game."
},
{
"name": "servername",
"type": "string",
"ask": {
"en": "Choose a name for your server",
"fr": "Choissisez un nom pour votre serveur"
},
"default": "Minetest server"
},
{
"name": "pvp",
"type": "boolean",
"ask": {
"en": "Whether to enable players killing each other",
"fr": "Permettre aux joueurs de se tuer l'un l'autre"
},
"default": false
},
{
"name": "creative",
"type": "boolean",
"ask": {
"en": "Whether to enable creative mode (unlimited inventory)",
"fr": "Permettre l'utilisation du mode créatif (inventaire illimité)"
},
"default": false
},
{
"name": "damage",
"type": "boolean",
"ask": {
"en": "Enable players getting damage and dying",
"fr": "Les joueurs pourront-ils recevoir des dommages et mourir ?"
},
"default": true
}
]
}
}

View file

@ -13,24 +13,23 @@ maintainers = []
license = "MIT" license = "MIT"
website = "http://www.minetest.net" website = "http://www.minetest.net"
code = "https://github.com/minetest/minetest" code = "https://github.com/minetest/minetest"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] architectures = "all"
multi_instance = true multi_instance = true
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. ldap = false
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... sso = false
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install] [install]
[install.domain] [install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain" type = "domain"
full_domain = true
[install.init_main_permission] [install.init_main_permission]
type = "group" type = "group"
@ -39,7 +38,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[install.game] [install.game]
ask.en = "Choose a game for your server" ask.en = "Choose a game for your server"
ask.fr = "Choissisez un jeu pour votre serveur" ask.fr = "Choissisez un jeu pour votre serveur"
type = "string" type = "select"
choises = ["minetest_game", "capturetheflag"] choises = ["minetest_game", "capturetheflag"]
default = "minetest_game" default = "minetest_game"
hint = "Minetest_game is the minetest default game. / Capture The Flag player vs player game." hint = "Minetest_game is the minetest default game. / Capture The Flag player vs player game."
@ -88,5 +87,14 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[resources.install_dir] [resources.install_dir]
[resources.data_dir] [resources.data_dir]
subdirs = [".minetest/worlds"]
[resources.ports]
main.default = 30000
main.exposed = "UDP"
[resources.permissions] [resources.permissions]
[resources.apt]
packages = "build-essential, libirrlicht-dev, cmake, libbz2-dev, libpng-dev, libjpeg-dev, libxxf86vm-dev, libgl1-mesa-dev, libsqlite3-dev, libogg-dev, libvorbis-dev, libopenal-dev, libcurl4-dev, libfreetype6-dev, zlib1g-dev, libgmp-dev, libjsoncpp-dev, libluajit-5.1-dev, libncurses-dev, libzstd-dev"

View file

@ -9,110 +9,16 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
#REMOVEME? game=$YNH_APP_ARG_GAME
#REMOVEME? servername=$YNH_APP_ARG_SERVERNAME
#REMOVEME? pvp=$YNH_APP_ARG_PVP
#REMOVEME? creative=$YNH_APP_ARG_CREATIVE
#REMOVEME? damage=$YNH_APP_ARG_DAMAGE
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
#REMOVEME? ynh_script_progression --message="Validating installation parameters..."
#REMOVEME? install_dir=/opt/yunohost/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
#REMOVEME? ynh_script_progression --message="Storing installation settings..."
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=game --value=$game
ynh_app_setting_set --app=$app --key=servername --value=$servername
ynh_app_setting_set --app=$app --key=pvp --value=$pvp
ynh_app_setting_set --app=$app --key=creative --value=$creative
ynh_app_setting_set --app=$app --key=damage --value=$damage
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
#REMOVEME? ynh_script_progression --message="Finding an available port..."
# Find an available port
#REMOVEME? port=$(ynh_find_port 30000)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
# Open the port
ynh_script_progression --message="Configuring firewall..."
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Installing dependencies..."
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring system user..."
# Create a system user
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." ynh_script_progression --message="Setting up source files..."
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir" chown -R $app:$app "$install_dir"
#=================================================
# SPECIFIC SETUP
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..."
#REMOVEME? data_dir=/home/yunohost.app/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
mkdir -p $data_dir
mkdir -p "$data_dir/.minetest/worlds/"
chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir"
chown -R $app:www-data "$data_dir"
#================================================= #=================================================
# BUILDING # BUILDING
#================================================= #=================================================
@ -142,13 +48,13 @@ popd
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." ynh_script_progression --message="Adding a configuration file..."
#REMOVEME? if [ $is_public -eq 1 ]; then if [ $is_public -eq 1 ]; then
announce="true" announce="true"
else else
announce="false" announce="false"
fi fi
ynh_add_config --template="../conf/minetest.conf" --destination="$data_dir/.minetest/minetest.conf" ynh_add_config --template="minetest.conf" --destination="$data_dir/.minetest/minetest.conf"
chmod 400 "$data_dir/.minetest/minetest.conf" chmod 400 "$data_dir/.minetest/minetest.conf"
chown $app:$app "$data_dir/.minetest/minetest.conf" chown $app:$app "$data_dir/.minetest/minetest.conf"
@ -161,23 +67,12 @@ ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..."
mkdir -p /var/log/$app mkdir -p /var/log/$app
chown -R $app:$app /var/log/$app chown -R $app:$app /var/log/$app
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port" yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"

View file

@ -9,17 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
@ -33,79 +22,15 @@ then
yunohost service remove $app yunohost service remove $app
fi fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..."
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
#=================================================
# REMOVE APP MAIN DIR
#=================================================
#REMOVEME? ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
#REMOVEME? ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..."
#REMOVEME? ynh_secure_remove --file="$data_dir"
fi
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow UDP $port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
#REMOVEME? ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -10,45 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
@ -56,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir" chown -R $app:$app "$install_dir"
@ -67,31 +27,8 @@ ynh_script_progression --message="Restoring the data directory..."
ynh_restore_file --origin_path="$data_dir" --not_mandatory ynh_restore_file --origin_path="$data_dir" --not_mandatory
mkdir -p $data_dir
chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir"
chown -R $app:$app "$data_dir" chown -R $app:$app "$data_dir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
# Open the port
ynh_script_progression --message="Configuring firewall..."
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $port
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
@ -100,21 +37,11 @@ ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
mkdir /var/log/$app -p mkdir /var/log/$app -p
chown -R $app: /var/log/$app chown -R $app: /var/log/$app
ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port" yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
#================================================= #=================================================

View file

@ -9,45 +9,12 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? game=$(ynh_app_setting_get --app=$app --key=game)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
#REMOVEME? pvp=$(ynh_app_setting_get --app=$app --key=pvp)
#REMOVEME? creative=$(ynh_app_setting_get --app=$app --key=creative)
#REMOVEME? damage=$(ynh_app_setting_get --app=$app --key=damage)
#REMOVEME? servername=$(ynh_app_setting_get --app=$app --key=servername)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -60,56 +27,14 @@ ynh_systemd_action --service_name=$app --action="stop"
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
version=ynh_app_upstream_version
if [ "$version" = "0.01" ]; then
ynh_die --message="You can't upgrade to this version with simple upgrade. Please read the readme for upgrading https://github.com/YunoHost-Apps/minetest_ynh#additional-information ..."
fi
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..."
# If install_dir doesn't exist, create it
if [ -z $install_dir ]; then
#REMOVEME? install_dir=/opt/yunohost/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
fi
# If domain doesn't exist, create it
if [ -z "$domain" ]; then
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=server_domain)
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
fi
# If data_dir doesn't exist, create it
if [ -z $data_dir ]; then
#REMOVEME? data_dir=$(ynh_app_setting_get --app=$app --key=home_path)
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
ynh_app_setting_delete --app=$app --key=home_path
fi
# If game doesn't exist, create it # If game doesn't exist, create it
if [ -z $game ]; then if [ -z $game ]; then
game="minetest_game" game="minetest_game"
ynh_app_setting_set --app=$app --key=game --value=$game ynh_app_setting_set --app=$app --key=game --value=$game
fi fi
# Cleaning legacy permissions
#REMOVEME? if ynh_legacy_permissions_exists; then
#REMOVEME? ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -125,17 +50,9 @@ then
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
fi fi
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir" chown -R $app:$app "$install_dir"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
@ -191,7 +108,7 @@ else
announce="false" announce="false"
fi fi
ynh_add_config --template="../conf/minetest.conf" --destination="$data_dir/.minetest/minetest.conf" ynh_add_config --template="minetest.conf" --destination="$data_dir/.minetest/minetest.conf"
chmod 400 "$data_dir/.minetest/minetest.conf" chmod 400 "$data_dir/.minetest/minetest.conf"
chown $app:$app "$data_dir/.minetest/minetest.conf" chown $app:$app "$data_dir/.minetest/minetest.conf"
@ -204,21 +121,9 @@ ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append ynh_use_logrotate --non-append
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port" yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
#================================================= #=================================================

13
tests.toml Normal file
View file

@ -0,0 +1,13 @@
test_format = 1.0
[default]
# -------------------------------
# Default args to use for install
# -------------------------------
args.game="minetest_game"
args.servername="packagecheck"
args.pvp=1
args.creative=0
args.damage=1