diff --git a/README.md b/README.md index 04e4120..b2d5bfa 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ It shall NOT be edited by hand. # SimpleX for YunoHost [![Integration level](https://dash.yunohost.org/integration/simplex.svg)](https://dash.yunohost.org/appci/app/simplex) ![Working status](https://ci-apps.yunohost.org/ci/badges/simplex.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/simplex.maintain.svg) + [![Install SimpleX with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=simplex) *[Lire ce readme en français.](./README_fr.md)* @@ -17,36 +18,16 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in SimpleX - the first messaging platform operating without user identifiers of any kind - 100% private by design! iOS and Android apps are released. -**Shipped version:** 4.1.0~ynh1 +**Shipped version:** 4.4.1~ynh1 ## Screenshots ![Screenshot of SimpleX](./doc/screenshots/conversation.png) -## Disclaimers / important information - -### SMP server address - -You can find the fingerprint in the SimpleX Chat service in the webadmin - -Your SMP server address should look like this: - -``` -smp://YOUR_FINGERPRINT=@YOUR_IPV4_ADDRESS:5223 -``` - -For mobile clients, open Settings, find an option "SMP servers", toggle "Configure SMP Servers" to on, then enter the SMP Servers Address for all servers you want the client to use. - -[iOS app](https://apps.apple.com/us/app/simplex-chat/id1605771084) -  -[![Android app](https://github.com/simplex-chat/.github/blob/master/profile/images/google_play.svg)](https://play.google.com/store/apps/details?id=chat.simplex.app) -  -[F-Droid](https://app.simplex.chat) -  - ## Documentation and resources * Official app website: +* Official admin documentation: * Upstream app code repository: * YunoHost documentation for this app: * Report a bug: diff --git a/README_fr.md b/README_fr.md index 631b304..9fd0a97 100644 --- a/README_fr.md +++ b/README_fr.md @@ -6,6 +6,7 @@ It shall NOT be edited by hand. # SimpleX pour YunoHost [![Niveau d’intégration](https://dash.yunohost.org/integration/simplex.svg)](https://dash.yunohost.org/appci/app/simplex) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/simplex.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/simplex.maintain.svg) + [![Installer SimpleX avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=simplex) *[Read this readme in english.](./README.md)* @@ -17,36 +18,16 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po SimpleX - la première plate-forme de messagerie qui n'a aucun identifiant d'utilisateur d'aucune sorte - 100 % privée de par sa conception ! -**Version incluse :** 4.1.0~ynh1 +**Version incluse :** 4.4.1~ynh1 ## Captures d’écran ![Capture d’écran de SimpleX](./doc/screenshots/conversation.png) -## Avertissements / informations importantes - -### Adresse du serveur SMP - -Vous pouvez trouver l'empreinte digitale dans le service SimpleX Chat dans la webadmin. - -L'adresse de votre serveur SMP devrait ressembler à ceci : - -``` -smp://YOUR_FINGERPRINT=@YOUR_IPV4_ADDRESS:5223 -``` - -Pour les clients mobiles, ouvrez Paramètres, recherchez une option "Serveurs SMP", activez "Configurer les serveurs SMP", puis entrez l'adresse des serveurs SMP pour tous les serveurs que vous souhaitez que le client utilise. - -[iOS app](https://apps.apple.com/us/app/simplex-chat/id1605771084) -  -[![Android app](https://github.com/simplex-chat/.github/blob/master/profile/images/google_play.svg)](https://play.google.com/store/apps/details?id=chat.simplex.app) -  -[F-Droid](https://app.simplex.chat) -  - ## Documentations et ressources * Site officiel de l’app : +* Documentation officielle de l’admin : * Dépôt de code officiel de l’app : * Documentation YunoHost pour cette app : * Signaler un bug : diff --git a/check_process b/check_process deleted file mode 100644 index d813274..0000000 --- a/check_process +++ /dev/null @@ -1,28 +0,0 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - -;; Test complet - ; Manifest - domain="domain.tld" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=0 - setup_nourl=1 - setup_private=0 - setup_public=0 - upgrade=1 - #upgrade=1 from_commit=CommitHash - backup_restore=1 - multi_instance=0 - port_already_use=0 - change_url=0 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666& diff --git a/conf/app.src b/conf/app.src index 14b589a..da3d5c9 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/YunoHost-Apps/simplex_ynh/releases/download/v4.1.0/smp-server -SOURCE_SUM=83bb242283e08cc37eb3870d2c0ef1b4d96725ee56e021c7bdaad919dc2bb336 +SOURCE_URL=https://github.com/YunoHost-Apps/simplex_ynh/releases/download/v4.4.1/smp-server +SOURCE_SUM=057b773520d87d0f71958665ff3c099ec7214165fa82551b0c2251ae9165ce03 SOURCE_SUM_PRG=sha256sum SOURCE_IN_SUBDIR=false SOURCE_FILENAME=smp-server diff --git a/conf/systemd.service b/conf/systemd.service index 0b31170..0db7783 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,13 +1,13 @@ [Unit] -Description=SimpleX: messaging Protocol Server +Description=SimpleX: Messaging Protocol Server After=network.target [Service] Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/smp-server start +WorkingDirectory=__INSTALL_DIR__/ +ExecStart=__INSTALL_DIR__/smp-server start Restart=always RestartSec=3 KillSignal=SIGINT diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 78% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md index 79f58fd..40a65a8 100644 --- a/doc/DISCLAIMER.md +++ b/doc/ADMIN.md @@ -1,11 +1,7 @@ -### SMP server address - -You can find the fingerprint in the SimpleX Chat service in the webadmin - -Your SMP server address should look like this: +Your SMP server address: ``` -smp://YOUR_FINGERPRINT=@YOUR_IPV4_ADDRESS:5223 +smp://__FINGERPRINT__@__PUBLIC_IP4__:__PORT__ ``` For mobile clients, open Settings, find an option "SMP servers", toggle "Configure SMP Servers" to on, then enter the SMP Servers Address for all servers you want the client to use. diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 76% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md index ab52f39..c725c68 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/ADMIN_fr.md @@ -1,11 +1,7 @@ -### Adresse du serveur SMP - -Vous pouvez trouver l'empreinte digitale dans le service SimpleX Chat dans la webadmin. - -L'adresse de votre serveur SMP devrait ressembler à ceci : +L'adresse de votre serveur SMP est : ``` -smp://YOUR_FINGERPRINT=@YOUR_IPV4_ADDRESS:5223 +smp://__FINGERPRINT__@__PUBLIC_IP4__:__PORT__ ``` Pour les clients mobiles, ouvrez Paramètres, recherchez une option "Serveurs SMP", activez "Configurer les serveurs SMP", puis entrez l'adresse des serveurs SMP pour tous les serveurs que vous souhaitez que le client utilise. diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md new file mode 100644 index 0000000..972dca1 --- /dev/null +++ b/doc/POST_INSTALL.md @@ -0,0 +1,4 @@ +Your SMP server address: + +smp://__FINGERPRINT__@__PUBLIC_IP4__:__PORT__ + diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md new file mode 100644 index 0000000..132e29d --- /dev/null +++ b/doc/POST_INSTALL_fr.md @@ -0,0 +1,4 @@ +Adresse de votre serveur SMP : + +smp://__FINGERPRINT__@__PUBLIC_IP4__:__PORT__ + diff --git a/doc/POST_UPGRADE.md b/doc/POST_UPGRADE.md new file mode 100644 index 0000000..972dca1 --- /dev/null +++ b/doc/POST_UPGRADE.md @@ -0,0 +1,4 @@ +Your SMP server address: + +smp://__FINGERPRINT__@__PUBLIC_IP4__:__PORT__ + diff --git a/doc/POST_UPGRADE_fr.md b/doc/POST_UPGRADE_fr.md new file mode 100644 index 0000000..132e29d --- /dev/null +++ b/doc/POST_UPGRADE_fr.md @@ -0,0 +1,4 @@ +Adresse de votre serveur SMP : + +smp://__FINGERPRINT__@__PUBLIC_IP4__:__PORT__ + diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 69d0894..0000000 --- a/manifest.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "SimpleX", - "id": "simplex", - "packaging_format": 1, - "description": { - "en": "Messaging platform operating without user identifiers", - "fr": "Plate-forme de messagerie fonctionnant sans identifiants d'utilisateurs" - }, - "version": "4.1.0~ynh1", - "url": "https://simplex.chat/", - "upstream": { - "license": "AGPL-3.0", - "website": "https://simplex.chat/", - "code": "https://github.com/simplex-chat/simplex-chat" - }, - "license": "AGPL-3.0", - "maintainer": { - "name": "eric_G", - "email": "" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": false, - "services": [], - "arguments": { - "install": [] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..e81f619 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,42 @@ +packaging_format = 2 + +id = "simplex" +name = "SimpleX" +description.en = "Messaging platform operating without user identifiers" +description.fr = "Plate-forme de messagerie fonctionnant sans identifiants d'utilisateurs" + +version = "4.4.1~ynh1" + +maintainers = ["eric_G"] + +[upstream] +license = "AGPL-3.0" +website = "https://simplex.chat/" +admindoc = "https://github.com/simplex-chat/simplex-chat/blob/stable/docs/SERVER.md" +code = "https://github.com/simplex-chat/simplex-chat" +cpe = "cpe:2.3:a:simplex:simplex_chat" +fund = "https://opencollective.com/simplex-chat" + +[integration] +yunohost = ">= 11.1.13" +architectures = ["amd64"] +multi_instance = false +ldap = "not_relevant" +sso = "not_relevant" +disk = "50M" +ram.build = "150M" +ram.runtime = "50M" + +[install] + +[resources] + [resources.ports] + main.default = 5223 + main.exposed = "TCP" + + [resources.system_user] + + [resources.install_dir] + dir = "/usr/local/bin/__APP__" + + [resources.permissions] diff --git a/scripts/backup b/scripts/backup index 2f0fd0e..3adb9d7 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,26 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_print_info --message="Loading installation settings..." - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -39,7 +19,9 @@ 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" + +ynh_backup --src_path="/etc/opt/simplex" #================================================= # BACKUP SYSTEMD diff --git a/scripts/change_url b/scripts/change_url deleted file mode 100644 index cfea773..0000000 --- a/scripts/change_url +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -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) - -#================================================= -# BACKUP BEFORE CHANGE URL 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 -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" - -#================================================= -# MODIFY URL IN NGINX CONF -#================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 - -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 - -#================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= - -#================================================= -# GENERIC FINALISATION -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - -#================================================= -# END OF SCRIPT -#================================================= - -ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index f1be40c..dd20ded 100755 --- a/scripts/install +++ b/scripts/install @@ -9,92 +9,41 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -final_path=/usr/local/bin/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -port=$(ynh_find_port --port=5223) -ynh_app_setting_set --app=$app --key=port --value=$port - -# Open the port -ynh_script_progression --message="Configuring firewall..." --weight=1 -ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" +ynh_setup_source --dest_dir="$install_dir" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" -chmod +x $final_path/smp-server +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" +chmod +x $install_dir/smp-server #================================================= # SPECIFIC SETUP #================================================= -pushd "$final_path" +pushd "$install_dir" public_ip4="$(curl -s ip.yunohost.org)" || true + ynh_app_setting_set --app=$app --key=public_ip4 --value=$public_ip4 ./smp-server init --no-password --ip $public_ip4 -y popd +fingerprint=$(cat /etc/opt/simplex/fingerprint) +ynh_app_setting_set --app=$app --key=fingerprint --value=$fingerprint + chown -R $app:$app "/etc/opt/simplex" #================================================= -# SETUP SYSTEMD +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app ..." --weight=6 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Messaging platform" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port" #================================================= diff --git a/scripts/remove b/scripts/remove index f70a931..33d032c 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,15 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -port=$(ynh_app_setting_get --app=$app --key=port) - #================================================= # STANDARD REMOVE #================================================= @@ -32,43 +23,18 @@ then fi #================================================= -# STOP AND REMOVE SERVICE +# REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 +# REMOVE SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 - # Remove the app directory securely -ynh_secure_remove --file="/usr/local/bin/simplex" - ynh_secure_remove --file="/etc/opt/simplex" -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 4ddfdeb..6eb851b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,69 +10,29 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -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" - #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=1 -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 -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= -# RESTORE SYSTEMD +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=4 + +ynh_restore_file --origin_path="/etc/opt/simplex" +chown -R $app:$app "/etc/opt/simplex" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Messaging platform" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a5cb373..effc4c9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,35 +9,21 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) - #================================================= # CHECK VERSION #================================================= 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=1 -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#================================================= +# STORE SETTINGS +#================================================= + +public_ip4="$(curl -s ip.yunohost.org)" || true +fingerprint=$(cat /etc/opt/simplex/fingerprint) +ynh_app_setting_set --app=$app --key=public_ip4 --value=$public_ip4 +ynh_app_setting_set --app=$app --key=fingerprint --value=$fingerprint #================================================= # STANDARD UPGRADE STEPS @@ -48,14 +34,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" -#================================================= -# CREATE DEDICATED USER -#================================================= -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" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -65,26 +43,21 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$install_dir" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" +chmod +x $install_dir/smp-server #================================================= -# SETUP SYSTEMD +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=4 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Messaging platform" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port" #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..3b883e2 --- /dev/null +++ b/tests.toml @@ -0,0 +1,9 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ + + exclude = ["change_url"]