1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/retroarch_ynh.git synced 2024-09-03 20:16:12 +02:00

Allow for subdomain + change_url

This commit is contained in:
Krakinou 2021-05-14 10:25:11 +02:00
parent cc97f25c98
commit 2b2ead0e3b
3 changed files with 21 additions and 22 deletions

View file

@ -19,7 +19,7 @@
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
port_already_use=0 #No port required port_already_use=0 #No port required
change_url=0 #not yet done change_url=1
;;; Levels ;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here. # If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto Level 5=auto

View file

@ -6,7 +6,7 @@
"en": "Emulate videogames system and play videogames through your web browser... and more!", "en": "Emulate videogames system and play videogames through your web browser... and more!",
"fr": "Emulez des consoles de jeux et jouer à ces jeux vidéos dans votre explorateur web... Et beaucoup plus!" "fr": "Emulez des consoles de jeux et jouer à ces jeux vidéos dans votre explorateur web... Et beaucoup plus!"
}, },
"version": "1.9.2~ynh1", "version": "1.9.2~ynh2",
"url": "http://www.retroarch.com/", "url": "http://www.retroarch.com/",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {

View file

@ -6,9 +6,8 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source /usr/share/yunohost/helpers
source _common.sh source _common.sh
source /usr/share/yunohost/helpers
#================================================= #=================================================
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
@ -30,11 +29,15 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) 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_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=10
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -42,7 +45,7 @@ ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -61,31 +64,31 @@ fi
change_path=0 change_path=0
if [ "$old_path" != "$new_path" ] if [ "$old_path" != "$new_path" ]
then then
ynh_print_warn "RetroArch works only on root path, path cannot be changed! change_path=1
#change_path=1
fi fi
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1 ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file # Change the path in the NGINX config file
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]
then then
# Make a backup of the original nginx config file if modified # Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path" ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper # Set global variables for NGINX helper
domain="$old_domain" domain="$old_domain"
path_url="$new_path" path_url="$new_path"
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
fi fi
# Change the domain for nginx # Change the domain for NGINX
#Keep it if, one day, we can change it...
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
@ -96,15 +99,11 @@ then
fi fi
#================================================= #=================================================
# SPECIFIC MODIFICATIONS # GENERIC FINALISATION
#=================================================
# ...
#=================================================
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload