From 67d16cd5c8a3d2e2c44348ec3e8c41af6559e3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Feb 2023 19:21:12 +0100 Subject: [PATCH] Testing (#98) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * preserve config file * [autopatch] Add Common Platform Enumeration id to `manifest.json` (#80) Co-authored-by: Yunohost-Bot <> * Auto-update README * Update manifest.json * Update upgrade * Update upgrade * 0.48.0 (#82) * 0.48.0 * Auto-update README * Update manifest.json * Auto-update README * Update ss-desktop-player.png * Update systemd.service * Update install * Update upgrade * Update change_url Co-authored-by: yunohost-bot * Disable the activity panel that hangs some browsers (#86) * Testing (#84) * preserve config file * [autopatch] Add Common Platform Enumeration id to `manifest.json` (#80) Co-authored-by: Yunohost-Bot <> * Auto-update README * Update manifest.json * Update upgrade * Update upgrade * 0.48.0 (#82) * 0.48.0 * Auto-update README * Update manifest.json * Auto-update README * Update ss-desktop-player.png * Update systemd.service * Update install * Update upgrade * Update change_url Co-authored-by: yunohost-bot Co-authored-by: YunoHost Bot Co-authored-by: yunohost-bot * Disable the activity panel that hangs some browsers Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> Co-authored-by: YunoHost Bot Co-authored-by: yunohost-bot * Auto-update README * Update manifest.json * Auto-update README * Auto-update README * 0.49.0_ * Auto-update README * Add enable sharing to config panel * #85 * Update change_url * 0.49.1 * Update manifest.json * Auto-update README * Update manifest.json * Update manifest.json * Update install * Update upgrade * Update upgrade * Update manifest.json * 0.49.2 * Auto-update README * cleaning * Auto-update README * Auto-update README * 0.49.3 * Auto-update README * Version 2 (#97) * v2 * v2 * v2 * v2 * Auto-update README * v2 * Update upgrade * Update upgrade --------- Co-authored-by: yunohost-bot * Update navidrome.toml * Update config_panel.toml * Fix * Update manifest.toml * Update manifest.toml * Auto-update README * cleaning * Auto-update README --------- Co-authored-by: YunoHost Bot Co-authored-by: yunohost-bot Co-authored-by: selfhoster1312 <121760708+selfhoster1312@users.noreply.github.com> --- README.md | 15 +---- README_fr.md | 15 +---- check_process | 31 ---------- conf/navidrome.toml | 4 +- conf/systemd.service | 4 +- config_panel.toml | 12 ++-- doc/{DISCLAIMER.md => ADMIN.md} | 0 doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 0 doc/DESCRIPTION.md | 1 - doc/DESCRIPTION_fr.md | 1 - manifest.json | 63 ------------------- manifest.toml | 61 +++++++++++++++++++ scripts/_common.sh | 3 - scripts/backup | 19 +----- scripts/change_url | 5 -- scripts/install | 86 ++------------------------ scripts/remove | 37 ----------- scripts/restore | 57 ++--------------- scripts/upgrade | 88 ++++----------------------- tests.toml | 15 +++++ 20 files changed, 109 insertions(+), 408 deletions(-) delete mode 100644 check_process rename doc/{DISCLAIMER.md => ADMIN.md} (100%) rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (100%) delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/README.md b/README.md index 3406698..4a69c2b 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,11 @@ Navidrome indexes all digital music stored in your hard drive and makes it avail - Multi-user, each user has their own play counts, playlists, favourites, etc... - Very low resource usage - Automatically monitors your library for changes, importing new files and reloading new metadata -- Themeable, modern and responsive Web interface based on Material UI - Compatible with all Subsonic/Madsonic/Airsonic clients - Transcoding on the fly. Can be set per user/player. Opus encoding is supported -**Shipped version:** 0.49.3~ynh1 +**Shipped version:** 0.49.3~ynh2 **Demo:** https://demo.navidrome.org/app/#/login @@ -41,18 +40,6 @@ Navidrome indexes all digital music stored in your hard drive and makes it avail ![Screenshot of Navidrome](./doc/screenshots/ss-desktop-player.png) -## Disclaimers / important information - -#### Where are stored your music files - -Your music files are stored by default in your shared [multimedia folder](https://github.com/YunoHost-Apps/yunohost.multimedia) `/home/yunohost.multimedia/share/Music`. This folder is accessible from Nextcloud with *External Storages* enabled. This will allow you to easily upload your music files to the server. - -You can configure an alternative path to you music files by editing the path `MusicFolder = "/home/yunohost.multimedia/share/Music"` in this file `/var/lib/navidrome/navidrome.toml` using the [documentation](https://www.navidrome.org/docs/usage/configuration-options/). Remember to restart Navidrome service if you change your configuration file. - -#### Client player - -You must activate *public site* if you want to connect a client player to Navidrome. - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index 6cdfacb..8e621e2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -28,11 +28,10 @@ Navidrome indexe toute la musique numérique stockée sur votre disque dur et la - Multi-User, chaque utilisateur a ses propres listes de lecture, favoris etc. - Utilisation très faible des ressources - Surveille automatiquement votre bibliothèque pour des modifications, importation de nouveaux fichiers et recharger de nouvelles métadonnées -- Interface Web thématique, moderne et réactive basée sur l'interface utilisateur du matériel - Compatible avec tous les clients subsonique/madsononique/aironique - Encodage à la volée. Peut être défini par utilisateur/lecteur. Le codage opus est pris en charge -**Version incluse :** 0.49.3~ynh1 +**Version incluse :** 0.49.3~ynh2 **Démo :** https://demo.navidrome.org/app/#/login @@ -40,18 +39,6 @@ Navidrome indexe toute la musique numérique stockée sur votre disque dur et la ![Capture d’écran de Navidrome](./doc/screenshots/ss-desktop-player.png) -## Avertissements / informations importantes - -#### Où stocker votre musique - -Votre musique est a stockée par default dans le [dossier multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia) partagé `/home/yunohost.multimedia/share/Music`. Ce dossier, facilement accessible depuis Nextcloud avec *Stockages externes* activée, vous permettra d'*uploader* facilement vos fichiers de musique sur votre server. - -Vous pouvez personnaliser le dossier de stockage de vos fichiers de musique en éditant le fichier de configuration `/var/lib/navidrome/navidrome.toml` et rediriger la variable `MusicFolder = "/home/yunohost.multimedia/share/Music"`. Vous pouvez également changer d'autre réglage en vous aidant de la [documentation](https://www.navidrome.org/docs/usage/configuration-options/). Pensez à redémarrer le service de Navidrome si vous modifiez votre fichier de configuration. - -#### Utilisation d'un client - -Vous devez activer *site public* si vous souhaitez connecter un lecteur client à Navidrome. - ## Documentations et ressources * Site officiel de l’app : diff --git a/check_process b/check_process deleted file mode 100644 index 8ae619e..0000000 --- a/check_process +++ /dev/null @@ -1,31 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - port="4533" - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 0.40.0~ynh1 - upgrade=1 from_commit=e41c919ddb65673ea6b452e138d36c240be3b6b7 - # 0.47.0~ynh1 - upgrade=1 from_commit=d7eb59fdd7a47ef4365af59db857e763f70564a4 - backup_restore=1 - multi_instance=0 - port_already_use=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=e41c919ddb65673ea6b452e138d36c240be3b6b7 - name=Testing (#43) - ; commit=d7eb59fdd7a47ef4365af59db857e763f70564a4 - name=Testing (#70) - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/conf/navidrome.toml b/conf/navidrome.toml index be9bf3c..8891bcf 100644 --- a/conf/navidrome.toml +++ b/conf/navidrome.toml @@ -1,5 +1,5 @@ # Load configurations from an external config file -ConfigFile = "/var/lib/navidrome/navidrome.toml" +ConfigFile = "/var/lib/__APP__/navidrome.toml" # Log level. Useful for troubleshooting. Possible values: error, info, debug, trace LogLevel = "INFO" @@ -11,7 +11,7 @@ Address = "127.0.0.1" Port = "__PORT__" # Base URL (only the path part) to configure Navidrome behind a proxy (ex: /music) -BaseURL = "__PATH_URL__" +BaseURL = "__PATH__" # Configure periodic scans using “cron” syntax. To disable it altogether, set it to "" (empty string) ScanSchedule = "@every 1m30s" diff --git a/conf/systemd.service b/conf/systemd.service index 2a18a96..9474502 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Navidrome Music Server and Streamer compatible with Subsonic/Airsonic +Description=Navidrome: Music Server and Streamer compatible with Subsonic/Airsonic After=remote-fs.target network.target AssertPathExists=__CONFIG_PATH__ @@ -8,7 +8,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__CONFIG_PATH__/ -ExecStart=__FINALPATH__/__APP__ --configfile "__CONFIG_PATH__/navidrome.toml" +ExecStart=__INSTALL_DIR__/__APP__ --configfile "__CONFIG_PATH__/navidrome.toml" TimeoutStopSec=20 KillMode=process Restart=on-failure diff --git a/config_panel.toml b/config_panel.toml index 19e0c77..d57a1af 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,7 +13,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Controls whether the player in the UI will animate the album cover" - bind = "EnableCoverAnimation:/var/lib/navidrome/navidrome.toml" + bind = "EnableCoverAnimation:/var/lib/__APP__/navidrome.toml" [main.config.enable_downloads] ask = "Allow music download" @@ -21,7 +21,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Enable the option in the UI to download music/albums/artists/playlists from the server" - bind = "EnableDownloads:/var/lib/navidrome/navidrome.toml" + bind = "EnableDownloads:/var/lib/__APP__/navidrome.toml" [main.config.enable_sharing] ask = "Enable Sharing feature" @@ -29,7 +29,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Enable the Sharing feature" - bind = "EnableSharing:/var/lib/navidrome/navidrome.toml" + bind = "EnableSharing:/var/lib/__APP__/navidrome.toml" [main.config.scanner_extractor] ask = "Select metadata extractor" @@ -37,7 +37,7 @@ services = ["__APP__"] choices = ["taglib", "ffmpeg"] default = "taglib" help = "Select metadata extractor implementation" - bind = "Scanner.Extractor:/var/lib/navidrome/navidrome.toml" + bind = "Scanner.Extractor:/var/lib/__APP__/navidrome.toml" [main.config.enable_transcoding] ask = "Enable transcoding" @@ -45,10 +45,10 @@ services = ["__APP__"] yes = "true" no = "false" help = "Enables transcoding configuration in the UI" - bind = "EnableTranscodingConfig:/var/lib/navidrome/navidrome.toml" + bind = "EnableTranscodingConfig:/var/lib/__APP__/navidrome.toml" [main.config.welcome_message] ask = "Welcome message" type = "string" help = "Add a welcome message to the login screen" - bind = "UIWelcomeMessage:/var/lib/navidrome/navidrome.toml" + bind = "UIWelcomeMessage:/var/lib/__APP__/navidrome.toml" diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 20c2034..db0c734 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -10,6 +10,5 @@ Navidrome indexes all digital music stored in your hard drive and makes it avail - Multi-user, each user has their own play counts, playlists, favourites, etc... - Very low resource usage - Automatically monitors your library for changes, importing new files and reloading new metadata -- Themeable, modern and responsive Web interface based on Material UI - Compatible with all Subsonic/Madsonic/Airsonic clients - Transcoding on the fly. Can be set per user/player. Opus encoding is supported diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index 4608ae2..0ae9a69 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -10,6 +10,5 @@ Navidrome indexe toute la musique numérique stockée sur votre disque dur et la - Multi-User, chaque utilisateur a ses propres listes de lecture, favoris etc. - Utilisation très faible des ressources - Surveille automatiquement votre bibliothèque pour des modifications, importation de nouveaux fichiers et recharger de nouvelles métadonnées -- Interface Web thématique, moderne et réactive basée sur l'interface utilisateur du matériel - Compatible avec tous les clients subsonique/madsononique/aironique - Encodage à la volée. Peut être défini par utilisateur/lecteur. Le codage opus est pris en charge \ No newline at end of file diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 681bf08..0000000 --- a/manifest.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "Navidrome", - "id": "navidrome", - "packaging_format": 1, - "description": { - "en": "Modern Music Server and Streamer compatible with Subsonic/Airsonic", - "fr": "Serveur de musique moderne et Streamer compatibles avec Subsonic/Airsonic" - }, - "version": "0.49.3~ynh1", - "url": "https://www.navidrome.org", - "upstream": { - "license": "GPL-3.0-only", - "website": "https://www.navidrome.org", - "demo": "https://demo.navidrome.org/app/#/login", - "admindoc": "https://www.navidrome.org/docs", - "code": "https://github.com/deluan/navidrome", - "cpe": "cpe:2.3:a:navidrome:navidrome" - }, - "license": "GPL-3.0-only", - "maintainer": { - "name": "eric_G" - }, - "requirements": { - "yunohost": ">= 11.1.6" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/navidrome", - "default": "/navidrome" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "You must activate public site if you want to connect a client player to Navidrome. This can be changed later via the webadmin.", - "fr": "Vous devez activer site public si vous souhaitez connecter un lecteur client à Navidrome. Vous pourrez changer ceci plus tard via la webadmin." - }, - "default": true - }, - { - "name": "language", - "type": "string", - "ask": { - "en": "Choose the application language", - "fr": "Choisissez la langue de l'application" - }, - "choices": ["de", "en", "es", "fr", "it", "nl", "pt"], - "default": "fr" - } - ] - } -} \ No newline at end of file diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..9602673 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,61 @@ +packaging_format = 2 + +id = "navidrome" +name = "Navidrome" +description.en = "Modern Music Server and Streamer compatible with Subsonic/Airsonic" +description.fr = "Serveur de musique moderne et Streamer compatibles avec Subsonic/Airsonic" + +version = "0.49.3~ynh2" + +maintainers = ["eric_G"] + +[upstream] +license = "GPL-3.0-only" +website = "https://www.navidrome.org" +demo = "https://demo.navidrome.org/app/#/login" +admindoc = "https://www.navidrome.org/docs" +code = "https://github.com/deluan/navidrome" + +[integration] +yunohost = ">= 11.1.7" +architectures = ["amd64", "arm64", "armhf"] +multi_instance = false +ldap = false +sso = true +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" + +[install] + [install.domain] + type = "domain" + + [install.path] + type = "path" + default = "/navidrome" + + [install.init_main_permission] + help.en = "You must activate 'Visitors' if you want to connect a client player to Navidrome. This can be changed later via the webadmin." + help.fr = "Vous devez activer 'V'isiteurs' si vous souhaitez connecter un lecteur client à Navidrome. Vous pourrez changer ceci plus tard via la webadmin." + type = "group" + default = "visitors" + + [install.language] + ask.en = "Choose the application language" + ask.fr = "Choisissez la langue de l'application" + type = "string" + choices = ["de", "en", "es", "fr", "it", "nl", "pt"] + default = "fr" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.ports] + + [resources.permissions] + main.url = "/" + + [resources.apt] + packages = "ffmpeg" diff --git a/scripts/_common.sh b/scripts/_common.sh index 39722ca..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="ffmpeg" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 5c650a0..39ebf6c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,23 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# 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) -domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -36,7 +19,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index 68ca82d..c0e4dca 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -26,11 +26,6 @@ app=$YNH_APP_INSTANCE_NAME #================================================= 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) -port=$(ynh_app_setting_get --app=$app --key=port) -language=$(ynh_app_setting_get --app=$app --key=language) - enable_downloads=$(ynh_app_setting_get --app=$app --key=enable_downloads) scanner_extractor=$(ynh_app_setting_get --app=$app --key=scanner_extractor) enable_animation=$(ynh_app_setting_get --app=$app --key=enable_animation) diff --git a/scripts/install b/scripts/install index 791895a..5f2ce01 100644 --- a/scripts/install +++ b/scripts/install @@ -9,27 +9,10 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -is_public=$YNH_APP_ARG_IS_PUBLIC -language=$YNH_APP_ARG_LANGUAGE - -app=$YNH_APP_INSTANCE_NAME - scanner_extractor="taglib" enable_downloads="true" enable_animation="true" @@ -37,25 +20,11 @@ enable_transcoding="false" welcome_message="" enable_sharing="false" -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= ynh_script_progression --message="Storing installation settings..." --weight=2 -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=enable_downloads --value=$enable_downloads ynh_app_setting_set --app=$app --key=scanner_extractor --value=$scanner_extractor ynh_app_setting_set --app=$app --key=enable_animation --value=$enable_animation @@ -63,44 +32,17 @@ ynh_app_setting_set --app=$app --key=enable_transcoding --value=$enable_transcod ynh_app_setting_set --app=$app --key=welcome_message --value=$welcome_message ynh_app_setting_set --app=$app --key=enable_sharing --value=$enable_sharing -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=0 - -# Find an available port -port=$(ynh_find_port --port=4533) -ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=9 - -ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# 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=4 -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" --source_id=$YNH_ARCH +ynh_setup_source --dest_dir="$install_dir" --source_id=$YNH_ARCH -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # NGINX CONFIGURATION @@ -160,26 +102,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=2 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 1a8cd1c..cbce88c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,17 +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 - -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 #================================================= @@ -41,14 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=6 - -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -57,14 +38,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # SPECIFIC REMOVE #================================================= @@ -75,16 +48,6 @@ ynh_script_progression --message="Removing various files..." --weight=6 # Remove the config directory securely ynh_secure_remove --file="/var/lib/$app" -#================================================= -# 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 706452d..4e4aab3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,65 +10,16 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -ynh_clean_setup () { - ynh_clean_check_starting -} -# 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 - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=2 - -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=4 -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:$app "$final_path" - -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=7 - -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # RESTORE THE NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 6957fce..807eee8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,47 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -language=$(ynh_app_setting_get --app=$app --key=language) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) - -enable_downloads=$(ynh_app_setting_get --app=$app --key=enable_downloads) -scanner_extractor=$(ynh_app_setting_get --app=$app --key=scanner_extractor) -enable_animation=$(ynh_app_setting_get --app=$app --key=enable_animation) -enable_transcoding=$(ynh_app_setting_get --app=$app --key=enable_transcoding) -welcome_message=$(ynh_app_setting_get --app=$app --key=welcome_message) -enable_sharing=$(ynh_app_setting_get --app=$app --key=enable_sharing) - #================================================= # 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=4 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -64,56 +29,41 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -if [ -z "$language" ]; then +if [ -z "${language:-}" ]; then language="en" ynh_app_setting_set --app=$app --key=language --value=$language fi -if [ -z "$enable_animation" ]; then +if [ -z "${enable_animation:-}" ]; then enable_animation="true" ynh_app_setting_set --app=$app --key=enable_animation --value=$enable_animation fi -if [ -z "$enable_downloads" ]; then +if [ -z "${enable_downloads:-}" ]; then enable_downloads="true" ynh_app_setting_set --app=$app --key=enable_downloads --value=$enable_downloads fi -if [ -z "$scanner_extractor" ]; then +if [ -z "${scanner_extractor:-}" ]; then scanner_extractor="taglib" ynh_app_setting_set --app=$app --key=scanner_extractor --value=$scanner_extractor fi -if [ -z "$enable_transcoding" ]; then +if [ -z "${enable_transcoding:-}" ]; then enable_transcoding="false" ynh_app_setting_set --app=$app --key=enable_transcoding --value=$enable_transcoding fi -if [ -z "$welcome_message" ]; then +if [ -z "${welcome_message:-}" ]; then welcome_message="" ynh_app_setting_set --app=$app --key=welcome_message --value=$welcome_message fi -if [ -z "$enable_sharing" ]; then +if [ -z "${enable_sharing:-}" ]; then enable_sharing="false" ynh_app_setting_set --app=$app --key=enable_sharing --value=$enable_sharing fi -#================================================= -# 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 #================================================= @@ -123,22 +73,15 @@ then ynh_script_progression --message="Upgrading source files..." --weight=5 # Remove the app directory securely - ynh_secure_remove --file=$final_path + ynh_secure_remove --file=$install_dir # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --source_id=$YNH_ARCH + ynh_setup_source --dest_dir="$install_dir" --source_id=$YNH_ARCH fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" - -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=8 - -ynh_install_app_dependencies $pkg_dependencies +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # NGINX CONFIGURATION @@ -185,13 +128,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:" -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..5a08f03 --- /dev/null +++ b/tests.toml @@ -0,0 +1,15 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ + + exclude ="install.multi" + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.d7eb59fd.name = "Upgrade from 0.47.0~ynh1"