From 66db4a5935aa3c2f2948668f10e08aeb3ee97f82 Mon Sep 17 00:00:00 2001 From: Krakinou Date: Sat, 15 Dec 2018 19:48:33 +0100 Subject: [PATCH] Remove script Comment on the install Update README.md add update to manifest --- README.md | 70 +++++++++-------------------------- conf/init_calibre_db_settings | 3 +- manifest.json | 48 ++++++++++++++---------- scripts/install | 33 +++++++++++++---- scripts/remove | 11 ++---- 5 files changed, 78 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index 7284543..5c4b3db 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,35 @@ -# Usage of this package (REMOVE THIS SECTION BEFORE RELEASE) -- Copy this app before working on it. -- Edit `conf/nginx.conf` file to match application prerequisites. -- Edit `manifest.json` with application specific information. -- Edit the `install`, `upgrade`, `remove`, `backup`, and `restore` scripts. -- Add a `LICENSE` file for the package. -- Edit `README.md`. # Example app for YunoHost -[![Integration level](https://dash.yunohost.org/integration/REPLACEBYYOURAPP.svg)](https://ci-apps.yunohost.org/jenkins/job/REPLACEBYYOURAPP%20%28Community%29/lastBuild/consoleFull) -[![Install REPLACEBYYOURAPP with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=REPLACEBYYOURAPP) +[![Integration level](https://dash.yunohost.org/integration/calibreweb.svg)](https://ci-apps.yunohost.org/jenkins/job/calibreweb%20%28Community%29/lastBuild/consoleFull) +[![Install calibreweb with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=calibreweb) -> *This package allow you to install REPLACEBYYOURAPP quickly and simply on a YunoHost server. +> *This package allow you to install calibreweb quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* ## Overview -Quick description of this app. +This is an implementation of [Calibre-web](https://github.com/janeczku/calibre-web) for Yunohost. -**Shipped version:** 1.0 +Calibre-Web is a web app providing a clean interface for browsing, reading and downloading eBooks using an existing [Calibre](https://calibre-ebook.com) database. + +*This software is a fork of [library](https://github.com/mutschler/calibreserver) and licensed under the GPL v3 License.* + +**Shipped version:** To be 1.0 ## Screenshots -![](Link to an screenshot for this app) - -## Demo - -* [Official demo](Link to a demo site for this app) - -## Configuration - -How to configure this app: by an admin panel, a plain file with SSH, or any other way. - -## 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-users support - -Are LDAP and HTTP auth supported? -Can the app be used by multiple users? - -#### Supported architectures - -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/jenkins/job/REPLACEBYYOURAPP%20(Community)/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/REPLACEBYYOURAPP%20(Community)/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/jenkins/job/REPLACEBYYOURAPP%20(Community)%20(%7EARM%7E)/badge/icon)](https://ci-apps-arm.yunohost.org/jenkins/job/REPLACEBYYOURAPP%20(Community)%20(%7EARM%7E)/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/jenkins/job/REPLACEBYYOURAPP%20(Community)/badge/icon)](https://ci-stretch.nohost.me/jenkins/job/REPLACEBYYOURAPP%20(Community)/) +![screenshot](https://raw.githubusercontent.com/janeczku/docker-calibre-web/master/screenshot.png) ## Limitations -* Any known limitations. - -## Additional information - -* Other information you would add about this application - -**More information on the documentation page:** -https://yunohost.org/packaging_apps +* No LDAP support +* backup, restore and upgrade script not yet up to date +* access to library to be done manually after install ## Links - * Report a bug: https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/issues - * App website: Link to the official website of this app + * Report a bug: https://github.com/YunoHost-Apps/calibreweb_ynh/issues + * App website: https://github.com/janeczku/calibre-web * YunoHost website: https://yunohost.org/ --- @@ -72,11 +38,11 @@ Developers info ---------------- **Only if you want to use a testing branch for coding, instead of merging directly into master.** -Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing). +Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/calibreweb_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 +sudo yunohost app install https://github.com/YunoHost-Apps/calibreweb_ynh/tree/testing --debug or -sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/YunoHost-Apps/REPLACEBYYOURAPP_ynh/tree/testing --debug +sudo yunohost app upgrade calibreweb -u https://github.com/YunoHost-Apps/calibreweb_ynh/tree/testing --debug ``` diff --git a/conf/init_calibre_db_settings b/conf/init_calibre_db_settings index b9a0564..8dacf91 100644 --- a/conf/init_calibre_db_settings +++ b/conf/init_calibre_db_settings @@ -7,4 +7,5 @@ config_remote_login=0, config_use_goodreads=0, config_logfile=\'\', config_converterpath=\'\', -config_calibre=\'\' \ No newline at end of file +config_calibre=\'\', +config_uploading=\'$upload\' \ No newline at end of file diff --git a/manifest.json b/manifest.json index c0af5fd..5a4bfb2 100644 --- a/manifest.json +++ b/manifest.json @@ -62,25 +62,7 @@ }, "example": "johndoe" }, - { - "name": "language", - "type":"language", - "ask": { - "en": "Select a default language (you may change it later in the app", - "fr": "Choisissez une langue par défaut (vous pourrez la changer ultérieurement dans l'application" - }, - "choices": [ "fr", "en", "es", "de"], - "default": "fr" - }, - { - "name": "is_public", - "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, - "default": false - }, + { "name": "password", "type": "password", @@ -94,6 +76,34 @@ }, "example": "Choose a password" } + { + "name": "language", + "type":"language", + "ask": { + "en": "Select a default language (you may change it later in the app)", + "fr": "Choisissez une langue par défaut (vous pourrez la changer ultérieurement dans l'application)" + }, + "choices": [ "fr", "en", "es", "de"], + "default": "fr" + }, + { + "name": "upload", + "type":"boolean", + "ask": { + "en": "Do you want to allow uploading of books (you may change it later in the app)?", + "fr": "Voulez vous autoriser l'upload de livres (vous pourrez la changer ultérieurement dans l'application)?" + }, + "default": false + }, + { + "name": "is_public", + "type": "boolean", + "ask": { + "en": "Is it a public application?", + "fr": "Est-ce une application publique ?" + }, + "default": false + }, ] } } diff --git a/scripts/install b/scripts/install index cde5f9f..805e06a 100755 --- a/scripts/install +++ b/scripts/install @@ -25,9 +25,12 @@ path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE +ynh_print_OFF pass=$YNH_APP_ARG_PASSWORD +ynh_print_ON app=$YNH_APP_INSTANCE_NAME calibre_dir=$3 +upload=$7 #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -54,6 +57,7 @@ ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url ynh_app_setting_set $app admin $admin ynh_app_setting_set $app is_public $is_public +ynh_app_setting_set $app calibre_dir $calibre_dir #================================================= # STANDARD MODIFICATIONS @@ -72,10 +76,12 @@ ynh_app_setting_set $app port $port #================================================= ynh_app_setting_set $app final_path $final_path + # Download, check integrity, uncompress and patch the source from app.src -#as long as v1 is not reached, sha256sum will change without notice so not usable. +#as long as v1 is not reached, sha256sum will change without notice so not usable, so we use cp -a instead. #source are directly in the app so far #ynh_setup_source "$final_path" + cp -a ../src/. $final_path #================================================= @@ -85,7 +91,6 @@ cp -a ../src/. $final_path ynh_install_app_dependencies $pkg_dependencies pip install --target $final_path/vendor -r $final_path/requirements.txt - #================================================= # NGINX CONFIGURATION #================================================= @@ -113,9 +118,14 @@ ynh_add_systemd_config # 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. +#Check if library folder exists. If not create it +test ! -e "$calibre_dir" +if [[ $? = 0 ]] ; then + ynh_print_info "Create calibre library folder $calibre_dir" + mkdir -p $calibre_dir + chown -R $app:$app $calibre_dir + create_dir=1 +fi # Set permissions to app files chown -R $app:$app $final_path @@ -149,8 +159,9 @@ conf="\"UPDATE user SET $(. <(echo -E echo $(<../conf/init_calibre_db_user))) WH eval sqlite3 $final_path/app.db "$conf" #mise à jour du mot de passe (je ne sais pas pourquoi, je n'arrive pas à l'intégrer dans le fichier de conf, pb de " et ') +ynh_print_OFF sqlite3 $final_path/app.db "UPDATE user SET password='$(python ../conf/generate_password_hash.py $pass $final_path/vendor)' WHERE ID=1" - +ynh_print_ON #================================================= @@ -176,4 +187,12 @@ fi #================================================= systemctl reload nginx -systemctl start $app \ No newline at end of file +systemctl start $app + +#================================================= +# WARNING FOR READ ACCESS +#================================================= + +if [[ ! $create_dir = 1 ]] ; then + ynh_print_warn "Please, give required access to $app user to the $calibre_dir folder." +fi \ No newline at end of file diff --git a/scripts/remove b/scripts/remove index 3be52ad..44a19e5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -38,7 +38,7 @@ ynh_remove_systemd_config if yunohost service status | grep -q $app then echo "Remove $app service" - yunohost service remove $app + yunohost service remove $app.service fi #================================================= @@ -46,7 +46,7 @@ fi #================================================= # Remove metapackage and its dependencies -#ynh_remove_app_dependencies +ynh_remove_app_dependencies #================================================= @@ -83,14 +83,9 @@ fi #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE THE CRON FILE -#================================================= - -# Remove a directory securely -#ynh_secure_remove "/etc/$app/" # Remove the log files -#ynh_secure_remove "/var/log/$app/" +ynh_secure_remove "/var/log/$app/" #================================================= # GENERIC FINALIZATION