From 1b377ab47246a18ba4982a24d426290f50b5e87c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 5 Oct 2023 22:33:10 +0200 Subject: [PATCH 01/51] v2 --- manifest.toml | 59 +++++++++++++++++++++++++++++++++++++ scripts/_common.sh | 2 +- scripts/backup | 14 ++++----- scripts/change_url | 72 ++++++++++++++++++++++++---------------------- scripts/install | 72 +++++++++++++++++++++++----------------------- scripts/remove | 22 +++++++------- scripts/restore | 42 +++++++++++++-------------- scripts/upgrade | 50 ++++++++++++++++---------------- 8 files changed, 197 insertions(+), 136 deletions(-) create mode 100644 manifest.toml diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..5e9203b --- /dev/null +++ b/manifest.toml @@ -0,0 +1,59 @@ +packaging_format = 2 + +id = "sonarr" +name = "Sonarr" +description.en = "A series collection manager for Usenet and BitTorrent users" +description.fr = "Gestionnaire de collection de séries pour utilisateurs de Usenet et BitTorrent" + +version = "3.0.6.1196~ynh2" + +maintainers = ["tituspijean"] + +[upstream] +license = "GPL-3.0-only" +website = "https://sonarr.tv" +admindoc = "https://wiki.servarr.com/Sonarr" +code = "https://github.com/Sonarr/Sonarr" +cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) +fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. + +[integration] +yunohost = ">= 4.2" +architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +multi_instance = true +ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. +sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "domain" + + [install.path] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "path" + default = "/sonarr" + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "user" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + [[resources.apt.extras]] + repo = "https://download.mono-project.com/repo/debian stable-buster main" + key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" + packages = "mono-devel" + + [[resources.apt.extras]] + repo = "https://apt.sonarr.tv/debian buster main" + key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" + packages = "sonarr" diff --git a/scripts/_common.sh b/scripts/_common.sh index d9b08ae..d74f1d9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="apt-transport-https dirmngr gnupg ca-certificates mediainfo mono-devel sonarr" +#REMOVEME? pkg_dependencies="apt-transport-https dirmngr gnupg ca-certificates mediainfo mono-devel sonarr" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index bfc28b4..3bcf144 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,22 +14,22 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? 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 +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -40,7 +40,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 f2e412b..81ec5ed 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,55 +13,55 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path=$YNH_APP_NEW_PATH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? 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) -api_key=$(ynh_app_setting_get --app=$app --key=api_key) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? api_key=$(ynh_app_setting_get --app=$app --key=api_key) #================================================= # 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 +#REMOVEME? 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 () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? 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" +#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -78,28 +78,30 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 -nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf +ynh_change_url_nginx_config + +#REMOVEME? 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" +#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for NGINX helper - domain="$old_domain" - path_url="$new_path" +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config +#REMOVEME? 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 +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? 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" +#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= @@ -107,12 +109,12 @@ fi #================================================= # UPDATE CONFIGURATION FILE #================================================= - +#REMOVEME? path=$new_path -ynh_exec_warn_less ynh_add_config --template="../conf/config.xml" --destination="$final_path/config.xml" +ynh_exec_warn_less ynh_add_config --template="../conf/config.xml" --destination="$install_dir/config.xml" -chown $app:$app "$final_path/config.xml" +chown $app:$app "$install_dir/config.xml" #================================================= # GENERIC FINALISATION @@ -126,9 +128,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 8939659..3812364 100755 --- a/scripts/install +++ b/scripts/install @@ -14,68 +14,68 @@ source /usr/share/yunohost/helpers #================================================= # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +#REMOVEME? path=$YNH_APP_ARG_PATH +#REMOVEME? admin=$YNH_APP_ARG_ADMIN -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/var/lib/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? install_dir=/var/lib/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 +#REMOVEME? 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 -ynh_app_setting_set --app=$app --key=admin --value=$admin +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path +#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= # STANDARD MODIFICATIONS #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 +#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 # Find an available port -port=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port --value=$port +#REMOVEME? port=$(ynh_find_port --port=8095) +#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=4 +#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=4 -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.mono-project.com/repo/debian stable-buster main" --package="mono-devel" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" +#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.mono-project.com/repo/debian stable-buster main" --package="mono-devel" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://apt.sonarr.tv/debian buster main" --package="sonarr" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" +#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://apt.sonarr.tv/debian buster main" --package="sonarr" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # NGINX CONFIGURATION @@ -106,14 +106,14 @@ ynh_script_progression --message="Configuring Radarr..." --weight=2 api_key=$(ynh_string_random --length=32) ynh_app_setting_set --app=$app --key=api_key --value=$api_key -# Create $final_path and its logs subdirectory -mkdir -p "$final_path/logs" -chmod 750 "$final_path" +# Create $install_dir and its logs subdirectory +mkdir -p "$install_dir/logs" +chmod 750 "$install_dir" -ynh_add_config --template="../conf/config.xml" --destination="$final_path/config.xml" +ynh_add_config --template="../conf/config.xml" --destination="$install_dir/config.xml" -chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chmod -R o-rwx "$install_dir" +chown -R $app:$app "$install_dir" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -133,14 +133,14 @@ ynh_multimedia_addaccess $app ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) -ynh_use_logrotate --logfile="$final_path/logs/" +ynh_use_logrotate --logfile="$install_dir/logs/" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Sonarr daemon" --log="$final_path/logs/sonarr.txt" +yunohost service add $app --description="Sonarr daemon" --log="$install_dir/logs/sonarr.txt" #================================================= # START SYSTEMD SERVICE @@ -160,18 +160,18 @@ fi #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 -ynh_permission_update --permission="main" --add="$admin" --remove="all_users" +#REMOVEME? ynh_permission_update --permission="main" --add="$admin" --remove="all_users" -ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" +#REMOVEME? 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 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 93ff07a..0c876eb 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,13 +12,13 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # STANDARD REMOVE @@ -44,18 +44,18 @@ ynh_remove_systemd_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." --weight=3 +#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=3 # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" #================================================= # REMOVE NGINX CONFIGURATION @@ -78,10 +78,10 @@ ynh_remove_logrotate #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 +#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index d67f847..6268a5a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,31 +14,31 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? 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 +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? 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) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." --weight=1 +#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " #================================================= # STANDARD RESTORATION STEPS @@ -52,17 +52,17 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 +#REMOVEME? 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" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=2 -ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="$install_dir" # FIXME: this should be managed by the core in the future # Here, as a packager, you may have to tweak the ownerhsip/permissions @@ -70,9 +70,9 @@ ynh_restore_file --origin_path="$final_path" # files in some cases. # But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - # this will be treated as a security issue. -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" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -89,14 +89,14 @@ ynh_multimedia_addaccess $app #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=4 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=4 # Define and install dependencies -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.mono-project.com/repo/debian stable-buster main" --package="mono-devel" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" +#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.mono-project.com/repo/debian stable-buster main" --package="mono-devel" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://apt.sonarr.tv/debian buster main" --package="sonarr" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" +#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://apt.sonarr.tv/debian buster main" --package="sonarr" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE SYSTEMD @@ -111,7 +111,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Sonarr daemon" --log="$final_path/logs/sonarr.txt" +yunohost service add $app --description="Sonarr daemon" --log="$install_dir/logs/sonarr.txt" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 4c3ed1c..8ee2127 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -admin=$(ynh_app_setting_get --app=$app --key=admin) -port=$(ynh_app_setting_get --app=$app --key=port) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -api_key=$(ynh_app_setting_get --app=$app --key=api_key) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? api_key=$(ynh_app_setting_get --app=$app --key=api_key) #================================================= # CHECK VERSION @@ -38,16 +38,16 @@ 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 +#REMOVEME? 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 () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS @@ -64,17 +64,17 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # Create a permission if needed -if ! ynh_permission_exists --permission="api"; then - ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" +#REMOVEME? if ! ynh_permission_exists --permission="api"; then +#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" fi #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +#REMOVEME? 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" +#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" #================================================= # NGINX CONFIGURATION @@ -87,13 +87,13 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=4 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=4 -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.mono-project.com/repo/debian stable-buster main" --package="mono-devel" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" +#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.mono-project.com/repo/debian stable-buster main" --package="mono-devel" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://apt.sonarr.tv/debian buster main" --package="sonarr" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" +#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://apt.sonarr.tv/debian buster main" --package="sonarr" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC UPGRADE @@ -113,14 +113,14 @@ ynh_add_systemd_config ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append --logfile="$final_path/logs" +ynh_use_logrotate --non-append --logfile="$install_dir/logs" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Sonarr daemon" --log="$final_path/logs/sonarr.txt" +yunohost service add $app --description="Sonarr daemon" --log="$install_dir/logs/sonarr.txt" #================================================= # START SYSTEMD SERVICE @@ -139,9 +139,9 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT From aa2688e8f765db18a61196763c333e5f9ddd53e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 5 Oct 2023 22:40:57 +0200 Subject: [PATCH 02/51] v2 --- check_process | 30 --------- conf/nginx.conf | 1 + doc/{DISCLAIMER.md => ADMIN.md} | 0 doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 0 manifest.json | 48 -------------- manifest.toml | 27 ++++---- scripts/_common.sh | 3 - scripts/backup | 21 ------- scripts/change_url | 86 ------------------------- scripts/install | 91 --------------------------- scripts/remove | 52 --------------- scripts/restore | 80 +---------------------- scripts/upgrade | 89 -------------------------- tests.toml | 7 +++ 14 files changed, 26 insertions(+), 509 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 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index d41ffe8..0000000 --- a/check_process +++ /dev/null @@ -1,30 +0,0 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - admin="john" - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - #upgrade=1 from_commit=CommitHash - backup_restore=1 - multi_instance=1 - port_already_use=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&admin=USER& diff --git a/conf/nginx.conf b/conf/nginx.conf index b374ab5..4195917 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -9,6 +9,7 @@ location __PATH__ { proxy_no_cache $cookie_session; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; + # Allow the Radarr API location __PATH__/api { auth_request off; 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/manifest.json b/manifest.json deleted file mode 100644 index 5701027..0000000 --- a/manifest.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "Sonarr", - "id": "sonarr", - "packaging_format": 1, - "description": { - "en": "A series collection manager for Usenet and BitTorrent users", - "fr": "Gestionnaire de collection de séries pour utilisateurs de Usenet et BitTorrent" - }, - "version": "3.0.6.1196~ynh3", - "url": "https://sonarr.tv", - "upstream": { - "license": "GPL-3.0-only", - "website": "https://sonarr.tv", - "admindoc": "https://wiki.servarr.com/Sonarr", - "code": "https://github.com/Sonarr/Sonarr" - }, - "license": "GPL-3.0-only", - "maintainer": { - "name": "tituspijean", - "email": "tituspijean@outlook.com" - }, - "requirements": { - "yunohost": ">= 11.2" - }, - "multi_instance": true, - "services": [ - "nginx", - "mysql" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/sonarr", - "default": "/sonarr" - }, - { - "name": "admin", - "type": "user" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 5e9203b..ffa9e6c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,31 +14,26 @@ license = "GPL-3.0-only" website = "https://sonarr.tv" admindoc = "https://wiki.servarr.com/Sonarr" code = "https://github.com/Sonarr/Sonarr" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 4.2" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.2" +architectures = "all" multi_instance = true -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" [install.path] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "path" default = "/sonarr" [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [resources] @@ -48,6 +43,14 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.permissions] main.url = "/" + api.url = "/api" + api.allowed = "visitors" + api.show_tile = false + api.protected = true + + [resources.apt] + packages = "apt-transport-https, dirmngr, gnupg, ca-certificates, mediainfo, mono-devel, sonarr" + [[resources.apt.extras]] repo = "https://download.mono-project.com/repo/debian stable-buster main" key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" diff --git a/scripts/_common.sh b/scripts/_common.sh index d74f1d9..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="apt-transport-https dirmngr gnupg ca-certificates mediainfo mono-devel sonarr" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 3bcf144..737146f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,27 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? 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 -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index 81ec5ed..d5b0639 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,61 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? api_key=$(ynh_app_setting_get --app=$app --key=api_key) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -#REMOVEME? 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 -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -80,30 +25,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#REMOVEME? 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 -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" - # Create a dedicated NGINX config -#REMOVEME? 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 -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - #================================================= # SPECIFIC MODIFICATIONS #================================================= @@ -125,13 +46,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Starting Web Server" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 3812364..63f0c9a 100755 --- a/scripts/install +++ b/scripts/install @@ -9,74 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? admin=$YNH_APP_ARG_ADMIN - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1 - -#REMOVEME? install_dir=/var/lib/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1 - -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=8095) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=4 - -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.mono-project.com/repo/debian stable-buster main" --package="mono-devel" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" - -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://apt.sonarr.tv/debian buster main" --package="sonarr" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # NGINX CONFIGURATION #================================================= @@ -85,13 +17,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# SPECIFIC SETUP -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - # Stop the service automatically created upon installation of the package ynh_systemd_action --service_name=sonarr --action="stop" @@ -157,22 +82,6 @@ if [[ $(systemctl list-units -all | grep 'sonarr.service' | grep 'inactive') ]]; ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 fi -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1 - -#REMOVEME? ynh_permission_update --permission="main" --add="$admin" --remove="all_users" - -#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 0c876eb..d13cdf3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,17 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - #================================================= # STANDARD REMOVE #================================================= @@ -33,56 +22,15 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=3 - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies - -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1 - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 6268a5a..2607288 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,53 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? 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 -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1 - -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -64,13 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -# FIXME: this should be managed by the core in the future -# Here, as a packager, you may have to tweak the ownerhsip/permissions -# such that the appropriate users (e.g. maybe www-data) can access -# files in some cases. -# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder - -# this will be treated as a security issue. -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" @@ -89,27 +35,14 @@ ynh_multimedia_addaccess $app #================================================= # REINSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=4 +ynh_script_progression --message="Reinstalling dependencies..." --weight=4 -# Define and install dependencies -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.mono-project.com/repo/debian stable-buster main" --package="mono-devel" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" - -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://apt.sonarr.tv/debian buster main" --package="sonarr" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" 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 +ynh_restore_file --origin_path="/etc/logrotate.d/$app" yunohost service add $app --description="Sonarr daemon" --log="$install_dir/logs/sonarr.txt" @@ -127,13 +60,6 @@ if [[ $(systemctl list-units -all | grep 'sonarr.service' | grep 'inactive') ]]; ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 fi -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8ee2127..cc3c817 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,46 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? api_key=$(ynh_app_setting_get --app=$app --key=api_key) - #================================================= # CHECK VERSION #================================================= -### This helper will compare the version of the currently installed app and the version of the upstream package. -### $upgrade_type can have 2 different values -### - UPGRADE_APP if the upstream app version has changed -### - UPGRADE_PACKAGE if only the YunoHost package has changed -### ynh_check_app_version_changed will stop the upgrade if the app is up to date. -### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4 - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -58,24 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# Create a permission if needed -#REMOVEME? if ! ynh_permission_exists --permission="api"; then -#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true" -fi - -#================================================= -# CREATE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir" - #================================================= # NGINX CONFIGURATION #================================================= @@ -84,42 +32,12 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=4 - -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://download.mono-project.com/repo/debian stable-buster main" --package="mono-devel" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" - -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="https://apt.sonarr.tv/debian buster main" --package="sonarr" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# SPECIFIC UPGRADE -#================================================= -# 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 --logfile="$install_dir/logs" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Sonarr daemon" --log="$install_dir/logs/sonarr.txt" #================================================= @@ -136,13 +54,6 @@ if [[ $(systemctl list-units -all | grep 'sonarr.service' | grep 'inactive') ]]; ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 fi -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? 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..91daf17 --- /dev/null +++ b/tests.toml @@ -0,0 +1,7 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ \ No newline at end of file From 0d0d82b388256032136d105db3faa602d81da56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 7 Oct 2023 20:41:59 +0200 Subject: [PATCH 03/51] Update manifest.toml --- manifest.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index ffa9e6c..fc925f8 100644 --- a/manifest.toml +++ b/manifest.toml @@ -2,7 +2,7 @@ packaging_format = 2 id = "sonarr" name = "Sonarr" -description.en = "A series collection manager for Usenet and BitTorrent users" +description.en = "Series collection manager for Usenet and BitTorrent users" description.fr = "Gestionnaire de collection de séries pour utilisateurs de Usenet et BitTorrent" version = "3.0.6.1196~ynh2" @@ -33,6 +33,10 @@ ram.runtime = "50M" type = "path" default = "/sonarr" + [install.init_main_permission] + type = "group" + default = "visitors" + [install.admin] type = "user" From 724d3387a625cd78ce00b49a89f73a29a868bcc4 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 15 Oct 2023 14:24:16 +0200 Subject: [PATCH 04/51] Add toml schemas --- manifest.toml | 2 ++ tests.toml | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index fc925f8..2fb3ce2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "sonarr" diff --git a/tests.toml b/tests.toml index 91daf17..953b195 100644 --- a/tests.toml +++ b/tests.toml @@ -1,7 +1,9 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + test_format = 1.0 [default] # ------------ # Tests to run - # ------------ \ No newline at end of file + # ------------ From db4fb997114698f4ef6d4bb4604af8c4fc89fa5d Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 15 Oct 2023 14:30:23 +0200 Subject: [PATCH 05/51] Secure permissions --- manifest.toml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index 2fb3ce2..ca960c3 100644 --- a/manifest.toml +++ b/manifest.toml @@ -37,10 +37,8 @@ ram.runtime = "50M" [install.init_main_permission] type = "group" - default = "visitors" - - [install.admin] - type = "user" + default = "admins" + help = "This app is only protected by YunoHost's SSO, so do not make it accessible by visitors." [resources] [resources.system_user] From f3573a6a12fd78f4f65f5429eda759bab7515943 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 15 Oct 2023 14:35:36 +0200 Subject: [PATCH 06/51] Fix extra apt dependencies in manifest --- manifest.toml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/manifest.toml b/manifest.toml index ca960c3..bd022b5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -55,12 +55,10 @@ ram.runtime = "50M" [resources.apt] packages = "apt-transport-https, dirmngr, gnupg, ca-certificates, mediainfo, mono-devel, sonarr" - [[resources.apt.extras]] - repo = "https://download.mono-project.com/repo/debian stable-buster main" - key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" - packages = "mono-devel" + extras.mono-devel.repo = "https://download.mono-project.com/repo/debian stable-buster main" + extras.mono-devel.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" + extras.mono-devel.packages = "mono-devel" - [[resources.apt.extras]] - repo = "https://apt.sonarr.tv/debian buster main" - key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" - packages = "sonarr" + extras.sonarr.repo = "https://apt.sonarr.tv/debian buster main" + extras.sonarr.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" + extras.sonarr.packages = "sonarr" From d6ef26652217fda50a443fe703f8e41332bb6391 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 15 Oct 2023 15:16:58 +0200 Subject: [PATCH 07/51] Fix apt extras and upgrade to v3.0.10.1567 --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index bd022b5..0cac6ab 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Sonarr" description.en = "Series collection manager for Usenet and BitTorrent users" description.fr = "Gestionnaire de collection de séries pour utilisateurs de Usenet et BitTorrent" -version = "3.0.6.1196~ynh2" +version = "3.0.10.1567~ynh1" maintainers = ["tituspijean"] @@ -53,7 +53,7 @@ ram.runtime = "50M" api.protected = true [resources.apt] - packages = "apt-transport-https, dirmngr, gnupg, ca-certificates, mediainfo, mono-devel, sonarr" + packages = "apt-transport-https, dirmngr, gnupg, ca-certificates, mediainfo" extras.mono-devel.repo = "https://download.mono-project.com/repo/debian stable-buster main" extras.mono-devel.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" From 3a2ce670c1f58776265ef5f21bfaf1e2672a3dcf Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 15 Oct 2023 15:20:57 +0200 Subject: [PATCH 08/51] Implement auto-updater with a dummy source --- manifest.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manifest.toml b/manifest.toml index 0cac6ab..f00ad45 100644 --- a/manifest.toml +++ b/manifest.toml @@ -62,3 +62,10 @@ ram.runtime = "50M" extras.sonarr.repo = "https://apt.sonarr.tv/debian buster main" extras.sonarr.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" extras.sonarr.packages = "sonarr" + + # Dummy source to trigger the auto-updater + [resources.sources.main] + url = "https://github.com/Sonarr/Sonarr/archive/refs/tags/3.0.10.1567.tar.gz" + sha256 = "1fd4129216a1baee66c40ecc6af7d86802a04ffd12ecc5fd0afff1e5469ae99c" + prefetch = false + autoupdate.strategy = "latest_github_tag" From 626ef555a82bf014a798729569dad31fb2d5c839 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 15 Oct 2023 15:37:48 +0200 Subject: [PATCH 09/51] Reimplement ports requirement in packaging v2 --- manifest.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index f00ad45..06a2f76 100644 --- a/manifest.toml +++ b/manifest.toml @@ -45,6 +45,8 @@ ram.runtime = "50M" [resources.install_dir] + [resources.ports] + [resources.permissions] main.url = "/" api.url = "/api" @@ -61,7 +63,9 @@ ram.runtime = "50M" extras.sonarr.repo = "https://apt.sonarr.tv/debian buster main" extras.sonarr.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" - extras.sonarr.packages = "sonarr" + extras.sonarr.packages_from_raw_bash = """ + echo "sonarr=$YNH_APP_MANIFEST_VERSION" + """ # Dummy source to trigger the auto-updater [resources.sources.main] From 38b4d4a5f9e14dc8ec42cd203494b824e7419902 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 15 Oct 2023 16:20:37 +0200 Subject: [PATCH 10/51] Fix dependencies, testing got saved in commit --- manifest.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 06a2f76..12ba6a7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -63,9 +63,7 @@ ram.runtime = "50M" extras.sonarr.repo = "https://apt.sonarr.tv/debian buster main" extras.sonarr.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" - extras.sonarr.packages_from_raw_bash = """ - echo "sonarr=$YNH_APP_MANIFEST_VERSION" - """ + extras.sonarr.packages = "sonarr" # Dummy source to trigger the auto-updater [resources.sources.main] From 4255fb6ea5ea9994c29caaf336d41abd99067d53 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 15 Oct 2023 17:16:43 +0200 Subject: [PATCH 11/51] Add migration warning and test --- conf/systemd.service | 2 +- tests.toml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index afb4b3f..6eedfc7 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ Group=__APP__ UMask=0002 Type=simple -ExecStart=/usr/bin/mono --debug /usr/lib/sonarr/bin/Sonarr.exe -nobrowser -data=/var/lib/__APP__ +ExecStart=/usr/bin/mono --debug /usr/lib/sonarr/bin/Sonarr.exe -nobrowser -data=__INSTALL_DIR__ TimeoutStopSec=20 KillMode=process Restart=on-failure diff --git a/tests.toml b/tests.toml index 953b195..e21ee63 100644 --- a/tests.toml +++ b/tests.toml @@ -7,3 +7,8 @@ test_format = 1.0 # ------------ # Tests to run # ------------ + + test_upgrade_from.a496362.name = "Upgrade from 3.0.6.1196~ynh2" + test_upgrade_from.a496362.args.domain = "sub.domain.tld" + test_upgrade_from.a496362.args.path = "/sonarr" + test_upgrade_from.a496362.args.admin = "package_checker" From 89dd61399271859f2e0cd0392faf17d2132aeca1 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Sat, 2 Dec 2023 01:48:42 +0100 Subject: [PATCH 12/51] Update scripts/restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 2607288..13b7c3f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -56,7 +56,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l # If a first Sonarr app was running before installing this one, # it may have been stopped by the installation of the dependencies. # Let's restart it. -if [[ $(systemctl list-units -all | grep 'sonarr.service' | grep 'inactive') ]]; then +if ! systemctl is-active $app.service; then ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 fi From 308b40157e943bcbf39e21a419486af9de7f78ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 19 Dec 2023 20:23:34 +0100 Subject: [PATCH 13/51] cleaning --- manifest.toml | 3 +++ scripts/install | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 12ba6a7..8ba88e4 100644 --- a/manifest.toml +++ b/manifest.toml @@ -21,8 +21,11 @@ code = "https://github.com/Sonarr/Sonarr" yunohost = ">= 11.2" architectures = "all" multi_instance = true + ldap = false + sso = false + disk = "50M" ram.build = "50M" ram.runtime = "50M" diff --git a/scripts/install b/scripts/install index 63f0c9a..cd4acdc 100755 --- a/scripts/install +++ b/scripts/install @@ -35,7 +35,7 @@ ynh_app_setting_set --app=$app --key=api_key --value=$api_key mkdir -p "$install_dir/logs" chmod 750 "$install_dir" -ynh_add_config --template="../conf/config.xml" --destination="$install_dir/config.xml" +ynh_add_config --template="config.xml" --destination="$install_dir/config.xml" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" From 45b0ed365f0d56f9555f7674ddb50c0d0b0a5d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 19 Dec 2023 20:25:39 +0100 Subject: [PATCH 14/51] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index cc3c817..3a3dbdd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,7 +27,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # 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 From d3c275e1b17a923e63f8983546b3b7ac7fbdd017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 19 Dec 2023 20:57:31 +0100 Subject: [PATCH 15/51] Update ADMIN_fr.md --- doc/ADMIN_fr.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 64a0d4f..49e767f 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,6 +1,5 @@ * Le dépôt des développeurs de Sonarr ne permet de télécharger que la toute dernière version. * La version annoncée ici peut être différente de celle réellement installée. -* Les architectures compatibles sont `arm`, `armhf`, `arm64`, et `amd64` * Le contrôle de l'accès se fait avec le système de permissions de YunoHost. - * L'API (`domain.tld/path/api`) est accessible aux visiteurs pour permettre le contrôle via des clients externes. + * L'API (`__DOMAIN__/__PATH__/api`) est accessible aux visiteurs pour permettre le contrôle via des clients externes. * L'application utilise les dossiers multimédia de YunoHost, elle a donc accès en écriture aux dossiers utilisateurs et communs de `/home/yunohost.multimedia`. Après installation, vous pourrez choisir ces dossiers pour y stocker vos médias. From 3a47ae8a284ede3f15f9f5093d7ea1dbf1574439 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Tue, 19 Dec 2023 20:40:28 +0100 Subject: [PATCH 16/51] Update conf/systemd.service: reset data flag to /var/lib/$app --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 6eedfc7..afb4b3f 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ Group=__APP__ UMask=0002 Type=simple -ExecStart=/usr/bin/mono --debug /usr/lib/sonarr/bin/Sonarr.exe -nobrowser -data=__INSTALL_DIR__ +ExecStart=/usr/bin/mono --debug /usr/lib/sonarr/bin/Sonarr.exe -nobrowser -data=/var/lib/__APP__ TimeoutStopSec=20 KillMode=process Restart=on-failure From 76d3e5bad787df9da66ee5a95c2136ba22391ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 19 Dec 2023 20:57:56 +0100 Subject: [PATCH 17/51] Update ADMIN.md --- doc/ADMIN.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 3b68602..382152b 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,6 +1,5 @@ * Sonarr developper's repository only allows to download the very latest version. * The version displayed here may be different from the one actually installed. -* Supported architectures are `arm`, `armhf`, `arm64`, and `amd64` * Access control is done with YunoHost's permissions system. - * API (`domain.tld/path/api`) can be accessed by visitors to allow control by remote clients. + * API (`__DOMAIN__/__PATH__/api`) can be accessed by visitors to allow control by remote clients. * The app uses YunoHost's multimedia directories, hence it has write access to users' and shared directories in `/home/yunohost.multimedia`. After installation, you can choose these directories to store your media. From 5007e28bb993531df35aba18026641bc55902a8e Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Sat, 6 Jan 2024 23:36:31 +0100 Subject: [PATCH 18/51] Update install --- scripts/install | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/scripts/install b/scripts/install index cd4acdc..63e39bb 100755 --- a/scripts/install +++ b/scripts/install @@ -1,25 +1,23 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config +# Generate API key for configuration later +api_key=$(ynh_string_random --length=32) +ynh_app_setting_set --app=$app --key=api_key --value=$api_key # Stop the service automatically created upon installation of the package ynh_systemd_action --service_name=sonarr --action="stop" +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Adding system configurations related to $app..." + +# Create a dedicated NGINX config +ynh_add_nginx_config + # Create a dedicated systemd config, it will override the one in /lib/systemd/system/sonarr.service ynh_add_systemd_config @@ -28,9 +26,6 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Configuring Radarr..." --weight=2 -api_key=$(ynh_string_random --length=32) -ynh_app_setting_set --app=$app --key=api_key --value=$api_key - # Create $install_dir and its logs subdirectory mkdir -p "$install_dir/logs" chmod 750 "$install_dir" @@ -55,7 +50,7 @@ ynh_multimedia_addaccess $app #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 +ynh_script_progression --message="Configuring log rotation..." # Use logrotate to manage application logfile(s) ynh_use_logrotate --logfile="$install_dir/logs/" @@ -63,7 +58,7 @@ ynh_use_logrotate --logfile="$install_dir/logs/" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add $app --description="Sonarr daemon" --log="$install_dir/logs/sonarr.txt" @@ -77,9 +72,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l # If a first Sonarr app was running before installing this one, # it may have been stopped by the installation of the dependencies. -# Let's restart it. -if [[ $(systemctl list-units -all | grep 'sonarr.service' | grep 'inactive') ]]; then - ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 +# Let's restart it. (hence why we use sonarr and not $app..) +if ! systemctl -q is-active sonarr; then + ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="restart" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 fi #================================================= From 1c7bd39fe17c58596d5f3ab0ed77bb28e8eff3c8 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 5 Feb 2024 15:52:29 +0000 Subject: [PATCH 19/51] Auto-update README --- README.md | 11 +---------- README_fr.md | 11 +---------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 2610b25..0b20a1d 100644 --- a/README.md +++ b/README.md @@ -19,21 +19,12 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Sonarr is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new episodes of your favorite shows and will grab, sort and rename them. It can also be configured to automatically upgrade the quality of files already downloaded when a better quality format becomes available. -**Shipped version:** 3.0.6.1196~ynh3 +**Shipped version:** 3.0.10.1567~ynh1 ## Screenshots ![Screenshot of Sonarr](./doc/screenshots/screenshot.jpg) -## Disclaimers / important information - -* Sonarr developper's repository only allows to download the very latest version. - * The version displayed here may be different from the one actually installed. -* Supported architectures are `arm`, `armhf`, `arm64`, and `amd64` -* Access control is done with YunoHost's permissions system. - * API (`domain.tld/path/api`) can be accessed by visitors to allow control by remote clients. -* The app uses YunoHost's multimedia directories, hence it has write access to users' and shared directories in `/home/yunohost.multimedia`. After installation, you can choose these directories to store your media. - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index 42a9eeb..e05936e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,21 +19,12 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Sonarr est un PVR pour les utilisateurs Usenet et BitTorrent. Il peut surveiller plusieurs flux RSS pour les nouveaux épisodes de vos émissions préférées et les récupérer, les trier et les renommer. Il peut également être configuré pour mettre à niveau automatiquement la qualité des fichiers déjà téléchargés lorsqu'un format de meilleure qualité devient disponible. -**Version incluse :** 3.0.6.1196~ynh3 +**Version incluse :** 3.0.10.1567~ynh1 ## Captures d’écran ![Capture d’écran de Sonarr](./doc/screenshots/screenshot.jpg) -## Avertissements / informations importantes - -* Le dépôt des développeurs de Sonarr ne permet de télécharger que la toute dernière version. - * La version annoncée ici peut être différente de celle réellement installée. -* Les architectures compatibles sont `arm`, `armhf`, `arm64`, et `amd64` -* Le contrôle de l'accès se fait avec le système de permissions de YunoHost. - * L'API (`domain.tld/path/api`) est accessible aux visiteurs pour permettre le contrôle via des clients externes. -* L'application utilise les dossiers multimédia de YunoHost, elle a donc accès en écriture aux dossiers utilisateurs et communs de `/home/yunohost.multimedia`. Après installation, vous pourrez choisir ces dossiers pour y stocker vos médias. - ## Documentations et ressources * Site officiel de l’app : From 6ca00ce632cf7e3137b18b29925cc258e896cc58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 17:23:38 +0100 Subject: [PATCH 20/51] debug --- scripts/install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/install b/scripts/install index 63e39bb..ce3c347 100755 --- a/scripts/install +++ b/scripts/install @@ -77,6 +77,10 @@ if ! systemctl -q is-active sonarr; then ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="restart" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 fi +ynh_exec_warn cat "/etc/nginx/conf.d/$domain.d/$app.conf" + +ynh_exec_warn cat "$install_dir/config.xml" + #================================================= # END OF SCRIPT #================================================= From 197c6682bc0698874eeb1af2ddcec38ab2bb55bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 17:32:06 +0100 Subject: [PATCH 21/51] Fix install_dir --- manifest.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.toml b/manifest.toml index 8ba88e4..5ac3c97 100644 --- a/manifest.toml +++ b/manifest.toml @@ -47,6 +47,7 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] + dir = "/var/lib/__APP__" [resources.ports] From 93cce95b00570ff1c7a742c267fffad75b90d751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 17:47:43 +0100 Subject: [PATCH 22/51] Apply template, move logs dir, fix install_dir --- conf/systemd.service | 2 +- scripts/backup | 14 +++----- scripts/install | 86 +++++++++++++++++++++----------------------- scripts/remove | 13 ++++--- scripts/restore | 40 ++++++++++----------- scripts/upgrade | 34 ++++++++++-------- 6 files changed, 90 insertions(+), 99 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index afb4b3f..d31dfae 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ Group=__APP__ UMask=0002 Type=simple -ExecStart=/usr/bin/mono --debug /usr/lib/sonarr/bin/Sonarr.exe -nobrowser -data=/var/lib/__APP__ +ExecStart=/usr/bin/mono --debug /usr/lib/sonarr/bin/Sonarr.exe -nobrowser -data=/__INSTALL_DIR__ TimeoutStopSec=20 KillMode=process Restart=on-failure diff --git a/scripts/backup b/scripts/backup index 737146f..d1816f1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -22,24 +22,20 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - ynh_backup --src_path="/etc/logrotate.d/$app" +ynh_backup --src_path="/etc/systemd/system/$app.service" + #================================================= -# BACKUP SYSTEMD +# BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup --src_path="/var/log/$app/" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index ce3c347..7d9e176 100755 --- a/scripts/install +++ b/scripts/install @@ -1,14 +1,49 @@ #!/bin/bash +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + source _common.sh source /usr/share/yunohost/helpers +#================================================= +# INITIALIZE AND STORE SETTINGS +#================================================= + # Generate API key for configuration later api_key=$(ynh_string_random --length=32) -ynh_app_setting_set --app=$app --key=api_key --value=$api_key +ynh_app_setting_set --app=$app --key="api_key" --value="$api_key" # Stop the service automatically created upon installation of the package -ynh_systemd_action --service_name=sonarr --action="stop" +ynh_systemd_action --service_name="sonarr" --action="stop" + +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring Radarr..." --weight=2 + +# Create $install_dir and its logs subdirectory +mkdir -p "/var/log/$app" +ln -s "/var/log/$app" "$install_dir/logs" + +ynh_add_config --template="config.xml" --destination="$install_dir/config.xml" + +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R "$app:$app" "$install_dir" + +#================================================= +# YUNOHOST MULTIMEDIA INTEGRATION +#================================================= +ynh_script_progression --message="Adding multimedia directories..." --weight=2 + +# Build YunoHost multimedia directories +ynh_multimedia_build_main_dir +# Enable writing into these directories +ynh_multimedia_addaccess "$app" #================================================= # NGINX CONFIGURATION @@ -20,47 +55,10 @@ ynh_add_nginx_config # Create a dedicated systemd config, it will override the one in /lib/systemd/system/sonarr.service ynh_add_systemd_config - -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring Radarr..." --weight=2 - -# Create $install_dir and its logs subdirectory -mkdir -p "$install_dir/logs" -chmod 750 "$install_dir" - -ynh_add_config --template="config.xml" --destination="$install_dir/config.xml" - -chmod -R o-rwx "$install_dir" -chown -R $app:$app "$install_dir" - -#================================================= -# YUNOHOST MULTIMEDIA INTEGRATION -#================================================= -ynh_script_progression --message="Adding multimedia directories..." --weight=2 - -# Build YunoHost multimedia directories -ynh_multimedia_build_main_dir -# Enable writing into these directories -ynh_multimedia_addaccess $app - -#================================================= -# GENERIC FINALIZATIONs -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." +yunohost service add "$app" --description="Sonarr daemon" --log="/var/log/$app/sonarr.txt" # Use logrotate to manage application logfile(s) -ynh_use_logrotate --logfile="$install_dir/logs/" - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description="Sonarr daemon" --log="$install_dir/logs/sonarr.txt" +ynh_use_logrotate --logfile="/var/log/$app/" #================================================= # START SYSTEMD SERVICE @@ -68,7 +66,7 @@ yunohost service add $app --description="Sonarr daemon" --log="$install_dir/logs 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="Starting Web Server" --timeout=30 +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 # If a first Sonarr app was running before installing this one, # it may have been stopped by the installation of the dependencies. @@ -77,10 +75,6 @@ if ! systemctl -q is-active sonarr; then ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="restart" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 fi -ynh_exec_warn cat "/etc/nginx/conf.d/$domain.d/$app.conf" - -ynh_exec_warn cat "$install_dir/config.xml" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index d13cdf3..23788df 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,16 +10,13 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEM CONFIGURATIONS #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null -then - ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove $app +if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then + yunohost service remove "$app" fi # Remove the dedicated systemd config @@ -31,6 +28,8 @@ ynh_remove_nginx_config # Remove the app-specific logrotate config ynh_remove_logrotate +ynh_secure_remove --file="/var/log/$app" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 13b7c3f..cf6b734 100755 --- a/scripts/restore +++ b/scripts/restore @@ -18,7 +18,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:$app "$install_dir" +chown -R "$app:$app" "$install_dir" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -28,44 +28,42 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=2 # Build YunoHost multimedia directories ynh_multimedia_build_main_dir # Enable writing into these directories -ynh_multimedia_addaccess $app +ynh_multimedia_addaccess "$app" #================================================= -# SPECIFIC RESTORATION +# RESTORE SYSTEM CONFIGURATIONS #================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=4 +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" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet +systemctl enable "$app.service" --quiet +yunohost service add "$app" --description="Sonarr daemon" --log="/var/log/$app/sonarr.txt" ynh_restore_file --origin_path="/etc/logrotate.d/$app" -yunohost service add $app --description="Sonarr daemon" --log="$install_dir/logs/sonarr.txt" - #================================================= -# START SYSTEMD SERVICE +# RESTORE VARIOUS FILES #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 - -# If a first Sonarr app was running before installing this one, -# it may have been stopped by the installation of the dependencies. -# Let's restart it. -if ! systemctl is-active $app.service; then - ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 -fi +ynh_restore_file --origin_path="/var/log/$app/" #================================================= # GENERIC FINALIZATION #================================================= -# RELOAD NGINX +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --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="systemd" --line_match="Starting Web Server" --timeout=30 + +# If a first Sonarr app was running before installing this one, +# it may have been stopped by the installation of the dependencies. +# Let's restart it. +if ! systemctl is-active "$app.service"; then + ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 +fi ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 3a3dbdd..21f3c6d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,12 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -22,10 +16,21 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= -# NGINX CONFIGURATION +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +if [ -d "$install_dir/logs" ]; then + rm -rf "/var/log/$app" + mv "$install_dir/logs" "/var/log/$app" + ln -s "/var/log/$app" "$install_dir/logs" +fi + +#================================================= +# REAPPLY SYSTEM CONFIGURATIONS #================================================= ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 @@ -34,24 +39,23 @@ ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config +yunohost service add "$app" --description="Sonarr daemon" --log="/var/log/$app/sonarr.txt" # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append --logfile="$install_dir/logs" - -yunohost service add $app --description="Sonarr daemon" --log="$install_dir/logs/sonarr.txt" +ynh_use_logrotate --non-append --logfile="/var/log/$app/" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 # If a first Sonarr app was running before installing this one, # it may have been stopped by the installation of the dependencies. -# Let's restart it. -if [[ $(systemctl list-units -all | grep 'sonarr.service' | grep 'inactive') ]]; then - ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 +# Let's restart it. (hence why we use sonarr and not $app..) +if ! systemctl -q is-active sonarr; then + ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="restart" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 fi #================================================= From 486f748a67238f4fa6a080588713e48232e0c707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 17:53:46 +0100 Subject: [PATCH 23/51] use ynh_secure_remove --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 21f3c6d..dbd6182 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,7 +24,7 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 if [ -d "$install_dir/logs" ]; then - rm -rf "/var/log/$app" + ynh_secure_remove --file="/var/log/$app" mv "$install_dir/logs" "/var/log/$app" ln -s "/var/log/$app" "$install_dir/logs" fi From 43707c4b1c526ba988f0ca65fdaa082a834a6667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 19:12:19 +0100 Subject: [PATCH 24/51] debug restore --- scripts/restore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/restore b/scripts/restore index cf6b734..31bb06e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,6 +15,8 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=2 +# Remove the version installed by the deb package +ynh_secure_remove "$install_dir" ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" @@ -67,6 +69,10 @@ fi ynh_systemd_action --service_name=nginx --action=reload + +ynh_exec_warn cat "$install_dir/config.xml" +ynh_exec_warn cat "/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # END OF SCRIPT #================================================= From 664a9f4e4e8f6bfe8067c04da0fe648741f8599b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 19:46:40 +0100 Subject: [PATCH 25/51] try to fix permission, debug --- scripts/restore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/restore b/scripts/restore index 31bb06e..7449e28 100755 --- a/scripts/restore +++ b/scripts/restore @@ -19,6 +19,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_secure_remove "$install_dir" ynh_restore_file --origin_path="$install_dir" +chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:$app" "$install_dir" @@ -70,6 +71,7 @@ fi ynh_systemd_action --service_name=nginx --action=reload +ynh_exec_warn ls -lah "$install_dir" ynh_exec_warn cat "$install_dir/config.xml" ynh_exec_warn cat "/etc/nginx/conf.d/$domain.d/$app.conf" From 578f986e2d51d6937d87009d601c3a79f5ee0c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 21:02:40 +0100 Subject: [PATCH 26/51] Bump repository from buster to bullseye --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 5ac3c97..7b3f739 100644 --- a/manifest.toml +++ b/manifest.toml @@ -61,11 +61,11 @@ ram.runtime = "50M" [resources.apt] packages = "apt-transport-https, dirmngr, gnupg, ca-certificates, mediainfo" - extras.mono-devel.repo = "https://download.mono-project.com/repo/debian stable-buster main" + extras.mono-devel.repo = "https://download.mono-project.com/repo/debian bullseye main" extras.mono-devel.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" extras.mono-devel.packages = "mono-devel" - extras.sonarr.repo = "https://apt.sonarr.tv/debian buster main" + extras.sonarr.repo = "https://apt.sonarr.tv/debian bullseye main" extras.sonarr.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" extras.sonarr.packages = "sonarr" From 06baef407807d9fdddf863e327a8a378202551b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 21:40:31 +0100 Subject: [PATCH 27/51] Try without mono-devel --- manifest.toml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/manifest.toml b/manifest.toml index 7b3f739..684795c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -59,11 +59,17 @@ ram.runtime = "50M" api.protected = true [resources.apt] - packages = "apt-transport-https, dirmngr, gnupg, ca-certificates, mediainfo" + packages = [ + "apt-transport-https", + "dirmngr", + "gnupg", + "ca-certificates", + "mediainfo", + ] - extras.mono-devel.repo = "https://download.mono-project.com/repo/debian bullseye main" - extras.mono-devel.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" - extras.mono-devel.packages = "mono-devel" + # extras.mono-devel.repo = "https://download.mono-project.com/repo/debian bullseye main" + # extras.mono-devel.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" + # extras.mono-devel.packages = "mono-devel" extras.sonarr.repo = "https://apt.sonarr.tv/debian bullseye main" extras.sonarr.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" From badffaa7e13583d7fd2f0c33351321086e60975f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 22:26:22 +0100 Subject: [PATCH 28/51] Try with tarball instead of deb --- conf/systemd.service | 2 +- manifest.toml | 27 ++++++++++++--------------- scripts/install | 31 ++++++++++++++++--------------- 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index d31dfae..43d8228 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ Group=__APP__ UMask=0002 Type=simple -ExecStart=/usr/bin/mono --debug /usr/lib/sonarr/bin/Sonarr.exe -nobrowser -data=/__INSTALL_DIR__ +ExecStart=mono --debug __INSTALL_DIR__/Sonarr -nobrowser -data=__DATA_DIR__ TimeoutStopSec=20 KillMode=process Restart=on-failure diff --git a/manifest.toml b/manifest.toml index 684795c..c9d7f75 100644 --- a/manifest.toml +++ b/manifest.toml @@ -44,9 +44,21 @@ ram.runtime = "50M" help = "This app is only protected by YunoHost's SSO, so do not make it accessible by visitors." [resources] + [resources.sources.main] + amd64.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.1047/Sonarr.develop.4.0.1.1047.linux-x64.tar.gz" + arm64.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.1047/Sonarr.develop.4.0.1.1047.linux-arm64.tar.gz" + armhf.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.1047/Sonarr.develop.4.0.1.1047.linux-arm.tar.gz" + + autoupdate.strategy = "latest_github_release" + autoupdate.asset.amd64 = ".*\\.linux-x64.tar.gz" + autoupdate.asset.arm64 = ".*\\.linux-arm64.tar.gz" + autoupdate.asset.armhf = ".*\\.linux-arm.tar.gz" + [resources.system_user] [resources.install_dir] + + [resources.data_dir] dir = "/var/lib/__APP__" [resources.ports] @@ -66,18 +78,3 @@ ram.runtime = "50M" "ca-certificates", "mediainfo", ] - - # extras.mono-devel.repo = "https://download.mono-project.com/repo/debian bullseye main" - # extras.mono-devel.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" - # extras.mono-devel.packages = "mono-devel" - - extras.sonarr.repo = "https://apt.sonarr.tv/debian bullseye main" - extras.sonarr.key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2009837CBFFD68F45BC180471F4F90DE2A9B4BF8" - extras.sonarr.packages = "sonarr" - - # Dummy source to trigger the auto-updater - [resources.sources.main] - url = "https://github.com/Sonarr/Sonarr/archive/refs/tags/3.0.10.1567.tar.gz" - sha256 = "1fd4129216a1baee66c40ecc6af7d86802a04ffd12ecc5fd0afff1e5469ae99c" - prefetch = false - autoupdate.strategy = "latest_github_tag" diff --git a/scripts/install b/scripts/install index 7d9e176..10ed482 100755 --- a/scripts/install +++ b/scripts/install @@ -17,23 +17,31 @@ source /usr/share/yunohost/helpers api_key=$(ynh_string_random --length=32) ynh_app_setting_set --app=$app --key="api_key" --value="$api_key" -# Stop the service automatically created upon installation of the package -ynh_systemd_action --service_name="sonarr" --action="stop" +#================================================= +# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Setting up source files..." --weight=1 + +# Download, check integrity, uncompress and patch the source from manifest.toml +ynh_setup_source --dest_dir="$install_dir" + +chown -R "$app:$app" "$install_dir" #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Configuring Radarr..." --weight=2 -# Create $install_dir and its logs subdirectory mkdir -p "/var/log/$app" -ln -s "/var/log/$app" "$install_dir/logs" +ln -s "/var/log/$app" "$data_dir/logs" -ynh_add_config --template="config.xml" --destination="$install_dir/config.xml" +ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R "$app:$app" "$install_dir" +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R "$app:$app" "$data_dir" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -68,13 +76,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="Starting Web Server" --timeout=30 -# If a first Sonarr app was running before installing this one, -# it may have been stopped by the installation of the dependencies. -# Let's restart it. (hence why we use sonarr and not $app..) -if ! systemctl -q is-active sonarr; then - ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="restart" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 -fi - #================================================= # END OF SCRIPT #================================================= From 497eb5f31552ab6b2d45b6be5d85756e0ab98ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 22:46:34 +0100 Subject: [PATCH 29/51] add shasum --- manifest.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manifest.toml b/manifest.toml index c9d7f75..e433941 100644 --- a/manifest.toml +++ b/manifest.toml @@ -46,8 +46,11 @@ ram.runtime = "50M" [resources] [resources.sources.main] amd64.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.1047/Sonarr.develop.4.0.1.1047.linux-x64.tar.gz" + amd64.sha256 = "5ef17d1f14f18061072cf45f30162b4d2953561c0d1fa608476a605a6c44d3c5" arm64.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.1047/Sonarr.develop.4.0.1.1047.linux-arm64.tar.gz" + arm64.sha256 = "ebc0bf30cb46cfffbf3c188c519ffce506633a5a865f916dc585aa2914af19af" armhf.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.1047/Sonarr.develop.4.0.1.1047.linux-arm.tar.gz" + armhf.sha256 = "bc36a6ac9717abbc149b7974770d28b28c2d1b70a8484946fb21b80a3b476fb7" autoupdate.strategy = "latest_github_release" autoupdate.asset.amd64 = ".*\\.linux-x64.tar.gz" From 69826d17579228945b7b466685db7bbdfad18a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 22:53:54 +0100 Subject: [PATCH 30/51] Add mono-runtime dep --- manifest.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.toml b/manifest.toml index e433941..aa62d33 100644 --- a/manifest.toml +++ b/manifest.toml @@ -80,4 +80,5 @@ ram.runtime = "50M" "gnupg", "ca-certificates", "mediainfo", + "mono-runtime", ] From a9154a16d7ebea1d423f75150869e4aff64b06b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 23:05:04 +0100 Subject: [PATCH 31/51] fix dependecies --- manifest.toml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/manifest.toml b/manifest.toml index aa62d33..7a4e79c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -75,10 +75,8 @@ ram.runtime = "50M" [resources.apt] packages = [ - "apt-transport-https", - "dirmngr", - "gnupg", - "ca-certificates", - "mediainfo", "mono-runtime", + "sqlite3", + "dirmngr", + "mediainfo", ] From b3a930f6d0f8fe5a25b75dee3f61391021a98e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 23:07:15 +0100 Subject: [PATCH 32/51] call binary directly --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 43d8228..31f1b5e 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ Group=__APP__ UMask=0002 Type=simple -ExecStart=mono --debug __INSTALL_DIR__/Sonarr -nobrowser -data=__DATA_DIR__ +ExecStart=__INSTALL_DIR__/Sonarr -nobrowser -data=__DATA_DIR__ TimeoutStopSec=20 KillMode=process Restart=on-failure From 5bc3d2d8d49d09ff2b8a21efd18711263199137c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 23:18:17 +0100 Subject: [PATCH 33/51] fix install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 10ed482..1c52387 100755 --- a/scripts/install +++ b/scripts/install @@ -74,7 +74,7 @@ ynh_use_logrotate --logfile="/var/log/$app/" 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="Starting Web Server" --timeout=30 +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Application started." --timeout=30 #================================================= # END OF SCRIPT From e487cfaa3d42f918e6d42ff1984cbfaff703a4f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 5 Feb 2024 23:31:26 +0100 Subject: [PATCH 34/51] finalize port --- scripts/backup | 10 ++++++++-- scripts/change_url | 9 ++++----- scripts/remove | 2 +- scripts/restore | 27 ++++++++++----------------- scripts/upgrade | 27 ++++++++++++++++----------- 5 files changed, 39 insertions(+), 36 deletions(-) diff --git a/scripts/backup b/scripts/backup index d1816f1..289c38f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -21,16 +21,22 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$data_dir" + #================================================= # SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_backup --src_path="/etc/logrotate.d/$app" - ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP VARIOUS FILES #================================================= diff --git a/scripts/change_url b/scripts/change_url index d5b0639..b7bcef0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,12 +30,10 @@ ynh_change_url_nginx_config #================================================= # UPDATE CONFIGURATION FILE #================================================= -#REMOVEME? -path=$new_path -ynh_exec_warn_less ynh_add_config --template="../conf/config.xml" --destination="$install_dir/config.xml" +ynh_exec_warn_less ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" -chown $app:$app "$install_dir/config.xml" +chown "$app:$app" "$data_dir/config.xml" #================================================= # GENERIC FINALISATION @@ -44,7 +42,8 @@ chown $app:$app "$install_dir/config.xml" #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Starting Web Server" +# Start a systemd service +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Application started." #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 23788df..8999ab4 100755 --- a/scripts/remove +++ b/scripts/remove @@ -16,7 +16,7 @@ ynh_script_progression --message="Removing system configurations related to $app # 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 - yunohost service remove "$app" + yunohost service remove "$app" fi # Remove the dedicated systemd config diff --git a/scripts/restore b/scripts/restore index 7449e28..cc68b8e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,14 +15,19 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=2 -# Remove the version installed by the deb package -ynh_secure_remove "$install_dir" ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R "$app:$app" "$install_dir" +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." --weight=1 + +ynh_restore_file --origin_path="$data_dir" --not_mandatory + +chown -R "$app:$app" "$data_dir" + #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= @@ -59,22 +64,10 @@ ynh_restore_file --origin_path="/var/log/$app/" #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 - -# If a first Sonarr app was running before installing this one, -# it may have been stopped by the installation of the dependencies. -# Let's restart it. -if ! systemctl is-active "$app.service"; then - ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 -fi +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Application started." --timeout=30 ynh_systemd_action --service_name=nginx --action=reload - -ynh_exec_warn ls -lah "$install_dir" -ynh_exec_warn cat "$install_dir/config.xml" -ynh_exec_warn cat "/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index dbd6182..532baed 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,12 +23,24 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -if [ -d "$install_dir/logs" ]; then +if [ -d "$data_dir/logs" ]; then ynh_secure_remove --file="/var/log/$app" - mv "$install_dir/logs" "/var/log/$app" - ln -s "/var/log/$app" "$install_dir/logs" + mv "$data_dir/logs" "/var/log/$app" + ln -s "/var/log/$app" "$data_dir/logs" fi +#================================================= +# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 + +# Download, check integrity, uncompress and patch the source from manifest.toml +ynh_setup_source --dest_dir="$install_dir" --full_replace=1 + +chown -R "$app:$app" "$install_dir" + #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= @@ -49,14 +61,7 @@ ynh_use_logrotate --non-append --logfile="/var/log/$app/" #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 - -# If a first Sonarr app was running before installing this one, -# it may have been stopped by the installation of the dependencies. -# Let's restart it. (hence why we use sonarr and not $app..) -if ! systemctl -q is-active sonarr; then - ynh_exec_fully_quiet ynh_systemd_action --service_name=sonarr --action="restart" --log_path="systemd" --line_match="Starting Web Server" --timeout=30 -fi +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="Application started." --timeout=30 #================================================= # END OF SCRIPT From 35e076568521ddacea5921e6315e030648331461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 6 Feb 2024 13:03:24 +0100 Subject: [PATCH 35/51] Fix upgrade logdir symlink --- scripts/upgrade | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 532baed..80db284 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,7 +25,6 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 if [ -d "$data_dir/logs" ]; then ynh_secure_remove --file="/var/log/$app" - mv "$data_dir/logs" "/var/log/$app" ln -s "/var/log/$app" "$data_dir/logs" fi From 073bc7144933000026fecee692cfb14cd91af00e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 6 Feb 2024 15:59:17 +0100 Subject: [PATCH 36/51] Fix upgrade_from --- tests.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests.toml b/tests.toml index e21ee63..c0d7a3d 100644 --- a/tests.toml +++ b/tests.toml @@ -8,7 +8,7 @@ test_format = 1.0 # Tests to run # ------------ - test_upgrade_from.a496362.name = "Upgrade from 3.0.6.1196~ynh2" - test_upgrade_from.a496362.args.domain = "sub.domain.tld" - test_upgrade_from.a496362.args.path = "/sonarr" - test_upgrade_from.a496362.args.admin = "package_checker" + test_upgrade_from.768c1ce50ab30dd77f8863cf68269038a0f0f238.name = "Latest packaging v1 version" + test_upgrade_from.768c1ce50ab30dd77f8863cf68269038a0f0f238.args.domain = "sub.domain.tld" + test_upgrade_from.768c1ce50ab30dd77f8863cf68269038a0f0f238.args.path = "/sonarr" + test_upgrade_from.768c1ce50ab30dd77f8863cf68269038a0f0f238.args.admin = "package_checker" From f9cb23fa1eee3ceb6df9cbbf315ff22557374811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 6 Feb 2024 16:36:53 +0100 Subject: [PATCH 37/51] Fix upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 80db284..53fef36 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,8 +23,8 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -if [ -d "$data_dir/logs" ]; then - ynh_secure_remove --file="/var/log/$app" +if [ ! -L "$data_dir/logs" ]; then + ynh_secure_remove --file="$data_dir/logs" ln -s "/var/log/$app" "$data_dir/logs" fi From 111cdc730e6f36d821455396d0a4e56fb08d0d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 6 Feb 2024 17:24:54 +0100 Subject: [PATCH 38/51] Remove legacy tests --- tests.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests.toml b/tests.toml index c0d7a3d..953b195 100644 --- a/tests.toml +++ b/tests.toml @@ -7,8 +7,3 @@ test_format = 1.0 # ------------ # Tests to run # ------------ - - test_upgrade_from.768c1ce50ab30dd77f8863cf68269038a0f0f238.name = "Latest packaging v1 version" - test_upgrade_from.768c1ce50ab30dd77f8863cf68269038a0f0f238.args.domain = "sub.domain.tld" - test_upgrade_from.768c1ce50ab30dd77f8863cf68269038a0f0f238.args.path = "/sonarr" - test_upgrade_from.768c1ce50ab30dd77f8863cf68269038a0f0f238.args.admin = "package_checker" From 9c00c6701519ccb1b5281212fe4cbd5f1f343df7 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 6 Feb 2024 21:34:42 +0100 Subject: [PATCH 39/51] Upgrade to v4.0.1.929 Changelog: https://github.com/Sonarr/Sonarr/releases/tag/v4.0.1.929 --- manifest.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/manifest.toml b/manifest.toml index 7a4e79c..0267a9b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Sonarr" description.en = "Series collection manager for Usenet and BitTorrent users" description.fr = "Gestionnaire de collection de séries pour utilisateurs de Usenet et BitTorrent" -version = "3.0.10.1567~ynh1" +version = "4.0.1.929~ynh1" maintainers = ["tituspijean"] @@ -45,12 +45,12 @@ ram.runtime = "50M" [resources] [resources.sources.main] - amd64.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.1047/Sonarr.develop.4.0.1.1047.linux-x64.tar.gz" - amd64.sha256 = "5ef17d1f14f18061072cf45f30162b4d2953561c0d1fa608476a605a6c44d3c5" - arm64.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.1047/Sonarr.develop.4.0.1.1047.linux-arm64.tar.gz" - arm64.sha256 = "ebc0bf30cb46cfffbf3c188c519ffce506633a5a865f916dc585aa2914af19af" - armhf.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.1047/Sonarr.develop.4.0.1.1047.linux-arm.tar.gz" - armhf.sha256 = "bc36a6ac9717abbc149b7974770d28b28c2d1b70a8484946fb21b80a3b476fb7" + amd64.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.929/Sonarr.main.4.0.1.929.linux-x64.tar.gz" + amd64.sha256 = "f58361ca1c679e7d827ac5cb247e42b3bc81f70db76140193eb93dbc41ef7af9" + arm64.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.929/Sonarr.main.4.0.1.929.linux-arm64.tar.gz" + arm64.sha256 = "4410b27e8ce60695ab9ac7cc71d6f506a7015e3eb808c0eb8293194f38fce594" + armhf.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.929/Sonarr.main.4.0.1.929.linux-arm.tar.gz" + armhf.sha256 = "8cea527a1d3414c9ee0ddcde76b3fd009c4d087b3a82d701f32e50797019cb93" autoupdate.strategy = "latest_github_release" autoupdate.asset.amd64 = ".*\\.linux-x64.tar.gz" From 923ac4e8ce9f0bc51dc312efd7a4af9461a58e03 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 6 Feb 2024 20:34:45 +0000 Subject: [PATCH 40/51] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0b20a1d..5923a7f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Sonarr is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new episodes of your favorite shows and will grab, sort and rename them. It can also be configured to automatically upgrade the quality of files already downloaded when a better quality format becomes available. -**Shipped version:** 3.0.10.1567~ynh1 +**Shipped version:** 4.0.1.929~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index e05936e..f47b5a9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Sonarr est un PVR pour les utilisateurs Usenet et BitTorrent. Il peut surveiller plusieurs flux RSS pour les nouveaux épisodes de vos émissions préférées et les récupérer, les trier et les renommer. Il peut également être configuré pour mettre à niveau automatiquement la qualité des fichiers déjà téléchargés lorsqu'un format de meilleure qualité devient disponible. -**Version incluse :** 3.0.10.1567~ynh1 +**Version incluse :** 4.0.1.929~ynh1 ## Captures d’écran From d7cd8376fd837c2966569b372dd87b898ce1a8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 6 Feb 2024 23:39:04 +0100 Subject: [PATCH 41/51] Add test_upgrade_from packaging v1 --- tests.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests.toml b/tests.toml index 953b195..63a9ef0 100644 --- a/tests.toml +++ b/tests.toml @@ -7,3 +7,5 @@ test_format = 1.0 # ------------ # Tests to run # ------------ + + test_upgrade_from.768c1ce50ab30dd77f8863cf68269038a0f0f238.name = "Last packaging v1 version" From 9bb440a2c51194eb21240344a2562e57330518fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 8 Feb 2024 12:21:56 +0100 Subject: [PATCH 42/51] Update manifest.toml --- manifest.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/manifest.toml b/manifest.toml index 0267a9b..a06e205 100644 --- a/manifest.toml +++ b/manifest.toml @@ -38,11 +38,6 @@ ram.runtime = "50M" type = "path" default = "/sonarr" - [install.init_main_permission] - type = "group" - default = "admins" - help = "This app is only protected by YunoHost's SSO, so do not make it accessible by visitors." - [resources] [resources.sources.main] amd64.url = "https://github.com/Sonarr/Sonarr/releases/download/v4.0.1.929/Sonarr.main.4.0.1.929.linux-x64.tar.gz" @@ -68,6 +63,7 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" + main.allowed = "admins" api.url = "/api" api.allowed = "visitors" api.show_tile = false From be7cb6871432eb9217b53b1ae270645da01c155b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 8 Feb 2024 12:23:14 +0100 Subject: [PATCH 43/51] Update tests.toml --- tests.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests.toml b/tests.toml index 63a9ef0..af7e527 100644 --- a/tests.toml +++ b/tests.toml @@ -4,6 +4,12 @@ test_format = 1.0 [default] + # ------------------------------- + # Default args to use for install + # ------------------------------- + + admin="john" + # ------------ # Tests to run # ------------ From fc851052797e9df34fa17bf40a13877f4fcc93b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 15 Feb 2024 16:14:16 +0100 Subject: [PATCH 44/51] Fix tests.toml args --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index af7e527..1dca029 100644 --- a/tests.toml +++ b/tests.toml @@ -8,7 +8,7 @@ test_format = 1.0 # Default args to use for install # ------------------------------- - admin="john" + args.admin="john" # ------------ # Tests to run From 384202262f0e9ae69f7f0dc336db99780637b159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 13 Mar 2024 15:20:24 +0100 Subject: [PATCH 45/51] Remove broken test_upgrade_from --- tests.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests.toml b/tests.toml index 1dca029..eecb3cf 100644 --- a/tests.toml +++ b/tests.toml @@ -13,5 +13,3 @@ test_format = 1.0 # ------------ # Tests to run # ------------ - - test_upgrade_from.768c1ce50ab30dd77f8863cf68269038a0f0f238.name = "Last packaging v1 version" From 3dfd1015c6dad3f04da54abbe2bb09a1c5057cf0 Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Sat, 30 Mar 2024 21:54:07 +0100 Subject: [PATCH 46/51] Remove `mono-runtime` dependency. --- manifest.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index a06e205..a222bd4 100644 --- a/manifest.toml +++ b/manifest.toml @@ -71,7 +71,6 @@ ram.runtime = "50M" [resources.apt] packages = [ - "mono-runtime", "sqlite3", "dirmngr", "mediainfo", From dd26b3c68ed692f8c4b7a9ffc62dbccf2e5d8f06 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 31 Mar 2024 09:48:19 +0000 Subject: [PATCH 47/51] Auto-update READMEs --- ALL_README.md | 6 ++++++ README.md | 24 ++++++++++++------------ README_fr.md | 30 +++++++++++++++--------------- README_gl.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ README_it.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 129 insertions(+), 27 deletions(-) create mode 100644 ALL_README.md create mode 100644 README_gl.md create mode 100644 README_it.md diff --git a/ALL_README.md b/ALL_README.md new file mode 100644 index 0000000..3d6c579 --- /dev/null +++ b/ALL_README.md @@ -0,0 +1,6 @@ +# All available README files by language + +- [Read the README in English](README.md) +- [Lire le README en français](README_fr.md) +- [Le o README en galego](README_gl.md) +- [Leggi il “README” in italiano](README_it.md) diff --git a/README.md b/README.md index 5923a7f..4153371 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -9,10 +9,10 @@ It shall NOT be edited by hand. [![Install Sonarr with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sonarr) -*[Lire ce readme en français.](./README_fr.md)* +*[Read this README is other languages.](./ALL_README.md)* -> *This package allows you to install Sonarr 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.* +> *This package allows you to install Sonarr 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 @@ -27,19 +27,19 @@ Sonarr is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS fee ## Documentation and resources -* Official app website: -* Official admin documentation: -* Upstream app code repository: -* YunoHost Store: -* Report a bug: +- Official app website: +- Official admin documentation: +- Upstream app code repository: +- YunoHost Store: +- Report a bug: ## Developer info -Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing). +Please send your pull request to the [`testing` branch](https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing). -To try the testing branch, please proceed like that. +To try the `testing` branch, please proceed like that: -``` bash +```bash sudo yunohost app install https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing --debug or sudo yunohost app upgrade sonarr -u https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing --debug diff --git a/README_fr.md b/README_fr.md index f47b5a9..ab4b742 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,6 +1,6 @@ # Sonarr pour YunoHost @@ -9,17 +9,17 @@ It shall NOT be edited by hand. [![Installer Sonarr avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sonarr) -*[Read this readme in english.](./README.md)* +*[Lire le README dans d'autres langues.](./ALL_README.md)* -> *Ce package vous permet d’installer Sonarr 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 Sonarr rapidement et simplement sur un serveur YunoHost.* +> *Si vous n’avez pas YunoHost, consultez [ce guide](https://yunohost.org/install) pour savoir comment l’installer et en profiter.* ## Vue d’ensemble Sonarr est un PVR pour les utilisateurs Usenet et BitTorrent. Il peut surveiller plusieurs flux RSS pour les nouveaux épisodes de vos émissions préférées et les récupérer, les trier et les renommer. Il peut également être configuré pour mettre à niveau automatiquement la qualité des fichiers déjà téléchargés lorsqu'un format de meilleure qualité devient disponible. -**Version incluse :** 4.0.1.929~ynh1 +**Version incluse :** 4.0.1.929~ynh1 ## Captures d’écran @@ -27,22 +27,22 @@ Sonarr est un PVR pour les utilisateurs Usenet et BitTorrent. Il peut surveiller ## Documentations et ressources -* Site officiel de l’app : -* Documentation officielle de l’admin : -* Dépôt de code officiel de l’app : -* YunoHost Store: -* Signaler un bug : +- Site officiel de l’app : +- Documentation officielle de l’admin : +- Dépôt de code officiel de l’app : +- YunoHost Store : +- Signaler un bug : ## Informations pour les développeurs -Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing). +Merci de faire vos pull request sur la [branche `testing`](https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing). -Pour essayer la branche testing, procédez comme suit. +Pour essayer la branche `testing`, procédez comme suit : -``` bash +```bash sudo yunohost app install https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing --debug ou sudo yunohost app upgrade sonarr -u https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing --debug ``` -**Plus d’infos sur le packaging d’applications :** \ No newline at end of file +**Plus d’infos sur le packaging d’applications :** diff --git a/README_gl.md b/README_gl.md new file mode 100644 index 0000000..2e3b307 --- /dev/null +++ b/README_gl.md @@ -0,0 +1,48 @@ + + +# Sonarr para YunoHost + +[![Nivel de integración](https://dash.yunohost.org/integration/sonarr.svg)](https://dash.yunohost.org/appci/app/sonarr) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/sonarr.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/sonarr.maintain.svg) + +[![Instalar Sonarr con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sonarr) + +*[Le este README en outros idiomas.](./ALL_README.md)* + +> *Este paquete permíteche instalar Sonarr de xeito rápido e doado nun servidor YunoHost.* +> *Se non usas YunoHost, le a [documentación](https://yunohost.org/install) para saber como instalalo.* + +## Vista xeral + +Sonarr is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new episodes of your favorite shows and will grab, sort and rename them. It can also be configured to automatically upgrade the quality of files already downloaded when a better quality format becomes available. + + +**Versión proporcionada:** 4.0.1.929~ynh1 + +## Capturas de pantalla + +![Captura de pantalla de Sonarr](./doc/screenshots/screenshot.jpg) + +## Documentación e recursos + +- Web oficial da app: +- Documentación oficial para admin: +- Repositorio de orixe do código: +- Tenda YunoHost: +- Informar dun problema: + +## Info de desenvolvemento + +Envía a túa colaboración á [rama `testing`](https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing). + +Para probar a rama `testing`, procede deste xeito: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing --debug +ou +sudo yunohost app upgrade sonarr -u https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing --debug +``` + +**Máis info sobre o empaquetado da app:** diff --git a/README_it.md b/README_it.md new file mode 100644 index 0000000..50ea087 --- /dev/null +++ b/README_it.md @@ -0,0 +1,48 @@ + + +# Sonarr per YunoHost + +[![Livello di integrazione](https://dash.yunohost.org/integration/sonarr.svg)](https://dash.yunohost.org/appci/app/sonarr) ![Stato di funzionamento](https://ci-apps.yunohost.org/ci/badges/sonarr.status.svg) ![Stato di manutenzione](https://ci-apps.yunohost.org/ci/badges/sonarr.maintain.svg) + +[![Installa Sonarr con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sonarr) + +*[Leggi questo README in altre lingue.](./ALL_README.md)* + +> *Questo pacchetto ti permette di installare Sonarr su un server YunoHost in modo semplice e veloce.* +> *Se non hai YunoHost, consulta [la guida](https://yunohost.org/install) per imparare a installarlo.* + +## Panoramica + +Sonarr is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new episodes of your favorite shows and will grab, sort and rename them. It can also be configured to automatically upgrade the quality of files already downloaded when a better quality format becomes available. + + +**Versione pubblicata:** 4.0.1.929~ynh1 + +## Screenshot + +![Screenshot di Sonarr](./doc/screenshots/screenshot.jpg) + +## Documentazione e risorse + +- Sito web ufficiale dell’app: +- Documentazione ufficiale per gli amministratori: +- Repository upstream del codice dell’app: +- Store di YunoHost: +- Segnala un problema: + +## Informazioni per sviluppatori + +Si prega di inviare la tua pull request alla [branch di `testing`](https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing). + +Per provare la branch di `testing`, si prega di procedere in questo modo: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing --debug +o +sudo yunohost app upgrade sonarr -u https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing --debug +``` + +**Maggiori informazioni riguardo il pacchetto di quest’app:** From 14f5b503be728b1333608349e35d36ca5c84af4d Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 31 Mar 2024 11:57:48 +0200 Subject: [PATCH 48/51] Make sure the internal auth system is disabled (#9) --- conf/config.xml | 8 +++++++- doc/POST_UPGRADE.d/4.0.1.929~ynh1.md | 5 +++++ scripts/upgrade | 11 +++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 doc/POST_UPGRADE.d/4.0.1.929~ynh1.md diff --git a/conf/config.xml b/conf/config.xml index 1dc6255..a717392 100644 --- a/conf/config.xml +++ b/conf/config.xml @@ -6,7 +6,13 @@ __PATH__ 127.0.0.1 __API_KEY__ - None + External BuiltIn main + False + False + Sonarr + DisabledForLocalAddresses + + diff --git a/doc/POST_UPGRADE.d/4.0.1.929~ynh1.md b/doc/POST_UPGRADE.d/4.0.1.929~ynh1.md new file mode 100644 index 0000000..6f244af --- /dev/null +++ b/doc/POST_UPGRADE.d/4.0.1.929~ynh1.md @@ -0,0 +1,5 @@ +The app's `__DATA_DIR__/config.xml` will now be overidden upon every upgrade. This is to make sure the internal authentication system is disabled, since you can benefit from YunoHost's permission system. + +In most use cases it should be fine. If you do need to alter the file, refer to the hooks system. + +If you altered the file, a backup has been made in `__DATA_DIR__`. diff --git a/scripts/upgrade b/scripts/upgrade index 53fef36..c1b1b36 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,6 +55,17 @@ yunohost service add "$app" --description="Sonarr daemon" --log="/var/log/$app/s # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append --logfile="/var/log/$app/" +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring Radarr..." --weight=2 + +ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" + +chmod 750 "$data_dir" +chmod -R o-rwx "$data_dir" +chown -R "$app:$app" "$data_dir" + #================================================= # START SYSTEMD SERVICE #================================================= From b4e26eb3a1a3433a047b30e488e50440bb0c2fe9 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 31 Mar 2024 12:14:25 +0200 Subject: [PATCH 49/51] Allow self-updates, add warning about it --- conf/systemd.service | 3 ++- doc/ADMIN.md | 3 +-- doc/ADMIN_fr.md | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 31f1b5e..39c9c46 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -34,7 +34,8 @@ ProtectKernelModules=yes ProtectKernelTunables=yes LockPersonality=yes SystemCallArchitectures=native -SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged +# Removing @privileged to allow self-update +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation # Denying access to capabilities that should not be relevant for webapps # Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 382152b..9e8f155 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,5 +1,4 @@ -* Sonarr developper's repository only allows to download the very latest version. - * The version displayed here may be different from the one actually installed. +* Sonarr has an internal self-upgrade system that has proven to be reliable with YunoHost's package. You may use it, though remember that there will be a discrepancy between Sonarr's actual version and the one known by YunoHost. * Access control is done with YunoHost's permissions system. * API (`__DOMAIN__/__PATH__/api`) can be accessed by visitors to allow control by remote clients. * The app uses YunoHost's multimedia directories, hence it has write access to users' and shared directories in `/home/yunohost.multimedia`. After installation, you can choose these directories to store your media. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 49e767f..fec126c 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,5 +1,4 @@ -* Le dépôt des développeurs de Sonarr ne permet de télécharger que la toute dernière version. - * La version annoncée ici peut être différente de celle réellement installée. +* Sonarr a un système de mise à jour interne qui s'est montré compatible avec le package YunoHost. Vous pouvez l'utiliser, mais rappelez-vous que la version de Sonarr sera différente de celle connue de YunoHost. * Le contrôle de l'accès se fait avec le système de permissions de YunoHost. * L'API (`__DOMAIN__/__PATH__/api`) est accessible aux visiteurs pour permettre le contrôle via des clients externes. * L'application utilise les dossiers multimédia de YunoHost, elle a donc accès en écriture aux dossiers utilisateurs et communs de `/home/yunohost.multimedia`. Après installation, vous pourrez choisir ces dossiers pour y stocker vos médias. From b6f5b0ac0fee593bce11fcc8286a5f620dc5bbec Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 4 Apr 2024 23:09:06 +0200 Subject: [PATCH 50/51] Circumvent missing new line in config.xml Co-authored-by: Salamandar <6552989+Salamandar@users.noreply.github.com> --- scripts/change_url | 5 ++++- scripts/upgrade | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index b7bcef0..0b00c85 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,7 +31,10 @@ ynh_change_url_nginx_config # UPDATE CONFIGURATION FILE #================================================= -ynh_exec_warn_less ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" +# Add newline at end of file if required +sed -i -e '$a\' "$data_dir/config.xml" + +ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" chown "$app:$app" "$data_dir/config.xml" diff --git a/scripts/upgrade b/scripts/upgrade index c1b1b36..7ae6a1c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -60,6 +60,9 @@ ynh_use_logrotate --non-append --logfile="/var/log/$app/" #================================================= ynh_script_progression --message="Configuring Radarr..." --weight=2 +# Add newline at end of file if required +sed -i -e '$a\' "$data_dir/config.xml" + ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" chmod 750 "$data_dir" From 9e1ee29271de42d65a1cd4024f1c50f82d84b983 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 4 Apr 2024 21:09:35 +0000 Subject: [PATCH 51/51] Auto-update READMEs --- ALL_README.md | 2 +- README.md | 2 +- README_eu.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 README_eu.md diff --git a/ALL_README.md b/ALL_README.md index 3d6c579..77b7509 100644 --- a/ALL_README.md +++ b/ALL_README.md @@ -1,6 +1,6 @@ # All available README files by language - [Read the README in English](README.md) +- [Irakurri README euskaraz](README_eu.md) - [Lire le README en français](README_fr.md) - [Le o README en galego](README_gl.md) -- [Leggi il “README” in italiano](README_it.md) diff --git a/README.md b/README.md index 4153371..7f5a9f0 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ It shall NOT be edited by hand. [![Install Sonarr with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sonarr) -*[Read this README is other languages.](./ALL_README.md)* +*[Read this README in other languages.](./ALL_README.md)* > *This package allows you to install Sonarr 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.* diff --git a/README_eu.md b/README_eu.md new file mode 100644 index 0000000..251c518 --- /dev/null +++ b/README_eu.md @@ -0,0 +1,48 @@ + + +# Sonarr YunoHost-erako + +[![Integrazio maila](https://dash.yunohost.org/integration/sonarr.svg)](https://dash.yunohost.org/appci/app/sonarr) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/sonarr.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/sonarr.maintain.svg) + +[![Instalatu Sonarr YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=sonarr) + +*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)* + +> *Pakete honek Sonarr YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.* +> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.* + +## Aurreikuspena + +Sonarr is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new episodes of your favorite shows and will grab, sort and rename them. It can also be configured to automatically upgrade the quality of files already downloaded when a better quality format becomes available. + + +**Paketatutako bertsioa:** 4.0.1.929~ynh1 + +## Pantaila-argazkiak + +![Sonarr(r)en pantaila-argazkia](./doc/screenshots/screenshot.jpg) + +## Dokumentazioa eta baliabideak + +- Aplikazioaren webgune ofiziala: +- Administratzaileen dokumentazio ofiziala: +- Jatorrizko aplikazioaren kode-gordailua: +- YunoHost Denda: +- Eman errore baten berri: + +## Garatzaileentzako informazioa + +Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing). + +`testing` abarra probatzeko, ondorengoa egin: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing --debug +edo +sudo yunohost app upgrade sonarr -u https://github.com/YunoHost-Apps/sonarr_ynh/tree/testing --debug +``` + +**Informazio gehiago aplikazioaren paketatzeari buruz:**