mirror of
https://github.com/YunoHost-Apps/minetest_ynh.git
synced 2024-09-03 20:36:00 +02:00
Merge ab29604dd1
into 224bbe1d7b
This commit is contained in:
commit
1bde7c2aa7
8 changed files with 55 additions and 135 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
*~
|
*~
|
||||||
*.sw[op]
|
*.sw[op]
|
||||||
temp.txt
|
temp.txt
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -18,7 +18,8 @@ code = "https://github.com/minetest/minetest"
|
||||||
fund = "https://www.minetest.net/get-involved/#donate"
|
fund = "https://www.minetest.net/get-involved/#donate"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2"
|
yunohost = ">= 11.2.29"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = true
|
multi_instance = true
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,42 +1,33 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_print_info "Declaring files to be backed up..."
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$install_dir"
|
ynh_backup "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$data_dir" --is_big
|
ynh_backup "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -1,76 +1,59 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..."
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:$app "$install_dir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILDING
|
# BUILDING
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building Minetest..."
|
ynh_script_progression "Building Minetest..."
|
||||||
|
|
||||||
ynh_setup_source --dest_dir=$install_dir/games/$game --source_id=$game
|
ynh_setup_source --dest_dir=$install_dir/games/$game --source_id=$game
|
||||||
|
|
||||||
# Install IrrlichtMt
|
|
||||||
ynh_setup_source --dest_dir=$install_dir/lib/irrlichtmt --source_id=irrlichtmt
|
ynh_setup_source --dest_dir=$install_dir/lib/irrlichtmt --source_id=irrlichtmt
|
||||||
|
|
||||||
pushd $install_dir
|
pushd $install_dir
|
||||||
ynh_exec_warn_less cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
|
ynh_hide_warnings cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
|
||||||
|
ynh_hide_warnings make -j$(nproc)
|
||||||
ynh_exec_warn_less make -j$(nproc)
|
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..."
|
ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
ynh_add_config --template="minetest.conf" --destination="$data_dir/.minetest/minetest.conf"
|
ynh_config_add --template="minetest.conf" --destination="$data_dir/.minetest/minetest.conf"
|
||||||
|
|
||||||
chmod 400 "$data_dir/.minetest/minetest.conf"
|
|
||||||
chown $app:$app "$data_dir/.minetest/minetest.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..."
|
ynh_script_progression "Configuring $app's systemd service..."
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
ynh_config_add_systemd
|
||||||
ynh_add_systemd_config
|
|
||||||
|
|
||||||
mkdir -p /var/log/$app
|
mkdir -p /var/log/$app
|
||||||
chown -R $app:$app /var/log/$app
|
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
ynh_config_add_logrotate
|
||||||
ynh_use_logrotate
|
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="listening on"
|
ynh_systemctl --service=$app --action="start" --wait_until="listening on"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed"
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -1,34 +1,25 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEM CONFIGURATIONS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
ynh_script_progression "Removing system configurations related to $app..."
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
if ynh_hide_warnings yunohost service status $app >/dev/null
|
||||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service integration..."
|
ynh_script_progression "Removing $app service integration..."
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
ynh_config_remove_systemd
|
||||||
ynh_remove_systemd_config
|
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
ynh_config_remove_logrotate
|
||||||
ynh_remove_logrotate
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed"
|
ynh_script_progression "Removal of $app completed"
|
||||||
|
|
|
@ -1,60 +1,47 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..."
|
ynh_script_progression "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore "$install_dir"
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:$app "$install_dir"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..."
|
ynh_script_progression "Restoring the data directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
ynh_restore "$data_dir"
|
||||||
|
|
||||||
chown -R $app:$app "$data_dir"
|
chown -R $app:$app "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
ynh_script_progression "Restoring $app's systemd service..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore "/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
mkdir /var/log/$app -p
|
mkdir /var/log/$app -p
|
||||||
chown -R $app: /var/log/$app
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="listening on"
|
ynh_systemctl --service=$app --action="start" --wait_until="listening on"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app"
|
ynh_script_progression "Restoration completed for $app"
|
||||||
|
|
|
@ -1,62 +1,45 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..."
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service=$app --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
ynh_script_progression "Ensuring downward compatibility..."
|
||||||
|
|
||||||
# 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 --key=game --value=$game
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
ynh_setup_source --dest_dir="$install_dir" --full_replace
|
||||||
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
|
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:$app "$install_dir"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPGRADE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILDING
|
# BUILDING
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Building Minetest..."
|
ynh_script_progression "Building Minetest..."
|
||||||
|
|
||||||
# Install the game
|
|
||||||
ynh_setup_source --dest_dir=$install_dir/games/$game --source_id=$game
|
ynh_setup_source --dest_dir=$install_dir/games/$game --source_id=$game
|
||||||
|
|
||||||
# Install IrrlichtMt
|
|
||||||
ynh_setup_source --dest_dir=$install_dir/lib/irrlichtmt --source_id=irrlichtmt
|
ynh_setup_source --dest_dir=$install_dir/lib/irrlichtmt --source_id=irrlichtmt
|
||||||
|
|
||||||
pushd $install_dir
|
pushd $install_dir
|
||||||
ynh_exec_warn_less cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
|
ynh_hide_warnings cmake . -DRUN_IN_PLACE=TRUE -DENABLE_LUAJIT=TRUE -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
|
||||||
|
|
||||||
ynh_exec_warn_less make -j$(nproc)
|
ynh_hide_warnings make -j$(nproc)
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -74,35 +57,30 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..."
|
ynh_script_progression "Updating configuration..."
|
||||||
|
|
||||||
ynh_add_config --template="minetest.conf" --destination="$data_dir/.minetest/minetest.conf"
|
ynh_config_add --template="minetest.conf" --destination="$data_dir/.minetest/minetest.conf"
|
||||||
|
|
||||||
chmod 400 "$data_dir/.minetest/minetest.conf"
|
|
||||||
chown $app:$app "$data_dir/.minetest/minetest.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
ynh_script_progression "Upgrading systemd configuration..."
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
ynh_config_add_systemd
|
||||||
ynh_add_systemd_config
|
|
||||||
|
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
ynh_config_add_logrotate
|
||||||
ynh_use_logrotate --non-append
|
|
||||||
|
|
||||||
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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="listening on"
|
ynh_systemctl --service=$app --action="start" --wait_until="listening on"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed"
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
Loading…
Add table
Reference in a new issue