diff --git a/README.md b/README.md index 5d8e226..f6f4b45 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,40 @@ + + # CouchPotato for YunoHost [![Integration level](https://dash.yunohost.org/integration/couchpotato.svg)](https://dash.yunohost.org/appci/app/couchpotato) ![](https://ci-apps.yunohost.org/ci/badges/couchpotato.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/couchpotato.maintain.svg) -[![Install CouchPotato with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=couchpotato) +[![Install CouchPotato with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=couchpotato) -> *This package allows you to install CouchPotato quickly and simply on a YunoHost server. +*[Lire ce readme en français.](./README_fr.md)* + +> *This package allows you to install CouchPotato 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.* ## Overview -Download movies automatically, easily and in the best quality as soon as they are available. -- Integrates automatically with [transmission_ynh](https://github.com/YunoHost-Apps/transmission_ynh) (or tries to...), -- Integrates [YunoHost multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) folder structure +Automatic movie downloader -**Shipped version:** 3.0.1 +**Shipped version:** 3.0.1~ynh3 -## YunoHost specific features -#### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/couchpotato%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/couchpotato/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/couchpotato%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/couchpotato/) +## Disclaimers / important information -## Links +* Other infos that people should be aware of, such as: + * Integrates automatically with [transmission_ynh](https://github.com/YunoHost-Apps/transmission_ynh) (or tries to...), + * Integrates [YunoHost multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) folder structure - * Report a bug: https://github.com/YunoHost-Apps/couchpotato_ynh/issues - * App website: https://couchpota.to - * Upstream app repository: https://github.com/CouchPotato/CouchPotatoServer - * YunoHost website: https://yunohost.org/ +## Documentation and resources -#### Special Thanks to the Yunohost Community: -[Snipees](https://github.com/Snipees) -[anaqreon](https://github.com/anaqreon), -[aymhce](https://github.com/aymhce), -[beudbeud](https://github.com/abeudin), -[Chao-Man](https://github.com/Chao-Man), -[chtixof](https://github.com/chtixof), -[CotzaDev](https://github.com/CotzaDev), -[courgette](https://github.com/courgette), -[Jérôme](https://github.com/jeromelebleu), -[JocelynD](https://github.com/JocelynDelalande), -[Ju](https://github.com/julienmalik), -[Le Kload](https://github.com/Kloadut), -[lunarok](https://github.com/lunarok), -[maniackcrudelis](https://github.com/maniackcrudelis), -[Matlink](https://github.com/matlink), -[Moul](https://github.com/M5oul), -[polytan02](https://github.com/polytan02), -[scith](https://github.com/scith), -[tifred](https://github.com/drfred1981), -... :dizzy: +* Official app website: https://couchpota.to +* Upstream app code repository: https://github.com/CouchPotato/CouchPotatoServer +* YunoHost documentation for this app: https://yunohost.org/app_couchpotato +* Report a bug: https://github.com/YunoHost-Apps/couchpotato_ynh/issues ---- - -Developer info ----------------- +## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing). @@ -63,3 +44,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/couchpotato_ynh/tree/ or sudo yunohost app upgrade couchpotato -u https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..c7ddab4 --- /dev/null +++ b/README_fr.md @@ -0,0 +1,44 @@ +# CouchPotato pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/couchpotato.svg)](https://dash.yunohost.org/appci/app/couchpotato) ![](https://ci-apps.yunohost.org/ci/badges/couchpotato.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/couchpotato.maintain.svg) +[![Installer CouchPotato avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=couchpotato) + +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* + +> *Ce package vous permet d'installer CouchPotato 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 + +Téléchargement automatisé de film + +**Version incluse :** 3.0.1~ynh3 + + + +## Avertissements / informations importantes + +* Other infos that people should be aware of, such as: + * Integrates automatically with [transmission_ynh](https://github.com/YunoHost-Apps/transmission_ynh) (or tries to...), + * Integrates [YunoHost multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) folder structure + +## Documentations et ressources + +* Site officiel de l'app : https://couchpota.to +* Dépôt de code officiel de l'app : https://github.com/CouchPotato/CouchPotatoServer +* Documentation YunoHost pour cette app : https://yunohost.org/app_couchpotato +* Signaler un bug : https://github.com/YunoHost-Apps/couchpotato_ynh/issues + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing --debug +ou +sudo yunohost app upgrade couchpotato -u https://github.com/YunoHost-Apps/couchpotato_ynh/tree/testing --debug +``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/check_process b/check_process index e04a105..672f9cd 100644 --- a/check_process +++ b/check_process @@ -10,20 +10,19 @@ setup_private=0 setup_public=0 upgrade=1 + # From GIT upgrade=1 from_commit=2a7461345d70ae231cc81a580189934626ed8c58 + # 3.0.1~ynh2 + upgrade=1 from_commit=06e0d129fef72c1c43063f81ae2bef97576f7fa7 backup_restore=1 multi_instance=0 - # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. - # incorrect_path=1 port_already_use=1 (5050) change_url=0 -;;; Levels - # If the level 5 (Package linter) is forced to 1. Please add justifications here. - Level 5=auto ;;; Options Email= Notification=none ;;; Upgrade options ; commit=2a7461345d70ae231cc81a580189934626ed8c58 name=From GIT - + ; commit=06e0d129fef72c1c43063f81ae2bef97576f7fa7 + name=3.0.1~ynh2 diff --git a/conf/couchpotato.conf b/conf/couchpotato.conf index a61f33e..1947858 100644 --- a/conf/couchpotato.conf +++ b/conf/couchpotato.conf @@ -4,7 +4,7 @@ username = ssl_key = proxy_server = ssl_cert = -data_dir = __APP_DATA_DIR__ +data_dir = __DATADIR__ use_proxy = 0 permission_file = 0755 proxy_password = diff --git a/conf/systemd.service b/conf/systemd.service index f33eefd..dfa9826 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=/opt/pyenv/versions/__PYTHON_VERSION__/bin/python __FINALPATH__/CouchPotato.py --quiet --pid_file=/var/run/__APP__/__APP__.pid --data_dir=__APP_DATA_DIR__ --config_file=__FINALPATH__/settings.conf +ExecStart=/opt/pyenv/versions/__PYTHON_VERSION__/bin/python __FINALPATH__/CouchPotato.py --quiet --pid_file=/var/run/__APP__/__APP__.pid --data_dir=__DATADIR__ --config_file=__DATADIR__/settings.conf [Install] diff --git a/doc/.gitkeep b/doc/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..ad18dd4 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,3 @@ +* Other infos that people should be aware of, such as: + * Integrates automatically with [transmission_ynh](https://github.com/YunoHost-Apps/transmission_ynh) (or tries to...), + * Integrates [YunoHost multimedia](https://github.com/YunoHost-Apps/yunohost.multimedia) folder structure diff --git a/doc/screenshots/.gitkeep b/doc/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/manifest.json b/manifest.json index 88a408d..39c88c6 100644 --- a/manifest.json +++ b/manifest.json @@ -6,8 +6,13 @@ "en": "Automatic movie downloader", "fr": "Téléchargement automatisé de film" }, - "version": "3.0.1~ynh2", + "version": "3.0.1~ynh3", "url": "https://couchpota.to/", + "upstream": { + "license": "GPL-3.0-only", + "website": "https://couchpota.to", + "code": "https://github.com/CouchPotato/CouchPotatoServer" + }, "license": "GPL-3.0-only", "maintainer": { "name": "Snipees", diff --git a/scripts/backup b/scripts/backup index e495c37..67278fd 100644 --- a/scripts/backup +++ b/scripts/backup @@ -29,7 +29,7 @@ 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) -app_data_dir=$(ynh_app_setting_get --app=$app --key=app_data_dir) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -42,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -62,13 +68,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -# Backup data -ynh_backup --src_path="$app_data_dir" --is_big - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 7e5621a..240217c 100644 --- a/scripts/install +++ b/scripts/install @@ -37,8 +37,6 @@ ynh_script_progression --message="Validating installation parameters..." final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -app_data_dir=/home/yunohost.app/$app - # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -49,7 +47,6 @@ ynh_script_progression --message="Storing installation settings..." 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=app_data_dir --value=$app_data_dir #================================================= # STANDARD MODIFICATIONS @@ -109,15 +106,18 @@ ynh_add_nginx_config #================================================= # SPECIFIC SETUP #================================================= -# MAKE DATA DIRECTORY +# CREATE DATA DIRECTORY #================================================= -ynh_script_progression --message="Make data directory..." +ynh_script_progression --message="Creating a data directory..." -# Make directories -mkdir -p "$app_data_dir" -chmod 750 "$app_data_dir" -chmod -R o-rwx "$app_data_dir" -chown -R $app:$app "$app_data_dir" +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:$app "$datadir" #================================================= # BUILD COUCHPOTATO @@ -204,10 +204,10 @@ fi #================================================= ynh_script_progression --message="Adding a configuration file..." -ynh_add_config --template="../conf/couchpotato.conf" --destination="$final_path/settings.conf" +ynh_add_config --template="../conf/couchpotato.conf" --destination="$datadir/settings.conf" -chmod 600 "$final_path/settings.conf" -chown $app:$app "$final_path/settings.conf" +chmod 600 "$datadir/settings.conf" +chown $app:$app "$datadir/settings.conf" #================================================= # SETUP SYSTEMD diff --git a/scripts/remove b/scripts/remove index 6232ebf..985b798 100644 --- a/scripts/remove +++ b/scripts/remove @@ -20,7 +20,6 @@ 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) -app_data_dir=$(ynh_app_setting_get --app=$app --key=app_data_dir) #================================================= # STANDARD REMOVE @@ -28,10 +27,10 @@ app_data_dir=$(ynh_app_setting_get --app=$app --key=app_data_dir) # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +# 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_script_progression --message="Removing $app service..." + ynh_script_progression --message="Removing $app service integration..." yunohost service remove $app fi @@ -43,6 +42,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # REMOVE DEPENDENCIES #================================================= @@ -68,14 +75,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # CLOSE A PORT #================================================= diff --git a/scripts/restore b/scripts/restore index d2af860..0f75807 100644 --- a/scripts/restore +++ b/scripts/restore @@ -31,7 +31,7 @@ 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) -app_data_dir=$(ynh_app_setting_get --app=$app --key=app_data_dir) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -48,7 +48,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." +ynh_script_progression --message="Restoring the NGINX web server configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -71,6 +71,19 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." + +ynh_restore_file --origin_path="$datadir" --not_mandatory + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:$app "$datadir" + #================================================= # SPECIFIC RESTORATION #================================================= @@ -94,18 +107,6 @@ pushd $final_path /opt/pyenv/versions/$app/bin/pip install cheetah popd -#================================================= -# RESTORE THE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Restoring the data directory..." - -ynh_restore_file --origin_path="$app_data_dir" --not_mandatory - -mkdir -p "$app_data_dir" -chmod 750 "$app_data_dir" -chmod -R o-rwx "$app_data_dir" -chown -R $app:$app "$app_data_dir" - #================================================= # INSTALL YUNOHOST MULTIMEDIA #================================================= @@ -139,6 +140,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -153,13 +161,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 68840d8..cd1edd5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -app_data_dir=$(ynh_app_setting_get --app=$app --key=app_data_dir) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK VERSION @@ -64,10 +64,21 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -# If app_data_dir doesn't exist, create it -if [ -z "$app_data_dir" ]; then - app_data_dir=/home/yunohost.app/$app - ynh_app_setting_set --app=$app --key=app_data_dir --value=$app_data_dir +# If datadir doesn't exist, create it +if [ -z "$datadir" ]; then + datadir=/home/yunohost.app/$app + ynh_app_setting_set --app=$app --key=datadir --value=$datadir + ynh_app_setting_delete --app=$app --key=app_data_dir +fi + +# If settings.conf is not at the right place, move it +if [ ! -f "$datadir/settings.conf" ]; then + ynh_delete_file_checksum --file="$final_path/settings.conf" + mv "$final_path/settings.conf" "$datadir/settings.conf" + ynh_store_file_checksum --file="$datadir/settings.conf" + + chmod 600 "$datadir/settings.conf" + chown $app:$app "$datadir/settings.conf" fi # Cleaning legacy permissions @@ -210,10 +221,10 @@ fi #================================================= ynh_script_progression --message="Updating a configuration file..." -ynh_add_config --template="../conf/couchpotato.conf" --destination="$final_path/settings.conf" +ynh_backup_if_checksum_is_different --file="$datadir/settings.conf" -chmod 600 "$final_path/settings.conf" -chown $app:$app "$final_path/settings.conf" +chmod 600 "$datadir/settings.conf" +chown $app:$app "$datadir/settings.conf" #================================================= # CONFIGURE LOGS @@ -222,6 +233,9 @@ ynh_script_progression --message="Configuring logs..." # Redirect logs directory app_logs_dir="/var/log/$app" +mkdir -p $app_logs_dir +chown -R $app:$app $app_logs_dir +chmod +x -R $app_logs_dir ynh_replace_string --match_string="self.log_dir =.*" --replace_string="self.log_dir = '$app_logs_dir'" --target_file="$final_path/CouchPotato.py" #================================================= diff --git a/scripts/ynh_install_python b/scripts/ynh_install_python index 2e14390..5214393 100644 --- a/scripts/ynh_install_python +++ b/scripts/ynh_install_python @@ -14,7 +14,7 @@ python_version_path="$pyenv_install_dir/versions" export PYENV_ROOT="$pyenv_install_dir" # Required dependencies -pyenv_dependencies="build-essential libssl1.0-dev|libssl-dev zlib1g-dev libbz2-dev libreadline-dev|libedit-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git" +pyenv_dependencies="build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev|libedit-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git" # Load the version of Python for an app, and set variables. # @@ -188,7 +188,7 @@ ynh_install_python () { # Install the requested version of Python local final_python_version=$(pyenv latest --print $python_version) ynh_print_info --message="Installation of Python-$python_version" - pyenv install --skip-existing $final_python_version > /dev/null 2>&1 + ynh_exec_warn_less pyenv install --skip-existing $final_python_version > /dev/null 2>&1 # Store python_version into the config of this app ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=python_version --value=$python_version