From d90f3ca5c1c8fe7973a9f393e4a4cddcbfb30bba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:13:31 +0100 Subject: [PATCH 01/10] v2 --- conf/nginx.conf | 2 +- manifest.toml | 53 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/backup | 12 +++++------ scripts/install | 52 ++++++++++++++++++++++----------------------- scripts/remove | 16 +++++++------- scripts/restore | 26 +++++++++++------------ scripts/upgrade | 56 ++++++++++++++++++++++++------------------------- 7 files changed, 135 insertions(+), 82 deletions(-) create mode 100644 manifest.toml diff --git a/conf/nginx.conf b/conf/nginx.conf index 4dab2e9..c164c1d 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/; + alias __INSTALL_DIR__/; index index.html; diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..6742387 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,53 @@ +packaging_format = 2 + +id = "converse" +name = "Converse" +description.en = "Web-based XMPP/Jabber chat client" +description.fr = "Client de chat XMPP/Jabber basé sur le Web" + +version = "10.1.2~ynh1" + +maintainers = ["eric_G"] + +[upstream] +license = "MPL-2.0" +website = "http://conversejs.org" +demo = "https://inverse.chat/" +admindoc = "https://conversejs.org/docs/html/index.html" +code = "https://github.com/conversejs/converse.js" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 11.0.9" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = true +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + + [install.path] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "path" + default = "/converse" + + [install.init_main_permission] + help.en = "If enabled, Converse will be accessible by people who doesn’t have an account. This can be changed later via the webadmin." + help.fr = "Si cette case est cochée, Converse sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." + type = "group" + default = "visitors" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" diff --git a/scripts/backup b/scripts/backup index 14de8e1..6a8ef55 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,17 +13,17 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -34,7 +34,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index 714857b..14845df 100755 --- a/scripts/install +++ b/scripts/install @@ -13,48 +13,48 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= # Retrieve arguments -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -is_public=$YNH_APP_ARG_IS_PUBLIC +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +#REMOVEME? path=$YNH_APP_ARG_PATH +#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC maindomain=$(yunohost domain main-domain --output-as plain) -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 # Copy files to the right place -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 +#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=maindomain --value=$maindomain +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path +#REMOVEME? ynh_app_setting_set --app=$app --key=maindomain --value=$maindomain #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # STANDARD MODIFICATIONS @@ -63,15 +63,15 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, the source from sources folder -mkdir -p $final_path && cp -a ../sources/* $final_path -ynh_add_config --template="../sources/index.html" --destination="$final_path/index.html" +mkdir -p $install_dir && cp -a ../sources/* $install_dir +ynh_add_config --template="../sources/index.html" --destination="$install_dir/index.html" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION @@ -84,19 +84,19 @@ ynh_add_nginx_config #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary -if [ $is_public -eq 1 ] +#REMOVEME? if [ $is_public -eq 1 ] then - ynh_permission_update --permission="main" --add="visitors" +#REMOVEME? ynh_permission_update --permission="main" --add="visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index b07dbbe..5c6ebdb 100755 --- a/scripts/remove +++ b/scripts/remove @@ -11,30 +11,30 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # STANDARD REMOVE #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=3 +#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=3 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # REMOVE NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 258843e..a824516 100644 --- a/scripts/restore +++ b/scripts/restore @@ -12,25 +12,25 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS @@ -43,21 +43,21 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=2 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 00750d2..b68b9d5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,14 +11,14 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -maindomain=$(ynh_app_setting_get --app=$app --key=maindomain) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? maindomain=$(ynh_app_setting_get --app=$app --key=maindomain) #================================================= # CHECK VERSION @@ -29,37 +29,37 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# 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 +# If install_dir doesn't exist, create it +if [ -z "$install_dir" ]; then +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir fi # If maindomain doesn't exist, create it if [ -z "$maindomain" ]; then maindomain=$(yunohost domain main-domain --output-as plain) - ynh_app_setting_set --app=$app --key=maindomain --value=$maindomain +#REMOVEME? ynh_app_setting_set --app=$app --key=maindomain --value=$maindomain fi # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi @@ -67,10 +67,10 @@ fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -81,16 +81,16 @@ then ynh_script_progression --message="Upgrading source files..." --weight=4 # Remove the app directory securely - ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" # Download, the source from sources folder - mkdir -p $final_path && cp -a ../sources/* $final_path - ynh_add_config --template="../sources/index.html" --destination="$final_path/index.html" + mkdir -p $install_dir && cp -a ../sources/* $install_dir + ynh_add_config --template="../sources/index.html" --destination="$install_dir/index.html" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION @@ -103,9 +103,9 @@ ynh_add_nginx_config #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From 7efa97dec953e151df1ba7fbdab3d736ccaa4355 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:18:22 +0100 Subject: [PATCH 02/10] v2 --- check_process | 25 --------------------- manifest.json | 54 -------------------------------------------- manifest.toml | 16 +++++--------- scripts/install | 57 ++--------------------------------------------- scripts/remove | 28 ----------------------- scripts/restore | 32 --------------------------- scripts/upgrade | 59 +++---------------------------------------------- tests.toml | 3 +++ 8 files changed, 14 insertions(+), 260 deletions(-) delete mode 100644 check_process delete mode 100644 manifest.json create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index bb38b43..0000000 --- a/check_process +++ /dev/null @@ -1,25 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - 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 - backup_restore=1 - multi_instance=1 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&is_public=1& - - \ No newline at end of file diff --git a/manifest.json b/manifest.json deleted file mode 100644 index b3990d8..0000000 --- a/manifest.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "Converse", - "id": "converse", - "packaging_format": 1, - "description": { - "en": "Web-based XMPP/Jabber chat client", - "fr": "Client de chat XMPP/Jabber basé sur le Web" - }, - "version": "10.1.2~ynh1", - "url": "http://conversejs.org/", - "upstream": { - "license": "MPL-2.0", - "website": "http://conversejs.org", - "demo": "https://inverse.chat/", - "admindoc": "https://conversejs.org/docs/html/index.html", - "code": "https://github.com/conversejs/converse.js", - "cpe": "cpe:2.3:a:conversejs:converse.js" - }, - "license": "MPL-2.0", - "maintainer": { - "name": "eric_G", - "email": "" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/converse", - "default": "/converse" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "If enabled, Converse will be accessible by people who doesn’t have an account. This can be changed later via the webadmin.", - "fr": "Si cette case est cochée, Converse 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 6742387..e242a3c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -15,26 +15,22 @@ website = "http://conversejs.org" demo = "https://inverse.chat/" admindoc = "https://conversejs.org/docs/html/index.html" code = "https://github.com/conversejs/converse.js" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] yunohost = ">= 11.0.9" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +architectures = "all" multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" [install.path] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "path" default = "/converse" diff --git a/scripts/install b/scripts/install index 14845df..6d83ca6 100755 --- a/scripts/install +++ b/scripts/install @@ -8,53 +8,19 @@ source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= # Retrieve arguments -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC maindomain=$(yunohost domain main-domain --output-as plain) -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -# Copy files to the right place -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=2 +ynh_script_progression --message="Storing installation settings..." --weight=2 -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -#REMOVEME? ynh_app_setting_set --app=$app --key=maindomain --value=$maindomain - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" +ynh_app_setting_set --app=$app --key=maindomain --value=$maindomain #================================================= # STANDARD MODIFICATIONS @@ -63,8 +29,6 @@ maindomain=$(yunohost domain main-domain --output-as plain) #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir - # Download, the source from sources folder mkdir -p $install_dir && cp -a ../sources/* $install_dir ynh_add_config --template="../sources/index.html" --destination="$install_dir/index.html" @@ -81,23 +45,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary -#REMOVEME? if [ $is_public -eq 1 ] -then -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 5c6ebdb..2952ff1 100755 --- a/scripts/remove +++ b/scripts/remove @@ -8,34 +8,6 @@ source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=3 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # REMOVE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index a824516..3a1dc0e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,30 +8,6 @@ source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#REMOVEME? test ! -d $install_dir || ynh_die --message="There is already a directory: $install_dir " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -40,14 +16,6 @@ ynh_script_progression --message="Loading settings..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b68b9d5..d648636 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,70 +8,24 @@ source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? maindomain=$(ynh_app_setting_get --app=$app --key=maindomain) - #================================================= # CHECK VERSION #================================================= upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=3 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi # If maindomain doesn't exist, create it -if [ -z "$maindomain" ]; then +if [ -z "${maindomain:-}" ]; then maindomain=$(yunohost domain main-domain --output-as plain) -#REMOVEME? ynh_app_setting_set --app=$app --key=maindomain --value=$maindomain + ynh_app_setting_set --app=$app --key=maindomain --value=$maindomain fi -# Cleaning legacy permissions -#REMOVEME? if ynh_legacy_permissions_exists; then -#REMOVEME? ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -81,7 +35,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=4 # Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" + ynh_secure_remove --file="$install_dir" # Download, the source from sources folder mkdir -p $install_dir && cp -a ../sources/* $install_dir @@ -100,13 +54,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..cbbeef1 --- /dev/null +++ b/tests.toml @@ -0,0 +1,3 @@ +test_format = 1.0 + +[default] From 04cc938cd16f6b68c331eff8d2615be9fab6620a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:19:12 +0100 Subject: [PATCH 03/10] v2 --- scripts/backup | 17 ----------------- scripts/change_url | 10 ---------- 2 files changed, 27 deletions(-) diff --git a/scripts/backup b/scripts/backup index 6a8ef55..a6b113b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -8,23 +8,6 @@ source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index 1148530..f646af1 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -21,16 +21,6 @@ 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) - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= From 86a49df2d47bb3d5b72eca0700b9d907b50d8f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:21:48 +0100 Subject: [PATCH 04/10] Delete DISCLAIMER.md --- doc/DISCLAIMER.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 doc/DISCLAIMER.md diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index e69de29..0000000 From d04bbc14faf9ced66111ab356ee57842ab560496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Feb 2023 13:23:14 +0100 Subject: [PATCH 05/10] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index e242a3c..5354bee 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ admindoc = "https://conversejs.org/docs/html/index.html" code = "https://github.com/conversejs/converse.js" [integration] -yunohost = ">= 11.0.9" +yunohost = ">= 11.1.7" architectures = "all" multi_instance = true ldap = false From f51fc549ab9d15d73b9e69b2d3fbdcc9df66db27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Feb 2023 22:10:41 +0100 Subject: [PATCH 06/10] Cleaning --- scripts/install | 3 --- scripts/restore | 2 -- scripts/upgrade | 3 --- 3 files changed, 8 deletions(-) diff --git a/scripts/install b/scripts/install index 6d83ca6..0eb803b 100755 --- a/scripts/install +++ b/scripts/install @@ -18,7 +18,6 @@ maindomain=$(yunohost domain main-domain --output-as plain) #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=maindomain --value=$maindomain @@ -33,8 +32,6 @@ ynh_script_progression --message="Setting up source files..." --weight=1 mkdir -p $install_dir && cp -a ../sources/* $install_dir ynh_add_config --template="../sources/index.html" --destination="$install_dir/index.html" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= diff --git a/scripts/restore b/scripts/restore index 3a1dc0e..94d8d53 100644 --- a/scripts/restore +++ b/scripts/restore @@ -23,8 +23,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d648636..d2f0dc6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - # If maindomain doesn't exist, create it if [ -z "${maindomain:-}" ]; then maindomain=$(yunohost domain main-domain --output-as plain) @@ -42,8 +41,6 @@ then ynh_add_config --template="../sources/index.html" --destination="$install_dir/index.html" fi -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= From 451a695c7db4612024754a5db4384925464ca3af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Feb 2023 23:01:32 +0100 Subject: [PATCH 07/10] Update nginx.conf --- conf/nginx.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index c164c1d..27bba77 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -6,6 +6,8 @@ location __PATH__/ { index index.html; + more_set_headers "Access-Control-Allow-Origin: *"; + location = __PATH__/http-bind { proxy_pass "http://localhost:5290/http-bind"; proxy_http_version 1.1; From 2d0a401e2b7a00cb3c009b2c790c194981d6185e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Feb 2023 23:01:50 +0100 Subject: [PATCH 08/10] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 5354bee..d316c50 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Converse" description.en = "Web-based XMPP/Jabber chat client" description.fr = "Client de chat XMPP/Jabber basé sur le Web" -version = "10.1.2~ynh1" +version = "10.1.2~ynh2" maintainers = ["eric_G"] From 19496db939ef9185df25bf9aeb98aa455a9de422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 17 Feb 2023 23:06:53 +0100 Subject: [PATCH 09/10] Update nginx.conf --- conf/nginx.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 27bba77..9d3206d 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -6,7 +6,9 @@ location __PATH__/ { index index.html; - more_set_headers "Access-Control-Allow-Origin: *"; + if ($request_method ~* "(GET|POST)") { + more_set_headers "Access-Control-Allow-Origin: *"; + } location = __PATH__/http-bind { proxy_pass "http://localhost:5290/http-bind"; From 94e591a0ec5b1f2d9c64ed0738d42b182d10c6bc Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 17 Feb 2023 22:06:59 +0000 Subject: [PATCH 10/10] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bffd7a8..c9a7b3f 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ The benefit of using converse.js as opposed to relying on a SaaS (software-as-a- -**Shipped version:** 10.1.2~ynh1 +**Shipped version:** 10.1.2~ynh2 **Demo:** https://inverse.chat/ ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index 34aa635..50bc33c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -32,7 +32,7 @@ The benefit of using converse.js as opposed to relying on a SaaS (software-as-a- -**Version incluse :** 10.1.2~ynh1 +**Version incluse :** 10.1.2~ynh2 **Démo :** https://inverse.chat/ ## Documentations et ressources