From 3d356f1637c057be02c4c6b2d49b3c254129d26c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 26 Jan 2021 10:55:33 +0100 Subject: [PATCH] Fix --- README.md | 76 ++++++++++++++++----- check_process | 14 ---- manifest.json.old | 58 ---------------- scripts/backup | 68 ++++++++++++------- scripts/install | 9 +-- scripts/install.old | 160 -------------------------------------------- scripts/remove | 79 +++++----------------- 7 files changed, 120 insertions(+), 344 deletions(-) delete mode 100644 manifest.json.old delete mode 100644 scripts/install.old diff --git a/README.md b/README.md index e9b4359..5e57b99 100644 --- a/README.md +++ b/README.md @@ -3,31 +3,73 @@ [![Integration level](https://dash.yunohost.org/integration/matterbridge.svg)](https://dash.yunohost.org/appci/app/matterbridge) ![](https://ci-apps.yunohost.org/ci/badges/matterbridge.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/matterbridge.maintain.svg) [![Install matterbridge with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=matterbridge) -matterbridge Server +*[Lire ce readme en français.](./README_fr.md)* -**Shipped version:** 1.17.4 +> *This package allows you to install REPLACEBYYOURAPP quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* -- [Yunohost project](https://yunohost.org) -- [matterbridge website](https://github.com/42wim/matterbridge) +## Overview +Quick description of this app. -![](https://raw.githubusercontent.com/42wim/matterbridge/master/img/matterbridge-notext.gif) +**Shipped version:** 1.21.0 +## Screenshots -[![Install matterbridge with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=matterbridge) +![](Link to a screenshot of this app.) -### Installing guide +## Demo - App can be installed by YunoHost **admin web-interface** or by **running following command**: +* [Official demo](Link to a demo site for this app.) - $ sudo yunohost app install https://github.com/YunoHost-Apps/matterbridge_ynh - - After install : - - 1. need to edit file /opt/matterbridge/matterbridge.toml - 2. restart service systemctl restart matterbridge +## Configuration - -### Upgrade this package: +How to configure this app: From an admin panel, a plain file with SSH, or any other way. - $ sudo yunohost app upgrade matterbridge -u https://github.com/YunoHost-Apps/matterbridge_ynh +## Documentation + * Official documentation: Link to the official documentation of this app + * YunoHost documentation: If specific documentation is needed, feel free to contribute. + +## YunoHost specific features + +#### Multi-user support + +Are LDAP and HTTP auth supported? +Can the app be used by multiple users? + +#### Supported architectures + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/REPLACEBYYOURAPP/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/REPLACEBYYOURAPP%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/REPLACEBYYOURAPP/) + +## Limitations + +* Any known limitations. + +## Additional information + +* Other info you would like to add about this app. + +**More info on the documentation page:** +https://yunohost.org/packaging_apps + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/issues + * App website: Link to the official website of this app. + * Upstream app repository: https://github.com/42wim/matterbridge + * YunoHost website: https://yunohost.org/ + +--- + +## Developer info + +**Only if you want to use a testing branch for coding, instead of merging directly into master.** +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug +or +sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index 0cbeae3..4392a8d 100644 --- a/check_process +++ b/check_process @@ -21,22 +21,8 @@ upgrade=1 backup_restore=1 multi_instance=1 - incorrect_path=1 port_already_use=0 change_url=0 -;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: - Level 4=1 (This app supports the Nextcloud LDAP auth) -# Level 5: - Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email= Notification=none diff --git a/manifest.json.old b/manifest.json.old deleted file mode 100644 index 01f8af7..0000000 --- a/manifest.json.old +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "matterbridge", - "id": "matterbridge", - "packaging_format": 1, - "description": { - "en": "matterbridge package for YunoHost.", - "fr": "matterbridge pour YunoHost." - }, - "version": "1.16.0", - "url": "https://github.com/42wim/matterbridge", - "license": "GPL-3.0", - "maintainer": { - "name": "liberodark", - "email": "liberodark@gmail.com" - }, - "requirements": { - "yunohost": ">= 2.7.2" - }, - "multi_instance": false, - "services": [ - "nginx", - "php5-fpm", - "mysql" - ], - "arguments": { - "install": [{ - "name": "domain", - "type": "domain", - "ask": { - "en": "Choose a domain name for matterbridge", - "fr": "Choisissez un nom de domaine pour matterbridge" - }, - "example": "example.com" - }, - - { - "name": "path", - "type": "path", - "ask": { - "en": "Choose a path for matterbridge /matterbridge is accepted", - "fr": "Choisissez un chemin pour matterbridge /matterbridge est accepté" - }, - "example": "/matterbridge", - "default": "/matterbridge" - }, - - { - "name": "is_public", - "type": "boolean", - "ask": { - "en": "Is it a public site ?", - "fr": "Est-ce un site public ?" - }, - "default": "true" - } - ] - } -} diff --git a/scripts/backup b/scripts/backup index b0a7d3f..4f204ef 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,33 +1,51 @@ #!/bin/bash -# Exit on command errors and treat unset variables as an error -set -eu +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= -# See comments in install script -app=$YNH_APP_INSTANCE_NAME - -# Source YunoHost helpers +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -# Backup sources & data -# Note: the last argument is where to save this path, see the restore script. -ynh_backup "/opt/${app}" "sources" +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= -### MySQL (remove if not used) ### -# If a MySQL database is used: -# # Dump the database -# dbname=$app -# dbuser=$app -# dbpass=$(ynh_app_setting_get "$app" mysqlpwd) -# mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql -### MySQL end ### +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors -# Copy NGINX configuration -domain=$(ynh_app_setting_get "$app" domain) -ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" +#================================================= +# LOAD SETTINGS +#================================================= +ynh_print_info --message="Loading installation settings..." -### PHP (remove if not used) ### -# If a dedicated php-fpm process is used: -# # Copy PHP-FPM pool configuration -# ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf" -### PHP end ### +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) + +#================================================= +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + +#================================================= +# BACKUP THE APP MAIN DIR +#================================================= + +ynh_backup --src_path="$final_path" + +#================================================= +# BACKUP SYSTEMD +#================================================= + +ynh_backup --src_path="/etc/systemd/system/$app.service" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 81a9ac6..13a6c57 100644 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,7 @@ ynh_abort_if_errors # Retrieve arguments is_public=$YNH_APP_ARG_IS_PUBLIC +architecture=$(ynh_detect_arch) app=$YNH_APP_INSTANCE_NAME @@ -43,14 +44,10 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --time --weight=1 +#ynh_script_progression --message="Installing dependencies..." --time --weight=1 #ynh_install_app_dependencies $pkg_dependencies -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -58,7 +55,7 @@ ynh_script_progression --message="Setting up source files..." --time --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="$final_path" --source_id="$architecture" #================================================= # NGINX CONFIGURATION diff --git a/scripts/install.old b/scripts/install.old deleted file mode 100644 index ea7067b..0000000 --- a/scripts/install.old +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/bash - -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -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 -#================================================= - -# Retrieve arguments -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -is_public=$YNH_APP_ARG_IS_PUBLIC - -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= - -### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" -final_path=/opt/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" - -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path $path_url) - -# Check web path availability -ynh_webpath_available $domain $path_url -# Register (book) web path -ynh_webpath_register $app $domain $path_url - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= - -ynh_app_setting_set $app domain $domain -ynh_app_setting_set $app path $path_url -ynh_app_setting_set $app is_public $is_public - - -#================================================= -# INSTALL DEPENDENCIES -#================================================= - -ynh_print_info "Installing dependencies..." - -### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package. -### Those deb packages will be installed as dependencies of this package. -### If you're not using this helper: -### - Remove the section "REMOVE DEPENDENCIES" in the remove script -### - As well as the section "REINSTALL DEPENDENCIES" in the restore script -### - And the section "UPGRADE DEPENDENCIES" in the upgrade script - -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - -ynh_app_setting_set $app final_path $final_path -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" - -#================================================= -# NGINX CONFIGURATION -#================================================= - -# Create a dedicated nginx config -#ynh_add_nginx_config - -#================================================= -# CREATE DEDICATED USER -#================================================= - -# Create a system user -ynh_system_user_create $app - -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -cp -a ../conf/matterbridge.toml $final_path/matterbridge.toml - -#ynh_replace_string "yunouser" "$db_name" "$final_path/config/config_inc.php.sample" -#ynh_replace_string "yunopass" "$db_pwd" "$final_path/config/config_inc.php.sample" -#ynh_replace_string "yunobase" "$db_name" "$final_path/config/config_inc.php.sample" - -#================================================= -# SETUP SYSTEMD -#================================================= - -ynh_add_systemd_config -systemctl enable $app.service - -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - -### `ynh_store_file_checksum` is used to store the checksum of a file. -### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`, -### you can make a backup of this file before modifying it again if the admin had modified it. - -# Calculate and store the config file checksum into the app settings -#ynh_store_file_checksum "/etc/onlyoffice/documentserver/nginx/onlyoffice-documentserver.conf" - - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -### For security reason, any app should set the permissions to root: before anything else. -### Then, if write authorization is needed, any access should be given only to directories -### that really need such authorization. - -# Set permissions to app files -chown -R $app: $final_path - - -#================================================= -# SETUP SSOWAT -#================================================= - -# If app is public, add url to SSOWat conf as skipped_uris -if [ $is_public -eq 1 ]; then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set "$app" unprotected_uris "/" -fi - -# Reload services -#systemctl reload nginx -systemctl restart $app diff --git a/scripts/remove b/scripts/remove index fe7886a..519ba09 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,31 +12,31 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --time --weight=1 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -port=$(ynh_app_setting_get $app port) -final_path=$(ynh_app_setting_get $app final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +port=$(ynh_app_setting_get --app=$app --key=port) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE #================================================= -# REMOVE SERVICE FROM ADMIN PANEL +# REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove a service from the admin panel, added by `yunohost service add` -if yunohost service status $app >/dev/null 2>&1 +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_print_info "Removing $app service" + ynh_script_progression --message="Removing $app service integration..." --time --weight=1 yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_print_info "Stopping and removing the systemd service" +ynh_script_progression --message="Stopping and removing the systemd service..." --time --weight=1 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -44,7 +44,7 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_print_info "Removing dependencies" +ynh_script_progression --message="Removing dependencies..." --time --weight=1 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -52,72 +52,23 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info "Removing app main directory" +ynh_script_progression --message="Removing app main directory..." --time --weight=1 # Remove the app directory securely -ynh_secure_remove "$final_path" - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_print_info "Removing nginx web server configuration" - -# Remove the dedicated nginx config -ynh_remove_nginx_config - -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -#ynh_print_info "Removing php-fpm configuration" - -# Remove the dedicated php-fpm config -#ynh_remove_fpm_config - -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_print_info "Removing logrotate configuration" - -# Remove the app-specific logrotate config -ynh_remove_logrotate - -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_print_info "Closing port $port" - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE THE CRON FILE -#================================================= - -# Remove a cron file -ynh_secure_remove "/etc/cron.d/$app" - -# Remove a directory securely -ynh_secure_remove "/etc/$app/" - -# Remove the log files -ynh_secure_remove "/var/log/$app/" +ynh_secure_remove --file="$final_path" #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info "Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user..." --time --weight=1 # Delete a system user -ynh_system_user_delete $app +ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" --time --last