From da4ab8a67878898e180d9d4e764683a54cac147e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Wed, 15 Mar 2023 23:11:58 +0100 Subject: [PATCH] fix --- check_process | 21 ----------- manifest.json | 63 ------------------------------- manifest.toml | 5 ++- scripts/change_url | 92 +--------------------------------------------- tests.toml | 7 ++++ 5 files changed, 12 insertions(+), 176 deletions(-) delete mode 100644 check_process delete mode 100644 manifest.json diff --git a/check_process b/check_process deleted file mode 100644 index 375685c..0000000 --- a/check_process +++ /dev/null @@ -1,21 +0,0 @@ -;; General - ; Manifest - domain="domain.tld" - path="/path" - admin="john" - is_public=1 - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - #upgrade=1 from_commit= - backup_restore=1 - multi_instance=1 - change_url=1 -;;; Upgrade options - ; commit= - name= diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 8a7f3b3..0000000 --- a/manifest.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "Gogs", - "id": "gogs", - "packaging_format": 1, - "description": { - "en": "Lightweight self-hosted Git forge", - "fr": "Forge Git légère auto-hébergé" - }, - "version": "0.12.10~ynh1", - "url": "http://gogs.io", - "upstream": { - "license": "MIT", - "website": "http://gogs.io", - "demo": "https://try.gogs.io/user/login", - "admindoc": "https://gogs.io/docs", - "code": "https://github.com/gogs/gogs", - "cpe": "cpe:2.3:a:gogs:gogs" - }, - "license": "MIT", - "maintainer": { - "name": "", - "email": "" - }, - "previous_maintainers": { - "name": "tostaki", - "email": "maxime@max.privy.place" - }, - "multi_instance": true, - "services": [ - "nginx", - "mysql" - ], - "requirements": { - "yunohost": ">= 11.0.9" - }, - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/gogs", - "default": "/gogs" - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If enabled, Gogs will be accessible by people who do not have an account. This can be changed later via the webadmin.", - "fr": "Si cette case est cochée, Gogs sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." - }, - "default": true - } - ] - } -} \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index 7101228..7661154 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://gogs.io/docs" code = "https://github.com/gogs/gogs" [integration] -yunohost = ">= 11.1.11" +yunohost = ">= 11.1.15" architectures = "all" multi_instance = true ldap = "true" @@ -55,5 +55,8 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" + [resources.apt] + packages = "mariadb-server" + [resources.database] type = "mysql" diff --git a/scripts/change_url b/scripts/change_url index da7c4f7..9772cbd 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,67 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH - -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) -admin=$(ynh_app_setting_get --app=$app --key=admin) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -key=$(ynh_app_setting_get --app=$app --key=key) -datadir=$(ynh_app_setting_get --app=$app --key=datadir) -path_url=$(ynh_app_setting_get --app=$app --key=path) - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 - -# Backup the current version of the app -ynh_backup_before_upgrade -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 - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -change_domain=0 -if [ "$old_domain" != "$new_domain" ] -then - change_domain=1 -fi - -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -84,29 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# 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 - ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated NGINX config - ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location - ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi +ynh_change_url_nginx_config #================================================= # SPECIFIC MODIFICATIONS @@ -135,13 +52,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml index e69de29..91daf17 100644 --- a/tests.toml +++ b/tests.toml @@ -0,0 +1,7 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ \ No newline at end of file