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:13:58 +01:00
parent 8c21584a6a
commit 5e3ed220af
11 changed files with 226 additions and 155 deletions

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/minetest/minetest/archive/5.8.0.tar.gz
SOURCE_SUM=610c85a24d77acdc3043a69d777bed9e6c00169406ca09df22ad490fe0d68c0c
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=minetest-5.8.0.tar.gz
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/minetest/irrlicht/archive/1.9.0mt13.tar.gz
SOURCE_SUM=2fde8e27144988210b9c0ff1e202905834d9d25aaa63ce452763fd7171096adc
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=irrlicht-1.9.0mt13.tar.gz
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/minetest/minetest_game/archive/5.8.0.tar.gz
SOURCE_SUM=33a3bb43b08497a0bdb2f49f140a2829e582d5c16c0ad52be1595c803f706912
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=minetest_game-5.8.0.tar.gz
SOURCE_EXTRACT=true

View file

@ -8,7 +8,7 @@ RequiresMountsFor=/home/yunohost.app/__APP__
Restart=on-failure
User=__APP__
Group=__APP__
ExecStart=__FINALPATH__/bin/minetestserver --config __DATADIR__/.minetest/minetest.conf --logfile /var/log/__APP__/__APP__.log
ExecStart=__INSTALL_DIR__/bin/minetestserver --config __DATA_DIR__/.minetest/minetest.conf --logfile /var/log/__APP__/__APP__.log
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these

92
manifest.toml Normal file
View file

@ -0,0 +1,92 @@
packaging_format = 2
id = "minetest"
name = "Minetest"
description.en = "Voxel game engine and game. Need a client to connect to the server"
description.fr = "Moteur de jeu de type « bac à sable ». Nécessite un client pour se connecter au serveur"
version = "5.5.1~ynh2"
maintainers = []
[upstream]
license = "MIT"
website = "http://www.minetest.net"
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]
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"]
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.
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, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
full_domain = true
[install.init_main_permission]
type = "group"
default = false
[install.game]
ask.en = "Choose a game for your server"
ask.fr = "Choissisez un jeu pour votre serveur"
type = "string"
choises = ["minetest_game", "capturetheflag"]
default = "minetest_game"
hint = "Minetest_game is the minetest default game. / Capture The Flag player vs player game."
[install.servername]
ask.en = "Choose a name for your server"
ask.fr = "Choissisez un nom pour votre serveur"
type = "string"
default = "Minetest server"
[install.pvp]
ask.en = "Whether to enable players killing each other"
ask.fr = "Permettre aux joueurs de se tuer l'un l'autre"
type = "boolean"
default = false
[install.creative]
ask.en = "Whether to enable creative mode (unlimited inventory)"
ask.fr = "Permettre l'utilisation du mode créatif (inventaire illimité)"
type = "boolean"
default = false
[install.damage]
ask.en = "Enable players getting damage and dying"
ask.fr = "Les joueurs pourront-ils recevoir des dommages et mourir ?"
type = "boolean"
default = true
[resources]
[resources.sources]
[resources.sources.minetest_game]
url = "https://github.com/minetest/minetest_game/archive/5.8.0.tar.gz"
sha256 = "33a3bb43b08497a0bdb2f49f140a2829e582d5c16c0ad52be1595c803f706912"
[resources.sources.main]
url = "https://github.com/minetest/minetest/archive/5.8.0.tar.gz"
sha256 = "610c85a24d77acdc3043a69d777bed9e6c00169406ca09df22ad490fe0d68c0c"
[resources.sources.irrlichtmt]
url = "https://github.com/minetest/irrlicht/archive/1.9.0mt13.tar.gz"
sha256 = "2fde8e27144988210b9c0ff1e202905834d9d25aaa63ce452763fd7171096adc"
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
[resources.permissions]

View file

@ -5,7 +5,7 @@
#=================================================
# dependencies used by the app
pkg_dependencies="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"
#REMOVEME? pkg_dependencies="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"
#=================================================
# PERSONAL HELPERS

View file

@ -14,21 +14,21 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
#REMOVEME? ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#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)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -39,13 +39,13 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
ynh_backup --src_path="$data_dir" --is_big
#=================================================
# SPECIFIC BACKUP

View file

