From f2f21b8ff07f2783bc3702139625736cbcd266d9 Mon Sep 17 00:00:00 2001 From: Dante Date: Sun, 4 Jun 2023 21:30:13 +0100 Subject: [PATCH] Packaging v2 WIP --- conf/amd64.src | 6 --- conf/arm64.src | 6 --- conf/armhf.src | 6 --- conf/systemd.service | 6 +-- config_panel.toml | 40 +++++++-------- manifest.json | 114 ------------------------------------------- manifest.toml | 110 +++++++++++++++++++++++++++++++++++++++++ scripts/_common.sh | 23 +++------ scripts/backup | 14 +----- scripts/config | 16 +++--- scripts/install | 110 ++++++----------------------------------- scripts/remove | 35 ------------- scripts/restore | 75 ++-------------------------- scripts/upgrade | 53 +++++--------------- 14 files changed, 181 insertions(+), 433 deletions(-) delete mode 100644 conf/amd64.src delete mode 100644 conf/arm64.src delete mode 100644 conf/armhf.src delete mode 100644 manifest.json create mode 100644 manifest.toml diff --git a/conf/amd64.src b/conf/amd64.src deleted file mode 100644 index 3716081..0000000 --- a/conf/amd64.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/mautrix/whatsapp/releases/download/v0.8.5/mautrix-whatsapp-amd64 -SOURCE_SUM=2989419b6c8ce870189359a44a1642a22e6cc87d6344123622fa2d59d073a339 -SOURCE_SUM_PRG=sha256sum -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME=mautrix-whatsapp -SOURCE_EXTRACT=false diff --git a/conf/arm64.src b/conf/arm64.src deleted file mode 100644 index 4296588..0000000 --- a/conf/arm64.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/mautrix/whatsapp/releases/download/v0.8.5/mautrix-whatsapp-arm64 -SOURCE_SUM=e9c34620f5748bac34f4d15d9e9088ecf8676288edc9460bf6245688eafd6367 -SOURCE_SUM_PRG=sha256sum -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME=mautrix-whatsapp -SOURCE_EXTRACT=false diff --git a/conf/armhf.src b/conf/armhf.src deleted file mode 100644 index e63c3ca..0000000 --- a/conf/armhf.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/mautrix/whatsapp/releases/download/v0.8.5/mautrix-whatsapp-arm -SOURCE_SUM=6f664454fccabe023c6d7eb8ad85ed80ba7c5691605e16977cfc67ffed1a252a -SOURCE_SUM_PRG=sha256sum -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME=mautrix-whatsapp -SOURCE_EXTRACT=false diff --git a/conf/systemd.service b/conf/systemd.service index bee8791..0e8c08b 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,13 +6,13 @@ After=matrix-synapse.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/mautrix-whatsapp -c=__FINALPATH__/config.yaml +WorkingDirectory=__INSTALL_DIR__/ +ExecStart=__INSTALL_DIR__/mautrix-whatsapp -c=__INSTALL_DIR__/config.yaml Restart=always RestartSec=3 # Optional hardening to improve security -ReadWritePaths=__FINALPATH__/ /var/log/__APP__ +ReadWritePaths=__INSTALL_DIR__/ /var/log/__APP__ NoNewPrivileges=yes MemoryDenyWriteExecute=true PrivateDevices=yes diff --git a/config_panel.toml b/config_panel.toml index 27bff09..8e53315 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -42,7 +42,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "If allowed, '!wa set-relay' can be used to turn any Bridge User into a RelayBot for that chat. This allows people to talk on WhatsApp without an own account." - bind = "relay>enabled:__FINALPATH__/config.yaml" + bind = "relay>enabled:__INSTALL_DIR__/config.yaml" [main.bridge.admin_only] ask = "Should only Bridge Admins be allowed to set themselves as Relay Users?" @@ -50,7 +50,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "See User management -> Admins" - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" visible = "enable_relaybot" [main.bot] @@ -60,19 +60,19 @@ services = ["__APP__"] ask = "Username of the AppService Bot" type = "string" help = "Sets bot username. Please keep in mind that the bot admin room for previous bot username will stop working so you may need to create a new one using the new username" - bind = "bot>username:__FINALPATH__/config.yaml" + bind = "bot>username:__INSTALL_DIR__/config.yaml" [main.bot.displayname] ask = "Display name for Bot" type = "string" help = "Set to 'remove' to remove display name, leave empty to set default 'WhatsApp bridge bot'" - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" [main.bot.avatar] ask = "Avatar for Bot" type = "string" help = "Should be in format 'mxc://server_name/NeXNQarUbrlYBiPCpprYsRqr', see README for tutorial. Set to 'remove' to remove avatar, leave empty to use standard WhatsApp logo." - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" [privacy] name = "Privacy" @@ -95,7 +95,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Enable so-called End-to-Bridge (e2b) Encryption. For the Bridge to work in group chat Rooms with End-to-End Encryption (e2ee) enabled." - bind = "encryption>allow:__FINALPATH__/config.yaml" + bind = "encryption>allow:__INSTALL_DIR__/config.yaml" [privacy.portal_rooms.encryption_default] ask = "Force-enable Encryption in all Portal Rooms the Bridge creates?" @@ -103,7 +103,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "This will cause the Bridge Bot to be in private chats for the Encryption to work properly." - bind = "encryption>default:__FINALPATH__/config.yaml" + bind = "encryption>default:__INSTALL_DIR__/config.yaml" visible = "encryption" [privacy.portal_rooms.encryption_require] @@ -112,7 +112,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Require encryption, drop any unencrypted messages." - bind = "encryption>require:__FINALPATH__/config.yaml" + bind = "encryption>require:__INSTALL_DIR__/config.yaml" visible = "encryption" [privacy.config] @@ -124,7 +124,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Should the bridge send a read Receipt from the bridge bot when a message has been sent to WhatsApp?" - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" [privacy.config.send_presence_on_typing] ask = "Send Presence on typing?" @@ -132,7 +132,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Send the Presence as 'available' to WhatsApp when Users start typing on a Portal." - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" [privacy.config.url_previews] ask = "Enable URL Preview?" @@ -140,7 +140,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Should the Bridge detect URLs in outgoing messages, ask the HomeServer to generate a Preview, and send it to WhatsApp?" - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" [advanced] name = "Advanced Settings" @@ -160,19 +160,19 @@ services = ["__APP__"] ask = "Localpart template of MXIDs for WhatsApp users" type = "string" help = "Defaults to 'whatsapp_{{.}}'. '{{.}}' is replaced with the phone number 'msidsn' of the WhatsApp user." - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" [advanced.whatsapp.os_name] ask = "Device name in the 'WhatsApp Web' section of the smartphone app" type = "string" - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" [advanced.whatsapp.browser_name] ask = "Browser name that determines the logo shown in the smartphone app" type = "select" choices = ["unknown", "chrome", "firefox", "ie", "opera", "safari", "edge", "desktop", "ipad", "android_tablet", "ohana", "aloha", "catalina", "tcl_tv"] help = "Must be 'unknown' for a generic icon or a valid browser name if you want a specific logo." - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" [advanced.appservice] name = "HomeServer Application Service" @@ -183,7 +183,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Enable only if HomeServer supports https://github.com/matrix-org/matrix-spec-proposals/pull/2246?" - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" [advanced.appservice.ephemeral_events] ask = "Receive Ephemeral Events via AppService transactions?" @@ -191,14 +191,14 @@ services = ["__APP__"] yes = "true" no = "false" help = "Enable only if HomeServer supports MSC2409 (i.e. Synapse 1.22+). If enabled, you should disable bridge -> 'sync_with_custom_puppets'." - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" - [advanced.appservice.print_level] + [advanced.appservice.min_level] ask = "Logging print level for Standard Output" type = "select" choices = ["debug", "info", "warn", "error", "fatal"] help = "Minimum severity for log messages printed to stdout/stderr. This doesn't affect the log file." - bind = ":__FINALPATH__/config.yaml" + bind = ":__INSTALL_DIR__/config.yaml" [advanced.metrics] name = "Prometheus Metrics" @@ -208,12 +208,12 @@ services = ["__APP__"] type = "boolean" yes = "true" no = "false" - bind = "metrics>enabled:__FINALPATH__/config.yaml" + bind = "metrics>enabled:__INSTALL_DIR__/config.yaml" [advanced.metrics.listen_port] ask = "IP and Port for the Metrics listener?" type = "string" help = "Defaults to: '127.0.0.1:8001'. The path is always /metrics" - bind = "metrics>listen:__FINALPATH__/config.yaml" + bind = "metrics>listen:__INSTALL_DIR__/config.yaml" visible = "enable_metrics" diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 828a084..0000000 --- a/manifest.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "name": "Matrix-WhatsApp bridge", - "id": "mautrix_whatsapp", - "packaging_format": 1, - "description": { - "en": "Matrix / Synapse puppeting bridge for WhatsApp", - "fr": "Passerelle Matrix / Synapse pour WhatsApp" - }, - "version": "0.8.5~ynh1", - "url": "https://github.com/mautrix/whatsapp", - "upstream": { - "license": "AGPL-3.0-or-later", - "website": "https://maunium.net/go/mautrix-whatsapp/", - "admindoc": "https://docs.mau.fi/bridges/go/whatsapp/index.html", - "code": "https://github.com/mautrix/whatsapp" - }, - "license": "AGPL-3.0-or-later", - "maintainer": { - "name": "thardev", - "email": "", - "url": "https://github.com/YunoHost-Apps/mautrix_whatsapp_ynh" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": true, - "services": [ - "postgresql" - ], - "arguments": { - "install": [ - { - "name": "synapsenumber", - "type": "string", - "ask": { - "en": "Choose the local Synapse instance number to communicate with mautrix_whatsapp.", - "fr": "Choisissez le numéro de l'instance Synapse qui doit communiquer avec mautrix_whatsapp." - }, - "example": "2 (for instance synapse__2)", - "help": { - "en": "If you installed Synapse only once time, then leave default value 1.", - "fr": "Si vous n'avez installé qu'une fois Synapse, gardez la valeur par défaut 1." - }, - "default": "1" - }, - { - "name": "botname", - "type": "string", - "ask": { - "en": "Choose a local Synapse user name for the WhatsApp bot", - "fr": "Choisissez un nom d'utilisateur Synapse local pour le robot WhatsApp" - }, - "example": "whatsappbot", - "help": { - "en": "A system user will be created. Invite @whatsappbot:localsynapse.servername from an authorized Matrix account to start bridging.\nGive the Matrix server_name, not the full domain/URL.", - "fr": "Un utilisateur système sera créé. Inviter @whatsappbot:localsynapse.servername depuis un compte Matrix autorisé pour démarrer une passerelle.\nDonner le nom du serveur Matrix, pas le domaine/URL complet." - }, - "default": "whatsappbot" - }, - { - "name": "bot_synapse_adm", - "type": "boolean", - "ask": { - "en": "Give the WhatsApp bot administrator rights to the Synapse instance?", - "fr": "Donner au robot WhatsApp des droits administrateur à l'instance Synapse ?" - }, - "help": { - "en": "If true, the bot can group WhatsApp chats in a Matrix space.\nNot required if you set up Synapse so that non-admins are authorized to create communities.", - "fr": "Si true, le robot groupera les conversations WhatsApp dans une communauté Matrix.\nPas nécessaire si vous avez réglé Synapse pour qu'il autorise les non-admin à créer des communautés." - }, - "default": true - }, - { - "name": "encryption", - "type": "boolean", - "ask": { - "en": "Enable end-to-bridge encryption?", - "fr": "Activer le chiffrement entre Synapse et le bridge ?" - }, - "help": { - "en": "Only activate if you know the prerequisites and constraints related to e2b.", - "fr": "N'activer que si vous connaissez les prérequis et constraintes liées à e2b." - }, - "default": false - }, - { - "name": "botadmin", - "type": "string", - "ask": { - "en": "Choose the Matrix account administrator of the WhatsApp bot", - "fr": "Choisissez le compte Matrix administrateur du robot WhatsApp" - }, - "example": "@johndoe:localsynapse.servername or @johndoe:matrix.org", - "help": { - "en": "The administrator does not need to be a local Synapse account. Valid formats are @johndoe:localsynapse.servername or @johndoe:matrix.org", - "fr": "L'administrateur peut ne pas être un compte local Synapse. Les formats valables sont @johndoe:localsynapse.servername or @johndoe:matrix.org" - } - }, - { - "name": "botusers", - "type": "string", - "ask": { - "en": "Choose Matrix user(s) authorized to bridge with the WhatsApp bot.", - "fr": "Choisissez le/les compte(s) Matrix autorisés à utiliser la passerelle WhatsApp." - }, - "example": "@johndoe:server.name or server.name or *", - "help": { - "en": "A remote or local user (@johndoe:server.name),the local server (server.name), a remote server (matrix.org), or all remote/local servers (*) can be authorized.\nGive the Matrix server_name, not the full domain/URL.\nIt is also possible to specify multiple values by separating them with comma. Example: @johndoe:server.name,domain.tld,matrix.org", - "fr": "Un compte local ou distant (@johndoe:server.name), le serveur local (server.name), un serveur distant (matrix.org), ou tous les serveurs remote/local (*).\nDonner le nom du serveur Matrix, pas le domaine/URL complet\nIl est également possible de spécifier plusieurs valeurs en les séparant par une virgule. Exemple : @johndoe:server.name,domain.tld,matrix.org" - } - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..29872df --- /dev/null +++ b/manifest.toml @@ -0,0 +1,110 @@ +packaging_format = 2 +id = "mautrix_whatsapp" +name = "Matrix-WhatsApp bridge" +description.en = "Matrix / Synapse puppeting bridge for WhatsApp" +description.fr = "Passerelle Matrix / Synapse pour WhatsApp" +version = "0.8.5~ynh1" +maintainers = ["thardev"] + +[upstream] +license = "AGPL-3.0-or-later" +website = "https://maunium.net/go/mautrix-whatsapp/" +code = "https://github.com/mautrix/whatsapp" +admindoc = "https://docs.mau.fi/bridges/go/whatsapp/index.html" + +[integration] +yunohost = ">= 11.1" +architectures = ["amd64", "arm64", "armhf"] +multi_instance = true +ldap = false +sso = false +disk = "100M" +ram.build = "1M" +ram.runtime = "1M" + +[install] + +[install.synapse_instance] +ask.en = "Choose the local Synapse instance to communicate with mautrix_whatsapp." +ask.fr = "Choisissez l'instance Synapse qui doit communiquer avec mautrix_whatsapp." +type = "app" +pattern.regexp = "synapse(__)*[0-9]*" +pattern.error = "Invalid app selected. Please select a Synapse instance." +help.en = "Usually the Synapse instances contain a number after it is installed more than one time. E.g. synapse__1 will be the second instance." +help.fr = "En général, les instances de Synapse contiennent un numéro après avoir été installées plus d'une fois. Par exemple, synapse__1 sera la deuxième instance." + +[install.botname] +ask.en = "Choose a local Synapse user name for the WhatsApp bot" +ask.fr = "Choisissez un nom d'utilisateur Synapse local pour le robot WhatsApp" +type = "string" +example = "whatsappbot" +help.en = "A system user will be created. Invite @whatsappbot:localsynapse.servername from an authorized Matrix account to start bridging.Give the Matrix server_name, not the full domain/URL." +help.fr = "Un utilisateur système sera créé. Inviter @whatsappbot:localsynapse.servername depuis un compte Matrix autorisé pour démarrer une passerelle.Donner le nom du serveur Matrix, pas le domaine/URL complet." +default = "whatsappbot" + +[install.bot_synapse_adm] +ask.en = "Give the WhatsApp bot administrator rights to the Synapse instance?" +ask.fr = "Donner au robot WhatsApp des droits administrateur à l'instance Synapse ?" +type = "boolean" +help.en = "If true, the bot can group WhatsApp chats in a Matrix space.Not required if you set up Synapse so that non-admins are authorized to create communities." +help.fr = "Si true, le robot groupera les conversations WhatsApp dans une communauté Matrix.Pas nécessaire si vous avez réglé Synapse pour qu'il autorise les non-admin à créer des communautés." +default = true + +[install.encryption] +ask.en = "Enable end-to-bridge encryption?" +ask.fr = "Activer le chiffrement entre Synapse et le bridge ?" +type = "boolean" +help.en = "Only activate if you know the prerequisites and constraints related to E2B." +help.fr = "N'activer que si vous connaissez les prérequis et constraintes liées à E2B." +default = true + +[install.botadmin] +ask.en = "Choose the Matrix account administrator of the WhatsApp bot" +ask.fr = "Choisissez le compte Matrix administrateur du robot WhatsApp" +type = "string" +example = "@johndoe:localsynapse.servername or @johndoe:matrix.org" +help.en = "The administrator does not need to be a local Synapse account. Valid formats are @johndoe:localsynapse.servername or @johndoe:matrix.org" +help.fr = "L'administrateur peut ne pas être un compte local Synapse. Les formats valables sont @johndoe:localsynapse.servername or @johndoe:matrix.org" + +[install.botusers] +ask.en = "Choose Matrix user(s) authorized to bridge with the WhatsApp bot." +ask.fr = "Choisissez le/les compte(s) Matrix autorisés à utiliser la passerelle WhatsApp." +type = "string" +example = "@johndoe:server.name or server.name or *" +help.en = """ +A remote or local user (@johndoe:server.name),the local server (server.name), a remote server (matrix.org), or all remote/local servers (*) can be authorized. +Give the Matrix server_name, not the full domain/URL. +It is also possible to specify multiple values by separating them with comma. Example: @johndoe:server.name,domain.tld,matrix.org""" +help.fr = """Un compte local ou distant (@johndoe:server.name), le serveur local (server.name), un serveur distant (matrix.org), ou tous les serveurs remote/local (*). +Donner le nom du serveur Matrix, pas le domaine/URL complet. +Il est également possible de spécifier plusieurs valeurs en les séparant par une virgule. Exemple : @johndoe:server.name,domain.tld,matrix.org""" + +[resources] + +[resources.apt] +packages = "g++, postgresql, ffmpeg" + +[resources.database] +type = "postgresql" + +[resources.system_user] +home = "/opt/yunohost/__APP__" + +[resources.install_dir] +dir = "/opt/yunohost/__APP__" + +[resources.ports] +main.default = 8449 + +[resources.sources] + +[resources.sources.main] +in_subdir = false +extract = false +rename = "mautrix-whatsapp" +amd64.url = "https://github.com/mautrix/whatsapp/releases/download/v0.8.5/mautrix-whatsapp-amd64" +amd64.sha256 = "2989419b6c8ce870189359a44a1642a22e6cc87d6344123622fa2d59d073a339" +arm64.url = "https://github.com/mautrix/whatsapp/releases/download/v0.8.5/mautrix-whatsapp-arm64" +arm64.sha256 = "e9c34620f5748bac34f4d15d9e9088ecf8676288edc9460bf6245688eafd6367" +armhf.url = "https://github.com/mautrix/whatsapp/releases/download/v0.8.5/mautrix-whatsapp-arm" +armhf.sha256 = "6f664454fccabe023c6d7eb8ad85ed80ba7c5691605e16977cfc67ffed1a252a" \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index 1431a9f..bc0deff 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,12 +1,5 @@ #!/bin/bash -#================================================= -# COMMON VARIABLES -#================================================= - -# dependencies used by the app (must be on a single line) -pkg_dependencies="g++ postgresql ffmpeg" - #================================================= # CONFIG PANEL SETTERS #================================================= @@ -22,24 +15,24 @@ apply_permissions() { then #ynh_systemd_action --service_name="$app" --action=stop # Get all entries between "permissions:" and "relay:" keys, remove the role part, remove commented parts, format it with newlines and clean whitespaces and double quotes. - allDefinedEntries=$(awk '/permissions:/{flag=1; next} /relay:/{flag=0} flag' "$final_path/config.yaml" | sed "/: $role/d" | sed -r 's/: (admin|user|relay)//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr ',' '\n' ) + allDefinedEntries=$(awk '/permissions:/{flag=1; next} /relay:/{flag=0} flag' "$install_dir/config.yaml" | sed "/: $role/d" | sed -r 's/: (admin|user|relay)//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr ',' '\n' ) # Delete everything from the corresponding role to insert the new defined values. This way we also handle deletion of users. - sed -i "/permissions:/,/relay:/{/: $role/d;}" "$final_path/config.yaml" + sed -i "/permissions:/,/relay:/{/: $role/d;}" "$install_dir/config.yaml" # Ensure that entries with value surrounded with quotes are deleted too. E.g. "users". - sed -i "/permissions:/,/relay:/{/: \"$role\"/d;}" "$final_path/config.yaml" + sed -i "/permissions:/,/relay:/{/: \"$role\"/d;}" "$install_dir/config.yaml" for user in "${usersArray[@]}" do if grep -q -x "${user}" <<< "$allDefinedEntries" then ynh_print_info "User $user already defined in another role." else - sed -i "/permissions:/a \ \\\"$user\": $role" "$final_path/config.yaml" # Whitespaces are needed so that the file can be correctly parsed + sed -i "/permissions:/a \ \\\"$user\": $role" "$install_dir/config.yaml" # Whitespaces are needed so that the file can be correctly parsed fi done fi set +o noglob - ynh_print_info "Users with role $role added in $final_path/config.yaml" + ynh_print_info "Users with role $role added in $install_dir/config.yaml" } @@ -48,19 +41,19 @@ set__listuser() { role="user" ynh_app_setting_set --app=$app --key=listuser --value="$listuser" apply_permissions - ynh_store_file_checksum --file="$final_path/config.yaml" + ynh_store_file_checksum --file="$install_dir/config.yaml" } set__listrelay() { role="relay" ynh_app_setting_set --app=$app --key=listrelay --value="$listrelay" apply_permissions - ynh_store_file_checksum --file="$final_path/config.yaml" + ynh_store_file_checksum --file="$install_dir/config.yaml" } set__listadmin() { role="admin" ynh_app_setting_set --app=$app --key=listadmin --value="$listadmin" apply_permissions - ynh_store_file_checksum --file="$final_path/config.yaml" + ynh_store_file_checksum --file="$install_dir/config.yaml" } \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 917677c..2347381 100755 --- a/scripts/backup +++ b/scripts/backup @@ -17,18 +17,6 @@ source /usr/share/yunohost/helpers ynh_clean_setup () { 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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -39,7 +27,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" #================================================= # SPECIFIC BACKUP diff --git a/scripts/config b/scripts/config index b1a5de1..364874c 100644 --- a/scripts/config +++ b/scripts/config @@ -3,8 +3,6 @@ source _common.sh source /usr/share/yunohost/helpers ynh_abort_if_errors -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - #================================================= # SPECIFIC GETTERS FOR TOML SHORT KEY #================================================= @@ -15,7 +13,7 @@ get__botname() { } get__listuser() { - existingUsers=$(grep -- "\".*: user" "$final_path/config.yaml" | sed -r 's/: user//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',') + existingUsers=$(grep -- "\".*: user" "$install_dir/config.yaml" | sed -r 's/: user//' | tr -d '[:blank:]' | sed '/^#/d' | tr -d '\"' | tr '\n' ',') cat <