mirror of
https://github.com/YunoHost-Apps/minetest_ynh.git
synced 2024-09-03 20:36:00 +02:00
small fixes
This commit is contained in:
parent
8e63c98fa2
commit
8efb4fbe4f
9 changed files with 235 additions and 193 deletions
|
@ -9,7 +9,7 @@
|
|||
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||
|
||||
## Overview
|
||||
Quick description of this app.
|
||||
Minetest is a free open-source voxel game engine with easy modding and game creation.
|
||||
|
||||
**Shipped version:** 5.0.1
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
;; Test complet sans postgresql
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
postgresql=0
|
||||
use_postgresql=0
|
||||
pvp=1
|
||||
servername="packagecheck"
|
||||
creative=0
|
||||
|
@ -26,12 +26,12 @@
|
|||
multi_instance=0
|
||||
incorrect_path=0
|
||||
port_already_use=1
|
||||
change_url=1
|
||||
change_url=0
|
||||
|
||||
;; Test complet avec postgresql
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
postgresql=1
|
||||
use_postgresql=1
|
||||
pvp=1
|
||||
servername="packagecheck"
|
||||
creative=0
|
||||
|
@ -51,7 +51,7 @@
|
|||
multi_instance=0
|
||||
incorrect_path=0
|
||||
port_already_use=1
|
||||
change_url=1
|
||||
change_url=0
|
||||
|
||||
;;; Levels
|
||||
Level 1=auto
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
"default": false
|
||||
},
|
||||
{
|
||||
"name": "postgresql",
|
||||
"name": "use_postgresql",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Do you want to use PostgreSQL? (more powerful but uses more disk space)",
|
||||
|
|
|
@ -6,7 +6,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-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libluajit-5.1-dev"
|
||||
pkg_dependencies="postgresql postgresql9.6 postgresql-contrib 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-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev libluajit-5.1-dev"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
@ -16,165 +16,8 @@ pkg_dependencies="build-essential libirrlicht-dev cmake libbz2-dev libpng-dev li
|
|||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
#
|
||||
# POSTGRES HELPERS
|
||||
#
|
||||
# Point of contact : Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr>
|
||||
#=================================================
|
||||
|
||||
# Create a master password and set up global settings
|
||||
# Please always call this script in install and restore scripts
|
||||
#
|
||||
# usage: ynh_psql_test_if_first_run
|
||||
|
||||
ynh_psql_test_if_first_run() {
|
||||
if [ -f /etc/yunohost/psql ];
|
||||
then
|
||||
echo "PostgreSQL is already installed, no need to create master password"
|
||||
else
|
||||
pgsql=$(ynh_string_random)
|
||||
pg_hba=""
|
||||
echo "$pgsql" >> /etc/yunohost/psql
|
||||
|
||||
if [ -e /etc/postgresql/9.4/ ]
|
||||
then
|
||||
pg_hba=/etc/postgresql/9.4/main/pg_hba.conf
|
||||
elif [ -e /etc/postgresql/9.6/ ]
|
||||
then
|
||||
pg_hba=/etc/postgresql/9.6/main/pg_hba.conf
|
||||
else
|
||||
ynh_die "postgresql shoud be 9.4 or 9.6"
|
||||
fi
|
||||
|
||||
systemctl start postgresql
|
||||
sudo --login --user=postgres psql -c"ALTER user postgres WITH PASSWORD '$pgsql'" postgres
|
||||
|
||||
# force all user to connect to local database using passwords
|
||||
# https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html#EXAMPLE-PG-HBA.CONF
|
||||
# Note: we can't use peer since YunoHost create users with nologin
|
||||
# See: https://github.com/YunoHost/yunohost/blob/unstable/data/helpers.d/user
|
||||
sed -i '/local\s*all\s*all\s*peer/i \
|
||||
local all all password' "$pg_hba"
|
||||
systemctl enable postgresql
|
||||
systemctl reload postgresql
|
||||
fi
|
||||
}
|
||||
|
||||
# Open a connection as a user
|
||||
#
|
||||
# example: ynh_psql_connect_as 'user' 'pass' <<< "UPDATE ...;"
|
||||
# example: ynh_psql_connect_as 'user' 'pass' < /path/to/file.sql
|
||||
#
|
||||
# usage: ynh_psql_connect_as user pwd [db]
|
||||
# | arg: user - the user name to connect as
|
||||
# | arg: pwd - the user password
|
||||
# | arg: db - the database to connect to
|
||||
ynh_psql_connect_as() {
|
||||
user="$1"
|
||||
pwd="$2"
|
||||
db="$3"
|
||||
sudo --login --user=postgres PGUSER="$user" PGPASSWORD="$pwd" psql "$db"
|
||||
}
|
||||
|
||||
# # Execute a command as root user
|
||||
#
|
||||
# usage: ynh_psql_execute_as_root sql [db]
|
||||
# | arg: sql - the SQL command to execute
|
||||
# | arg: db - the database to connect to
|
||||
ynh_psql_execute_as_root () {
|
||||
sql="$1"
|
||||
sudo --login --user=postgres psql <<< "$sql"
|
||||
}
|
||||
|
||||
# Execute a command from a file as root user
|
||||
#
|
||||
# usage: ynh_psql_execute_file_as_root file [db]
|
||||
# | arg: file - the file containing SQL commands
|
||||
# | arg: db - the database to connect to
|
||||
ynh_psql_execute_file_as_root() {
|
||||
file="$1"
|
||||
db="$2"
|
||||
sudo --login --user=postgres psql "$db" < "$file"
|
||||
}
|
||||
|
||||
# Create a database, an user and its password. Then store the password in the app's config
|
||||
#
|
||||
# After executing this helper, the password of the created database will be available in $db_pwd
|
||||
# It will also be stored as "psqlpwd" into the app settings.
|
||||
#
|
||||
# usage: ynh_psql_setup_db user name [pwd]
|
||||
# | arg: user - Owner of the database
|
||||
# | arg: name - Name of the database
|
||||
# | arg: pwd - Password of the database. If not given, a password will be generated
|
||||
ynh_psql_setup_db () {
|
||||
db_user="$1"
|
||||
db_name="$2"
|
||||
new_db_pwd=$(ynh_string_random) # Generate a random password
|
||||
# If $3 is not given, use new_db_pwd instead for db_pwd.
|
||||
db_pwd="${3:-$new_db_pwd}"
|
||||
ynh_psql_create_db "$db_name" "$db_user" "$db_pwd" # Create the database
|
||||
ynh_app_setting_set "$app" psqlpwd "$db_pwd" # Store the password in the app's config
|
||||
}
|
||||
|
||||
# Create a database and grant privilegies to a user
|
||||
#
|
||||
# usage: ynh_psql_create_db db [user [pwd]]
|
||||
# | arg: db - the database name to create
|
||||
# | arg: user - the user to grant privilegies
|
||||
# | arg: pwd - the user password
|
||||
ynh_psql_create_db() {
|
||||
db="$1"
|
||||
user="$2"
|
||||
pwd="$3"
|
||||
ynh_psql_create_user "$user" "$pwd"
|
||||
sudo --login --user=postgres createdb --owner="$user" "$db"
|
||||
}
|
||||
|
||||
# Drop a database
|
||||
#
|
||||
# usage: ynh_psql_drop_db db
|
||||
# | arg: db - the database name to drop
|
||||
# | arg: user - the user to drop
|
||||
ynh_psql_remove_db() {
|
||||
db="$1"
|
||||
user="$2"
|
||||
sudo --login --user=postgres dropdb "$db"
|
||||
ynh_psql_drop_user "$user"
|
||||
}
|
||||
|
||||
# Dump a database
|
||||
#
|
||||
# example: ynh_psql_dump_db 'roundcube' > ./dump.sql
|
||||
#
|
||||
# usage: ynh_psql_dump_db db
|
||||
# | arg: db - the database name to dump
|
||||
# | ret: the psqldump output
|
||||
ynh_psql_dump_db() {
|
||||
db="$1"
|
||||
sudo --login --user=postgres pg_dump "$db"
|
||||
}
|
||||
|
||||
|
||||
# Create a user
|
||||
#
|
||||
# usage: ynh_psql_create_user user pwd [host]
|
||||
# | arg: user - the user name to create
|
||||
ynh_psql_create_user() {
|
||||
user="$1"
|
||||
pwd="$2"
|
||||
sudo --login --user=postgres psql -c"CREATE USER $user WITH PASSWORD '$pwd'" postgres
|
||||
}
|
||||
|
||||
# Drop a user
|
||||
#
|
||||
# usage: ynh_psql_drop_user user
|
||||
# | arg: user - the user name to drop
|
||||
ynh_psql_drop_user() {
|
||||
user="$1"
|
||||
sudo --login --user=postgres dropuser "$user"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# FUTURE OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
||||
|
|
|
@ -44,16 +44,10 @@ ynh_backup --src_path="$final_path"
|
|||
#=================================================
|
||||
# BACKUP THE HOME DIR
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up nginx web server configuration..."
|
||||
ynh_print_info --message="Backing up Minetest data..."
|
||||
|
||||
ynh_backup --src_path="/home/yunohost.app/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up php-fpm configuration..."
|
||||
|
||||
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
|
|
69
scripts/change_url
Normal file
69
scripts/change_url
Normal file
|
@ -0,0 +1,69 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
fi
|
||||
|
||||
change_path=0
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
#=================================================
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# RELOAD MINETEST
|
||||
#=================================================
|
||||
ynh_print_info --message="Reloading Minetest..."
|
||||
|
||||
systemctl start minetest
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Change of URL completed for $app"
|
|
@ -22,7 +22,7 @@ ynh_abort_if_errors
|
|||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
postgresql=$YNH_APP_ARG_POSTGRESQL
|
||||
use_postgresql=$YNH_APP_ARG_USE_POSTGRESQL
|
||||
pvp=$YNH_APP_ARG_PVP
|
||||
creative=$YNH_APP_ARG_CREATIVE
|
||||
damage=$YNH_APP_ARG_DAMAGE
|
||||
|
@ -60,7 +60,7 @@ ynh_print_info --message="Storing installation settings..."
|
|||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
ynh_app_setting_set --app=$app --key=postgresql --value=$postgresql
|
||||
ynh_app_setting_set --app=$app --key=use_postgresql --value=$use_postgresql
|
||||
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
|
||||
|
@ -101,7 +101,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
if [ $postgresql -eq 1 ]
|
||||
if [ $use_postgresql -eq 1 ]
|
||||
then
|
||||
ynh_print_info --message="Creating a PostgreSQL database..."
|
||||
|
||||
|
@ -141,8 +141,15 @@ home_path=/home/yunohost.app/$app
|
|||
#=================================================
|
||||
# COPY CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
if [ -e /home/yunohost.app/$app ]
|
||||
then
|
||||
echo "Nothing to do..."
|
||||
else
|
||||
mkdir -p /home/yunohost.app/$app/.minetest/
|
||||
mkdir /home/yunohost.app/$app/.minetest/worlds/
|
||||
fi
|
||||
|
||||
cp -a ../conf/minetest.conf /home/yunohost.app/$app/.minetest/
|
||||
|
||||
#=================================================
|
||||
|
@ -171,14 +178,14 @@ ynh_add_systemd_config
|
|||
cd /opt/yunohost/$app
|
||||
# Download Minetest Game
|
||||
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game -b stable-5
|
||||
if [ $postgresql -eq 1 ]
|
||||
if [ $use_postgresql -eq 1 ]
|
||||
then
|
||||
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_POSTGRESQL=TRUE -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
|
||||
else
|
||||
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
|
||||
fi
|
||||
|
||||
make -j 2
|
||||
make -j$(nproc)
|
||||
|
||||
|
||||
#=================================================
|
||||
|
@ -201,11 +208,19 @@ ynh_replace_string --match_string="__DAMAGE__" --replace_string="$damage" --targ
|
|||
# CREATE WORLD
|
||||
#=================================================
|
||||
|
||||
# Create logs dir
|
||||
if [ -e /var/log/$app ]
|
||||
then
|
||||
echo "Nothing to do..."
|
||||
else
|
||||
mkdir /var/log/$app
|
||||
fi
|
||||
|
||||
# Set permissions on logs
|
||||
chown -R minetest:minetest /var/log/minetest
|
||||
|
||||
systemctl start minetest
|
||||
if [ $postgresql -eq 1 ]
|
||||
if [ $use_postgresql -eq 1 ]
|
||||
then
|
||||
systemctl stop minetest
|
||||
echo "pgsql_connection = host=127.0.0.1 user=$db_user password=$db_pwd dbname=$db_name" > $home_path/.minetest/worlds/world/world.mt
|
||||
|
@ -275,8 +290,7 @@ yunohost service add $app --log "/var/log/$app/$app.log"
|
|||
#=================================================
|
||||
ynh_print_info --message="Reloading minetest..."
|
||||
|
||||
systemctl restart minetest
|
||||
ynh_systemd_action -l "Server for gameid="minetest" listening on :::30000." -p "systemd"
|
||||
ynh_systemd_action --action=restart --line_match="Server for gameid=minetest listening on :::30000." --log_path="/var/log/minetest/minetest.log"
|
||||
sleep 1
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -21,7 +21,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
|||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
postgresql=$(ynh_app_setting_get --app=$app --key=postgresql)
|
||||
use_postgresql=$(ynh_app_setting_get --app=$app --key=use_postgresql)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -47,7 +47,7 @@ ynh_remove_systemd_config
|
|||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
if [ $postgresql -eq 1 ]
|
||||
if [ $use_postgresql -eq 1 ]
|
||||
then
|
||||
ynh_print_info --message="Removing the PostgreSQL database"
|
||||
|
||||
|
|
140
scripts/upgrade
140
scripts/upgrade
|
@ -1,9 +1,7 @@
|
|||
#!/bin/bash
|
||||
# Exit on command errors and treat unset variables as an error
|
||||
set -eu
|
||||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
@ -14,18 +12,47 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
pvp=$(ynh_app_setting_get $app pvp)
|
||||
damage=$(ynh_app_setting_get $app damage)
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
creative=$(ynh_app_setting_get $app creative)
|
||||
is_public=$(ynh_app_setting_get $app is_public)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
use_postgresql=$(ynh_app_setting_get --app=$app --key=use_postgresql)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_print_info --message="Ensuring downward compatibility..."
|
||||
|
||||
# Fix is_public as a boolean value
|
||||
if [ "$is_public" = "Yes" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=1
|
||||
is_public=1
|
||||
elif [ "$is_public" = "No" ]; then
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=0
|
||||
is_public=0
|
||||
fi
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z $db_name ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
fi
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z $final_path ]; then
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_print_info --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 () {
|
||||
|
@ -35,7 +62,102 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
# Normalize the URL path syntax
|
||||
# N.B. : this is for app installations before YunoHost 2.7
|
||||
# where this value might be something like /foo/ or foo/
|
||||
# instead of /foo ....
|
||||
# If nobody installed your app before 2.7, then you may
|
||||
# safely remove this line
|
||||
path_url=$(ynh_normalize_url_path --path_url=/)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# nothing yet
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=/home/yunohost.app/$app --use_shell
|
||||
$home_path=/home/yunohost.app/$app
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading systemd configuration..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# Compile Minetest
|
||||
cd /opt/yunohost/$app
|
||||
# Download Minetest Game
|
||||
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game -b stable-5
|
||||
if [ $use_postgresql -eq 1 ]
|
||||
then
|
||||
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_POSTGRESQL=TRUE -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/include/postgresql/ -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
|
||||
else
|
||||
cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
|
||||
fi
|
||||
|
||||
make -j 2
|
||||
|
||||
### 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"
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$home_path/.minetest/minetest.conf"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading logrotate configuration..."
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R root: $final_path
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info --message="Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Upgrade of $app completed"
|
||||
|
|
Loading…
Reference in a new issue