diff --git a/README.md b/README.md index f12037d..7b60022 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ It shall NOT be edited by hand. # Kavita for YunoHost -[![Integration level](https://dash.yunohost.org/integration/kavita.svg)](https://dash.yunohost.org/appci/app/kavita) ![Working status](https://ci-apps.yunohost.org/ci/badges/kavita.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/kavita.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/kavita.svg)](https://dash.yunohost.org/appci/app/kavita) ![Working status](https://ci-apps.yunohost.org/ci/badges/kavita.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/kavita.maintain.svg) + [![Install Kavita with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=kavita) *[Lire ce readme en français.](./README_fr.md)* @@ -20,46 +21,23 @@ Kavita is a fast, feature rich, cross platform reading server. Built with a focu ### Features - Extensive File support - - Manga/Comics: ZIP, RAR, CBR, CBZ, CB7, CBT, TAR.GZ, 7ZIP/7Z - - Books: EPUB2, EPUB3, PDF - - Raw Images: JPG/JPEG, PNG, WEBP - Manga/Comic Reader - - Image Scaling to fit your device screen or override for what feels best to you - - Image Splitting for those joined page spreads, don't scroll on your tablet, just split - - Apply a custom dark or sepia tone to your images to make it easier to read at night - - Reading Direction: Left/Right, Up/Down, Webtoon - - Webtoon reader built-in - - Read across archives without closing the reader - Book Reader - - Interactive reader - can interact with text, run javascript - - Dark mode persists between page load - - Can tap to paginate or use dedicated buttons - - Customize your reading experience with custom Font, Font Size, Margin, Reading Direction, Dark Mode - - Table of Content just a click away - - Remember line position and resume where you left off, no matter the device - - Read across books without closing the reader - User Management and Sharing - Create users and share your libraries with them - Grant users permissions to view libraries or see different mixed-media collections - Built-in ratings and reviews for each of your users - Cross Platform with no dependencies - Everything in the box -- Responsive and Fast! - Full-text search to quickly find what you want to read - Mixed media Libraries - Light Novels and Manga can be right next to each other - Fast and efficient library scans. Don't perform I/O if the underlying file hasn't changed. -- Accessibility first - audits for color contrast, screen reader, and keyboard only - OPDS-PS Support -- Frequent updates with new features - -**Shipped version:** 0.6.1~ynh1 +**Shipped version:** 0.7.1~ynh1 **Demo:** https://demo.kavitareader.com/ ## Screenshots -![Screenshot of Kavita](./doc/screenshots/screenshot.gif) +![Screenshot of Kavita](./doc/screenshots/screenshot.png) ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index 1047b11..493b49c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,67 +5,45 @@ It shall NOT be edited by hand. # Kavita pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/kavita.svg)](https://dash.yunohost.org/appci/app/kavita) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/kavita.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/kavita.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/kavita.svg)](https://dash.yunohost.org/appci/app/kavita) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/kavita.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/kavita.maintain.svg) + [![Installer Kavita avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=kavita) *[Read this readme in english.](./README.md)* -> *Ce package vous permet d'installer Kavita rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* +> *Ce package vous permet d’installer Kavita rapidement et simplement sur un serveur YunoHost. +Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.* -## Vue d'ensemble +## Vue d’ensemble Kavita is a fast, feature rich, cross platform reading server. Built with a focus for manga and the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family. ### Features - Extensive File support - - Manga/Comics: ZIP, RAR, CBR, CBZ, CB7, CBT, TAR.GZ, 7ZIP/7Z - - Books: EPUB2, EPUB3, PDF - - Raw Images: JPG/JPEG, PNG, WEBP - Manga/Comic Reader - - Image Scaling to fit your device screen or override for what feels best to you - - Image Splitting for those joined page spreads, don't scroll on your tablet, just split - - Apply a custom dark or sepia tone to your images to make it easier to read at night - - Reading Direction: Left/Right, Up/Down, Webtoon - - Webtoon reader built-in - - Read across archives without closing the reader - Book Reader - - Interactive reader - can interact with text, run javascript - - Dark mode persists between page load - - Can tap to paginate or use dedicated buttons - - Customize your reading experience with custom Font, Font Size, Margin, Reading Direction, Dark Mode - - Table of Content just a click away - - Remember line position and resume where you left off, no matter the device - - Read across books without closing the reader - User Management and Sharing - Create users and share your libraries with them - Grant users permissions to view libraries or see different mixed-media collections - Built-in ratings and reviews for each of your users - Cross Platform with no dependencies - Everything in the box -- Responsive and Fast! - Full-text search to quickly find what you want to read - Mixed media Libraries - Light Novels and Manga can be right next to each other - Fast and efficient library scans. Don't perform I/O if the underlying file hasn't changed. -- Accessibility first - audits for color contrast, screen reader, and keyboard only - OPDS-PS Support -- Frequent updates with new features - -**Version incluse :** 0.6.1~ynh1 +**Version incluse :** 0.7.1~ynh1 **Démo :** https://demo.kavitareader.com/ -## Captures d'écran +## Captures d’écran -![Capture d'écran de Kavita](./doc/screenshots/screenshot.gif) +![Capture d’écran de Kavita](./doc/screenshots/screenshot.png) ## Documentations et ressources -* Site officiel de l'app : -* Documentation officielle de l'admin : -* Dépôt de code officiel de l'app : +* Site officiel de l’app : +* Documentation officielle de l’admin : +* Dépôt de code officiel de l’app : * Documentation YunoHost pour cette app : * Signaler un bug : @@ -81,4 +59,4 @@ ou sudo yunohost app upgrade kavita -u https://github.com/YunoHost-Apps/kavita_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file diff --git a/check_process b/check_process deleted file mode 100644 index ad5191d..0000000 --- a/check_process +++ /dev/null @@ -1,24 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - #upgrade=1 from_commit=CommitHash - backup_restore=1 - multi_instance=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666& diff --git a/conf/amd64.src b/conf/amd64.src index ea05590..55d8941 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Kareadita/Kavita/releases/download/v0.6.1/kavita-linux-x64.tar.gz -SOURCE_SUM=37bb9b70b881e129d81c26bee9e38f0aa84de53f8bc381eda4aeed6af7695b38 +SOURCE_URL=https://github.com/Kareadita/Kavita/releases/download/v0.7.1/kavita-linux-x64.tar.gz +SOURCE_SUM=B67B91E97F490D0629AAD00E2B2E78752C57A2E7BDD00D3E1B1461EFEF5F22BA SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/arm64.src b/conf/arm64.src index 4504217..8dec346 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Kareadita/Kavita/releases/download/v0.6.1/kavita-linux-arm64.tar.gz -SOURCE_SUM=44ad4575b2d356aa95d7367838b73b9c36779ae613ffcb733804da1898e2a594 +SOURCE_URL=https://github.com/Kareadita/Kavita/releases/download/v0.7.1/kavita-linux-arm64.tar.gz +SOURCE_SUM=DEA4160C72B024BEB47565526DBD71512E8EEB65360D22E76A7E695C0A4C55B7 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/armhf.src b/conf/armhf.src index 10a098e..a76a26f 100644 --- a/conf/armhf.src +++ b/conf/armhf.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Kareadita/Kavita/releases/download/v0.6.1/kavita-linux-arm.tar.gz -SOURCE_SUM=75d1ab3be24a066b00f3d3d1bd94ce7284c3fdbe9b274a40d8e6229b68d8bf91 +SOURCE_URL=https://github.com/Kareadita/Kavita/releases/download/v0.7.1/kavita-linux-arm.tar.gz +SOURCE_SUM=AD5CEC73D6B5B48386EAC5291CD9C4B40F0AF4FBB712E730518D3605E80F1D52 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/systemd.service b/conf/systemd.service index b1a428d..618b594 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,8 +6,8 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/Kavita +WorkingDirectory=__INSTALL_DIR__/ +ExecStart=__INSTALL_DIR__/Kavita TimeoutStopSec=20 KillMode=process Restart=on-failure diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 86398dd..e4a1fd7 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -3,34 +3,11 @@ Kavita is a fast, feature rich, cross platform reading server. Built with a focu ### Features - Extensive File support - - Manga/Comics: ZIP, RAR, CBR, CBZ, CB7, CBT, TAR.GZ, 7ZIP/7Z - - Books: EPUB2, EPUB3, PDF - - Raw Images: JPG/JPEG, PNG, WEBP - Manga/Comic Reader - - Image Scaling to fit your device screen or override for what feels best to you - - Image Splitting for those joined page spreads, don't scroll on your tablet, just split - - Apply a custom dark or sepia tone to your images to make it easier to read at night - - Reading Direction: Left/Right, Up/Down, Webtoon - - Webtoon reader built-in - - Read across archives without closing the reader - Book Reader - - Interactive reader - can interact with text, run javascript - - Dark mode persists between page load - - Can tap to paginate or use dedicated buttons - - Customize your reading experience with custom Font, Font Size, Margin, Reading Direction, Dark Mode - - Table of Content just a click away - - Remember line position and resume where you left off, no matter the device - - Read across books without closing the reader - User Management and Sharing - Create users and share your libraries with them - Grant users permissions to view libraries or see different mixed-media collections - Built-in ratings and reviews for each of your users - Cross Platform with no dependencies - Everything in the box -- Responsive and Fast! - Full-text search to quickly find what you want to read - Mixed media Libraries - Light Novels and Manga can be right next to each other - Fast and efficient library scans. Don't perform I/O if the underlying file hasn't changed. -- Accessibility first - audits for color contrast, screen reader, and keyboard only - OPDS-PS Support -- Frequent updates with new features - diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index e69de29..0000000 diff --git a/doc/screenshots/screenshot.gif b/doc/screenshots/screenshot.gif deleted file mode 100644 index fe3ecec..0000000 Binary files a/doc/screenshots/screenshot.gif and /dev/null differ diff --git a/doc/screenshots/screenshot.png b/doc/screenshots/screenshot.png new file mode 100644 index 0000000..964c79d Binary files /dev/null and b/doc/screenshots/screenshot.png differ diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 5018bbf..0000000 --- a/manifest.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "Kavita", - "id": "kavita", - "packaging_format": 1, - "description": { - "en": "Media server for your comics, manga and books", - "fr": "Serveur multimédia pour vos bandes dessinées, mangas et livres" - }, - "version": "0.6.1~ynh1", - "url": "www.kavitareader.com", - "upstream": { - "license": "MIT", - "website": "www.kavitareader.com", - "demo": "https://demo.kavitareader.com/", - "admindoc": "https://wiki.kavitareader.com/en", - "code": "https://github.com/Kareadita/Kavita" - }, - "license": "MIT", - "maintainer": { - "name": "eric_G", - "email": "" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "is_public", - "type": "boolean", - "default": true - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..87449fa --- /dev/null +++ b/manifest.toml @@ -0,0 +1,62 @@ +packaging_format = 2 + +id = "kavita" +name = "Kavita" +description.en = "Media server for your comics, manga and books" +description.fr = "Serveur multimédia pour vos bandes dessinées, mangas et livres" + +version = "0.7.1~ynh1" + +maintainers = ["eric_G"] + +[upstream] +license = "MIT" +website = "www.kavitareader.com" +demo = "https://demo.kavitareader.com/" +admindoc = "https://wiki.kavitareader.com/en" +code = "https://github.com/Kareadita/Kavita" + +[integration] +yunohost = ">= 11.1.11" +architectures = ["amd64", "arm64", "armhf"] +multi_instance = false +ldap = false +sso = false +disk = "50M" +ram.build = "300M" +ram.runtime = "50M" + +[install] + [install.domain] + + type = "domain" + full_domain = true + + [install.init_main_permission] + type = "group" + default = "visitors" + +[resources] + [resources.ports] + main.default = 5000 + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + api.url = "/api" + api.show_tile = false + api.protected= true + api.allowed = ["visitors", "all_users"] + + hubs.url = "/hubs/*" + hubs.show_tile = false + hubs.protected= true + hubs.auth_header = false + hubs.allowed = ["visitors", "all_users"] + + [resources.apt] + packages = "sqlite3" diff --git a/scripts/_common.sh b/scripts/_common.sh index 890766f..1e47ce7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,8 +6,6 @@ # PHP APP SPECIFIC #================================================= -pkg_dependencies="sqlite3" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index fb3c925..f8e82aa 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,27 +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) -domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= @@ -40,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 b286df6..ab2d658 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -6,115 +6,14 @@ # 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 - -#================================================= -# 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 +ynh_change_url_nginx_config #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index c5a4cb8..e9546b7 100755 --- a/scripts/install +++ b/scripts/install @@ -9,107 +9,30 @@ 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 -#================================================= - -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -is_public=$YNH_APP_ARG_IS_PUBLIC - -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=/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=1 - -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url - -#================================================= -# 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=5000) -ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 - -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=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" --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:www-data "$final_path" -chmod +x $final_path/Kavita +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" +chmod +x $install_dir/Kavita #================================================= -# NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - # 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="Cross platform reading server" --log="/var/log/$app/$app.log" #================================================= @@ -120,31 +43,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# 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 - -# Everyone can access the API part -# We don't want to display the tile in the SSO so we put --show_tile="false" -# And we don't want the YunoHost admin to be able to remove visitors group to this permission, so we put --protected="true" -ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" - -#================================================= -# 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/scripts/remove b/scripts/remove index 4828414..e34efa1 100755 --- 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 #================================================= @@ -34,47 +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="$final_path" - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # 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 - -#================================================= -# 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 d8efdf2..1a90af4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,101 +10,36 @@ 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 - -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=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 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" #================================================= -# REINSTALL DEPENDENCIES +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 - 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="Cross platform reading server" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX AND PHP-FPM -#================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a4ed7e4..9ee4448 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,38 +9,12 @@ 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) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) - #================================================= # 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 - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -50,14 +24,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 #================================================= @@ -67,52 +33,28 @@ 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" --source_id=$YNH_ARCH --keep="config" + ynh_setup_source --dest_dir="$install_dir" --source_id=$YNH_ARCH --keep="config" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" -chmod +x $final_path/Kavita +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" +chmod +x $install_dir/Kavita #================================================= -# UPGRADE DEPENDENCIES +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=1 - -ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 - # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Cross platform reading server" --log="/var/log/$app/$app.log" #================================================= @@ -122,13 +64,6 @@ 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 #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..fc80bad --- /dev/null +++ b/tests.toml @@ -0,0 +1,12 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Default args to use for install + # ------------------------------- + + + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- \ No newline at end of file