From cc97f25c9878a3031c7db3104bc987f5538ade12 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Thu, 13 May 2021 21:28:15 +0200 Subject: [PATCH 1/2] Allow subdomain --- check_process | 2 +- conf/nginx.conf | 5 ++--- manifest.json | 10 ++++++---- scripts/install | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/check_process b/check_process index d088391..41dbc56 100644 --- a/check_process +++ b/check_process @@ -9,7 +9,7 @@ is_public=1 (PUBLIC|public=1|private=0) ; Checks pkg_linter=1 - setup_sub_dir=0 #Not supported in upstream app + setup_sub_dir=1 setup_root=1 setup_nourl=0 setup_private=1 diff --git a/conf/nginx.conf b/conf/nginx.conf index 5004c38..11cb4b2 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,8 +1,8 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location / { +location __PATH__/ { # Path to source - root __FINALPATH__/ ; + alias __FINALPATH__/ ; # Force usage of https if ($scheme = http) { @@ -11,5 +11,4 @@ location / { # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; - } \ No newline at end of file diff --git a/manifest.json b/manifest.json index 7510903..49e45b1 100644 --- a/manifest.json +++ b/manifest.json @@ -25,12 +25,14 @@ { "name": "domain", "type": "domain", - "help": { - "en": "RetroArch requires its own subdomain", - "fr": "RetroArch nécessite son propre sous-domaine" - }, "example": "retroarch.example.com" }, + { + "name": "path", + "type": "path", + "example": "/retroarch", + "default": "/retroarch" + }, { "name": "is_public", "type": "boolean", diff --git a/scripts/install b/scripts/install index 4d01829..80302fc 100755 --- a/scripts/install +++ b/scripts/install @@ -25,7 +25,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url="/" +path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME From 2b2ead0e3bd5cca2986aad243762440e54f8af48 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Fri, 14 May 2021 10:25:11 +0200 Subject: [PATCH 2/2] Allow for subdomain + change_url --- check_process | 2 +- manifest.json | 2 +- scripts/change_url | 39 +++++++++++++++++++-------------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/check_process b/check_process index 41dbc56..1223b13 100644 --- a/check_process +++ b/check_process @@ -19,7 +19,7 @@ backup_restore=1 multi_instance=0 port_already_use=0 #No port required - change_url=0 #not yet done + change_url=1 ;;; Levels # If the level 5 (Package linter) is forced to 1. Please add justifications here. Level 5=auto diff --git a/manifest.json b/manifest.json index 49e45b1..a0e6212 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "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!" }, - "version": "1.9.2~ynh1", + "version": "1.9.2~ynh2", "url": "http://www.retroarch.com/", "license": "GPL-3.0-or-later", "maintainer": { diff --git a/scripts/change_url b/scripts/change_url index 400bdf2..f0f63f7 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -6,9 +6,8 @@ # IMPORT GENERIC HELPERS #================================================= -source /usr/share/yunohost/helpers source _common.sh - +source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS @@ -30,11 +29,15 @@ ynh_script_progression --message="Loading installation settings..." --time --wei # 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_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 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. 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 } # Exit if an error occurs during the execution of the script @@ -61,31 +64,31 @@ fi change_path=0 if [ "$old_path" != "$new_path" ] then - ynh_print_warn "RetroArch works only on root path, path cannot be changed! - #change_path=1 + change_path=1 fi +#================================================= +# STANDARD MODIFICATIONS #================================================= # 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 -# Change the path in the nginx config file +# Change the path in the NGINX config file if [ $change_path -eq 1 ] 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" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx -#Keep it if, one day, we can change it... +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -96,15 +99,11 @@ then fi #================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= - +# GENERIC FINALISATION #================================================= # 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