mirror of
https://github.com/YunoHost-Apps/simplex_ynh.git
synced 2024-09-03 20:26:28 +02:00
commit
f8e75ee9ea
20 changed files with 124 additions and 459 deletions
25
README.md
25
README.md
|
@ -6,6 +6,7 @@ It shall NOT be edited by hand.
|
|||
# SimpleX for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/simplex)  
|
||||
|
||||
[](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
|
||||
|
||||

|
||||
|
||||
## 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.
|
||||
|
||||
[<img src="https://github.com/simplex-chat/.github/blob/master/profile/images/apple_store.svg" alt="iOS app" height="42">](https://apps.apple.com/us/app/simplex-chat/id1605771084)
|
||||
|
||||
[](https://play.google.com/store/apps/details?id=chat.simplex.app)
|
||||
|
||||
[<img src="https://github.com/simplex-chat/.github/blob/master/profile/images/f_droid.svg" alt="F-Droid" height="41">](https://app.simplex.chat)
|
||||
|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: <https://simplex.chat/>
|
||||
* Official admin documentation: <https://github.com/simplex-chat/simplex-chat/blob/stable/docs/SERVER.md>
|
||||
* Upstream app code repository: <https://github.com/simplex-chat/simplex-chat>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_simplex>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/simplex_ynh/issues>
|
||||
|
|
25
README_fr.md
25
README_fr.md
|
@ -6,6 +6,7 @@ It shall NOT be edited by hand.
|
|||
# SimpleX pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/simplex)  
|
||||
|
||||
[](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
|
||||
|
||||

|
||||
|
||||
## 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.
|
||||
|
||||
[<img src="https://github.com/simplex-chat/.github/blob/master/profile/images/apple_store.svg" alt="iOS app" height="42">](https://apps.apple.com/us/app/simplex-chat/id1605771084)
|
||||
|
||||
[](https://play.google.com/store/apps/details?id=chat.simplex.app)
|
||||
|
||||
[<img src="https://github.com/simplex-chat/.github/blob/master/profile/images/f_droid.svg" alt="F-Droid" height="41">](https://app.simplex.chat)
|
||||
|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l’app : <https://simplex.chat/>
|
||||
* Documentation officielle de l’admin : <https://github.com/simplex-chat/simplex-chat/blob/stable/docs/SERVER.md>
|
||||
* Dépôt de code officiel de l’app : <https://github.com/simplex-chat/simplex-chat>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_simplex>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/simplex_ynh/issues>
|
||||
|
|
|
@ -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&
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
|
@ -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.
|
4
doc/POST_INSTALL.md
Normal file
4
doc/POST_INSTALL.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
Your SMP server address:
|
||||
|
||||
smp://__FINGERPRINT__@__PUBLIC_IP4__:__PORT__
|
||||
|
4
doc/POST_INSTALL_fr.md
Normal file
4
doc/POST_INSTALL_fr.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
Adresse de votre serveur SMP :
|
||||
|
||||
smp://__FINGERPRINT__@__PUBLIC_IP4__:__PORT__
|
||||
|
4
doc/POST_UPGRADE.md
Normal file
4
doc/POST_UPGRADE.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
Your SMP server address:
|
||||
|
||||
smp://__FINGERPRINT__@__PUBLIC_IP4__:__PORT__
|
||||
|
4
doc/POST_UPGRADE_fr.md
Normal file
4
doc/POST_UPGRADE_fr.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
Adresse de votre serveur SMP :
|
||||
|
||||
smp://__FINGERPRINT__@__PUBLIC_IP4__:__PORT__
|
||||
|
|
@ -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": []
|
||||
}
|
||||
}
|
42
manifest.toml
Normal file
42
manifest.toml
Normal file
|
@ -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]
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -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"
|
||||
|
||||
#=================================================
|
||||
|
|
9
tests.toml
Normal file
9
tests.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
# ------------
|
||||
# Tests to run
|
||||
# ------------
|
||||
|
||||
exclude = ["change_url"]
|
Loading…
Add table
Reference in a new issue