@ -13,40 +13,40 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
is_public=$YNH_APP_ARG_IS_PUBLIC
game=$YNH_APP_ARG_GAME
servername=$YNH_APP_ARG_SERVERNAME
pvp=$YNH_APP_ARG_PVP
creative=$YNH_APP_ARG_CREATIVE
damage=$YNH_APP_ARG_DAMAGE
#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
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..."
#REMOVEME? ynh_script_progression --message="Validating installation parameters..."
final_path=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
#REMOVEME? install_dir=/opt/yunohost/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..."
#REMOVEME? ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
#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
@ -58,11 +58,11 @@ ynh_app_setting_set --app=$app --key=damage --value=$damage
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..."
#REMOVEME? ynh_script_progression --message="Finding an available port..."
# Find an available port
port=$(ynh_find_port 30000)
ynh_app_setting_set --app=$app --key=port --value=$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..."
@ -71,30 +71,30 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..."
#REMOVEME? ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
#REMOVEME? ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#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="$final_path"
ynh_setup_source --dest_dir="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# SPECIFIC SETUP
@ -103,15 +103,15 @@ chown -R $app:$app "$final_path"
#=================================================
ynh_script_progression --message="Creating a data directory..."
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
#REMOVEME? data_dir=/home/yunohost.app/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=data_dir --value=$data_dir
mkdir -p $datadir
mkdir -p "$datadir/.minetest/worlds/"
mkdir -p $data_dir
mkdir -p "$data_dir/.minetest/worlds/"
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir"
chown -R $app:www-data "$data_dir"
#=================================================
# BUILDING
@ -120,18 +120,18 @@ ynh_script_progression --message="Building Minetest..."
# Install the game
if [ $game = "capturetheflag" ]; then
pushd $final_path
pushd $install_dir
git clone --recursive https://github.com/MT-CTF/capturetheflag.git games/capturetheflag
popd
else
# Download Minetest Game
ynh_setup_source --dest_dir=$final_path/games/minetest_game --source_id=minetest_game
ynh_setup_source --dest_dir=$install_dir/games/minetest_game --source_id=minetest_game
fi
# Install IrrlichtMt
ynh_setup_source --dest_dir=$final_path/lib/irrlichtmt --source_id=irrlichtmt
ynh_setup_source --dest_dir=$install_dir/lib/irrlichtmt --source_id=irrlichtmt
pushd $final_path
pushd $install_dir
ynh_exec_warn_less cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
ynh_exec_warn_less make -j$(nproc)
@ -142,16 +142,16 @@ popd
#=================================================
ynh_script_progression --message="Adding a configuration file..."
if [ $is_public -eq 1 ]; then
#REMOVEME? if [ $is_public -eq 1 ]; then
announce="true"
else
announce="false"
fi
ynh_add_config --template="../conf/minetest.conf" --destination="$datadir/.minetest/minetest.conf"
ynh_add_config --template="../conf/minetest.conf" --destination="$data_dir/.minetest/minetest.conf"
chmod 400 "$datadir/.minetest/minetest.conf"
chown $app:$app "$datadir/.minetest/minetest.conf"
chmod 400 "$data_dir/.minetest/minetest.conf"
chown $app:$app "$data_dir/.minetest/minetest.conf"
#=================================================
# SETUP SYSTEMD

View file

@ -12,13 +12,13 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#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
@ -52,10 +52,10 @@ ynh_remove_logrotate
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..."
#REMOVEME? ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#REMOVEME? ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE DATA DIR
@ -65,16 +65,16 @@ ynh_secure_remove --file="$final_path"
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..."
ynh_secure_remove --file="$datadir"
#REMOVEME? ynh_secure_remove --file="$data_dir"
fi
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
#REMOVEME? ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# CLOSE A PORT
@ -101,10 +101,10 @@ ynh_secure_remove --file="/var/log/$app"
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete --username=$app
#REMOVEME? ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT

View file

@ -14,74 +14,74 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
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)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..."
ynh_restore_file --origin_path="$datadir" --not_mandatory
ynh_restore_file --origin_path="$data_dir" --not_mandatory
mkdir -p $datadir
mkdir -p $data_dir
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir"
chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir"
chown -R $app:$app "$data_dir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE VARIOUS FILES

View file

@ -12,19 +12,19 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
game=$(ynh_app_setting_get --app=$app --key=game)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
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)
#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
@ -36,17 +36,17 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
@ -70,22 +70,22 @@ fi
ynh_script_progression --message="Ensuring downward compatibility..."
# If final_path doesn't exist, create it
if [ -z $final_path ]; then
final_path=/opt/yunohost/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# 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
domain=$(ynh_app_setting_get --app=$app --key=server_domain)
ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=server_domain)
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
fi
# If datadir doesn't exist, create it
if [ -z $datadir ]; then
datadir=$(ynh_app_setting_get --app=$app --key=home_path)
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
# 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
@ -96,8 +96,8 @@ if [ -z $game ]; then
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
#REMOVEME? if ynh_legacy_permissions_exists; then
#REMOVEME? ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
@ -105,10 +105,10 @@ fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -119,22 +119,22 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Remove old install
ynh_secure_remove --file="$final_path"
#REMOVEME? ynh_secure_remove --file="$install_dir"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$install_dir"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC UPGRADE
@ -147,7 +147,7 @@ ynh_script_progression --message="Building Minetest..."
if [ $game = "capturetheflag" ]; then
# Download Capture The Flag
pushd $final_path
pushd $install_dir
# To avoid mess remove this first
ynh_secure_remove games/capturetheflag/
# Then clone the latest version from git
@ -155,13 +155,13 @@ if [ $game = "capturetheflag" ]; then
popd
else
# Download Minetest Game
ynh_setup_source --dest_dir=$final_path/games/minetest_game --source_id=minetest_game
ynh_setup_source --dest_dir=$install_dir/games/minetest_game --source_id=minetest_game
fi
# Install IrrlichtMt
ynh_setup_source --dest_dir=$final_path/lib/irrlichtmt --source_id=irrlichtmt
ynh_setup_source --dest_dir=$install_dir/lib/irrlichtmt --source_id=irrlichtmt
pushd $final_path
pushd $install_dir
ynh_exec_warn_less cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
ynh_exec_warn_less make -j$(nproc)
@ -171,12 +171,12 @@ popd
# COPY CONFIG FILE
#=================================================
if [ -e $datadir ]
if [ -e $data_dir ]
then
echo "Nothing to do..."
else
mkdir -p $datadir/.minetest/
mkdir $datadir/.minetest/worlds/
mkdir -p $data_dir/.minetest/
mkdir $data_dir/.minetest/worlds/
fi
#=================================================
@ -191,10 +191,10 @@ else
announce="false"
fi
ynh_add_config --template="../conf/minetest.conf" --destination="$datadir/.minetest/minetest.conf"
ynh_add_config --template="../conf/minetest.conf" --destination="$data_dir/.minetest/minetest.conf"
chmod 400 "$datadir/.minetest/minetest.conf"
chown $app:$app "$datadir/.minetest/minetest.conf"
chmod 400 "$data_dir/.minetest/minetest.conf"
chown $app:$app "$data_dir/.minetest/minetest.conf"
#=================================================
# SETUP SYSTEMD