From ef0c7cfb8d6452165f1f640c5506e778326fc55a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Nov 2023 18:03:06 +0100 Subject: [PATCH 01/26] v2 --- conf/app.arm.src | 5 --- conf/app.arm64.src | 5 --- conf/app.x64.src | 5 --- conf/systemd.service | 4 +-- manifest.toml | 59 +++++++++++++++++++++++++++++++++++ scripts/_common.sh | 2 +- scripts/backup | 16 +++++----- scripts/change_url | 74 +++++++++++++++++++++++--------------------- scripts/install | 64 +++++++++++++++++++------------------- scripts/remove | 24 +++++++------- scripts/restore | 38 +++++++++++------------ scripts/upgrade | 56 ++++++++++++++++----------------- 12 files changed, 199 insertions(+), 153 deletions(-) delete mode 100644 conf/app.arm.src delete mode 100644 conf/app.arm64.src delete mode 100644 conf/app.x64.src create mode 100644 manifest.toml diff --git a/conf/app.arm.src b/conf/app.arm.src deleted file mode 100644 index 11b777e..0000000 --- a/conf/app.arm.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.13.1.4243/Prowlarr.develop.1.13.1.4243.linux-core-arm.tar.gz -SOURCE_SUM=3ab301d2e72bfa5334c53da55dd56ce91f77805fc0dd6a061646fdcae8779d33 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true diff --git a/conf/app.arm64.src b/conf/app.arm64.src deleted file mode 100644 index bd659fc..0000000 --- a/conf/app.arm64.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.13.1.4243/Prowlarr.develop.1.13.1.4243.linux-core-arm64.tar.gz -SOURCE_SUM=1ef7ca4f6b5e5db7157b1be626fa1beddc36e73ce1e873a8d0a0c361b8dc6c9c -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true diff --git a/conf/app.x64.src b/conf/app.x64.src deleted file mode 100644 index d848d47..0000000 --- a/conf/app.x64.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.13.1.4243/Prowlarr.develop.1.13.1.4243.linux-core-x64.tar.gz -SOURCE_SUM=20e14f37b64ca8b95189e24d46719086224d889dc6e77cce1729b6ec5f4ccfba -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.gz -SOURCE_IN_SUBDIR=true diff --git a/conf/systemd.service b/conf/systemd.service index 33e3501..3a169e7 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,8 +6,8 @@ After=syslog.target network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/Prowlarr -nobrowser -data=__DATA_PATH__ +WorkingDirectory=__INSTALL_DIR__/ +ExecStart=__INSTALL_DIR__/Prowlarr -nobrowser -data=__DATA_PATH__ TimeoutStopSec=20 KillMode=process diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..658b8fd --- /dev/null +++ b/manifest.toml @@ -0,0 +1,59 @@ +packaging_format = 2 + +id = "prowlarr" +name = "Prowlarr" +description.en = "Complete management of your indexers for Radarr, Sonarr, Lidarr..." +description.fr = "Gestion complète de vos indexeurs pour Radarr, Sonarr, Lidarr..." + +version = "1.10.3.4070~ynh1" + +maintainers = ["tituspijean"] + +[upstream] +license = "GPL-3.0-only" +website = "https://prowlarr.com" +admindoc = "https://wiki.servarr.com/prowlarr" +code = "https://github.com/Prowlarr/Prowlarr" +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 = ">= 11.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 = "/prowlarr" + + [install.admin] + # this is a generic question - ask strings are automatically handled by Yunohost's core + type = "user" + +[resources] + [resources.sources.main] + armhf.url = "https://github.com/Prowlarr/Prowlarr/releases/download/v1.10.3.4070/Prowlarr.develop.1.10.3.4070.linux-core-arm.tar.gz" + armhf.sha256 = "4fe1f010685ebdae99f02920c124d3f83fa4f1daa89ac9fb111f82ae3b4529a3" + arm64.url = "https://github.com/Prowlarr/Prowlarr/releases/download/v1.10.3.4070/Prowlarr.develop.1.10.3.4070.linux-core-arm64.tar.gz" + arm64.sha256 = "8ef3cbe1b4af9e3604209c52d2c413f4bcab3958022140c369fe04944da7440e" + amd64.url = "https://github.com/Prowlarr/Prowlarr/releases/download/v1.10.3.4070/Prowlarr.develop.1.10.3.4070.linux-core-x64.tar.gz" + amd64.sha256 = "c185f08bd6ea522d93c3145c4f4af332a4dc5cc579c109a3c1ea3b87a5668cd6" + + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index 87d05f0..2a5ea2a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,7 +10,7 @@ version="0.8.1.2135" supported_architectures=("arm" "arm64" "x64") # dependencies used by the app -pkg_dependencies="curl mediainfo sqlite3" +#REMOVEME? pkg_dependencies="curl mediainfo sqlite3" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 8555a32..f9c07a4 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,23 +14,23 @@ 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) -data_path=$(ynh_app_setting_get --app=$app --key=data_path) -domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? data_path=$(ynh_app_setting_get --app=$app --key=data_path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -46,7 +46,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 APP DATA DIR diff --git a/scripts/change_url b/scripts/change_url index 179512f..abcb60e 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,56 +13,56 @@ 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..." --time --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --time --weight=1 -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -data_path=$(ynh_app_setting_get --app=$app --key=data_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? data_path=$(ynh_app_setting_get --app=$app --key=data_path) +#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)..." --time --weight=1 +#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --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 #================================================= @@ -79,32 +79,34 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --time --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" - path="$new_path" +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" +#REMOVEME? path="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config +#REMOVEME? ynh_add_nginx_config else - path_url="$old_path" - path="$old_path" +#REMOVEME? path="$old_path" +#REMOVEME? path="$old_path" 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 #================================================= @@ -131,9 +133,9 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --time --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 0b74b18..efd2847 100755 --- a/scripts/install +++ b/scripts/install @@ -13,71 +13,71 @@ 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 #================================================= # 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=/opt/yunohost/$app -test ! -e "$final_path" || ynh_die --message="Installation path ($final_path) already exists" +#REMOVEME? install_dir=/opt/yunohost/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="Installation path ($install_dir) already exists" data_path=/home/yunohost.app/$app test ! -e "$data_path" || ynh_die --message="Data directory ($data_path) already exists" # 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_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" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -86,11 +86,11 @@ ynh_script_progression --message="Setting up source files..." --weight=3 get_architecture -ynh_app_setting_set --app=$app --key=final_path --value=$final_path +#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" --source_id="app.$architecture" +ynh_setup_source --dest_dir="$install_dir" -ynh_app_setting_set --app=$app --key=data_path --value=$data_path +#REMOVEME? ynh_app_setting_set --app=$app --key=data_path --value=$data_path mkdir -p "$data_path/logs" #================================================= @@ -126,9 +126,9 @@ ynh_add_config --template="../conf/config.xml" --destination="$data_path/config. #================================================= ynh_script_progression --message="Setting files permissions and ownership..." --weight=1 -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app: "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app: "$install_dir" chmod 750 "$data_path" chmod -R o-rwx "$data_path" @@ -179,18 +179,18 @@ ynh_store_file_checksum --file="$data_path/config.xml" #================================================= # 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 582f1c6..fdffcf9 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,14 +12,14 @@ 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) -data_path=$(ynh_app_setting_get --app=$app --key=data_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) +#REMOVEME? data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= # STANDARD REMOVE @@ -45,18 +45,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 APP DATA DIR @@ -107,10 +107,10 @@ ynh_secure_remove --file="/var/log/$app" #================================================= # 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 4f476fc..b8dbfed 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,32 +14,32 @@ 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) -data_path=$(ynh_app_setting_get --app=$app --key=data_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) +#REMOVEME? data_path=$(ynh_app_setting_get --app=$app --key=data_path) #================================================= # 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 " test ! -d $data_path \ || ynh_die --message="There is already a directory: $data_path " @@ -56,21 +56,21 @@ 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" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app: "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app: "$install_dir" #================================================= # RESTORE THE APP DATA DIR @@ -101,10 +101,10 @@ 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_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 976e60b..8ccc051 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,17 +12,17 @@ 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) -data_path=$(ynh_app_setting_get --app=$app --key=data_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? data_path=$(ynh_app_setting_get --app=$app --key=data_path) +#REMOVEME? api_key=$(ynh_app_setting_get --app=$app --key=api_key) #================================================= # CHECK VERSION @@ -39,16 +39,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 @@ -65,24 +65,24 @@ 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 # Move data directory if needed if [ -z "$data_path" ]; then data_path=/home/yunohost.app/$app - ynh_app_setting_set --app=$app --key=data_path --value=$data_path - mv "$final_path/.data" "/home/yunohost.app/$app" +#REMOVEME? ynh_app_setting_set --app=$app --key=data_path --value=$data_path + mv "$install_dir/.data" "/home/yunohost.app/$app" 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" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -95,12 +95,12 @@ then get_architecture # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --source_id="app.$architecture" + ynh_setup_source --dest_dir="$install_dir" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app: "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app: "$install_dir" mkdir -p "$data_path/logs" chmod 750 "$data_path" @@ -118,9 +118,9 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=4 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=4 -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC UPGRADE @@ -173,9 +173,9 @@ ynh_store_file_checksum --file="$data_path/config.xml" #================================================= # 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 f5bc0d1f3a900d0553481eebe246968217560d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Nov 2023 18:18:03 +0100 Subject: [PATCH 02/26] v2 --- .github/workflows/updater.sh | 137 ---------------------------------- .github/workflows/updater.yml | 50 ------------- check_process | 30 -------- conf/systemd.service | 2 +- doc/DISCLAIMER.md | 3 +- doc/DISCLAIMER_fr.md | 3 +- manifest.json | 47 ------------ manifest.toml | 34 ++++++--- scripts/backup | 30 +------- scripts/change_url | 99 +----------------------- scripts/install | 131 +++----------------------------- scripts/remove | 81 -------------------- scripts/restore | 109 +++------------------------ scripts/upgrade | 107 ++------------------------ tests.toml | 3 + 15 files changed, 62 insertions(+), 804 deletions(-) delete mode 100644 .github/workflows/updater.sh delete mode 100644 .github/workflows/updater.yml delete mode 100644 check_process delete mode 100644 manifest.json create mode 100644 tests.toml diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh deleted file mode 100644 index 7e167ee..0000000 --- a/.github/workflows/updater.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash - -#================================================= -# PACKAGE UPDATING HELPER -#================================================= - -# This script is meant to be run by GitHub Actions -# The YunoHost-Apps organisation offers a template Action to run this script periodically -# Since each app is different, maintainers can adapt its contents so as to perform -# automatic actions when a new upstream release is detected. - -#================================================= -# FETCHING LATEST RELEASE AND ITS ASSETS -#================================================= - -# Fetching information -current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') -repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') -# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) -# TODO: Add `| select( .prerelease != true )` when stable releases are available -version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | .tag_name' | sort -V | tail -1) -assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) - -# Later down the script, we assume the version has only digits and dots -# Sometimes the release name starts with a "v", so let's filter it out. -# You may need more tweaks here if the upstream repository has different naming conventions. -if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then - version=${version:1} -fi - -# Setting up the environment variables -echo "Current version: $current_version" -echo "Latest release from upstream: $version" -echo "VERSION=$version" >> $GITHUB_ENV -# For the time being, let's assume the script will fail -echo "PROCEED=false" >> $GITHUB_ENV - -# Proceed only if the retrieved version is greater than the current one -if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then - echo "::warning ::No new version available" - exit 0 -# Proceed only if a PR for this new version does not already exist -elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then - echo "::warning ::A branch already exists for this update" - exit 0 -fi - -# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) -echo "${#assets[@]} available asset(s)" - -#================================================= -# UPDATE SOURCE FILES -#================================================= - -# Here we use the $assets variable to get the resources published in the upstream release. -# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. - -# Let's loop over the array of assets URLs -for asset_url in ${assets[@]}; do - -echo "Handling asset at $asset_url" - -# Assign the asset to a source file in conf/ directory -# Here we base the source file name upon a unique keyword in the assets url (admin vs. update) -# Leave $src empty to ignore the asset -case $asset_url in - *"linux-core-arm.tar.gz") - src="app.arm" - ;; - *"linux-core-arm64.tar.gz") - src="app.arm64" - ;; - *"linux-core-x64.tar.gz") - src="app.x64" - ;; - *) - src="" - ;; -esac - -# If $src is not empty, let's process the asset -if [ ! -z "$src" ]; then - -# Create the temporary directory -tempdir="$(mktemp -d)" - -# Download sources and calculate checksum -filename=${asset_url##*/} -curl --silent -4 -L $asset_url -o "$tempdir/$filename" -checksum=$(sha256sum "$tempdir/$filename" | head -c 64) - -# Delete temporary directory -rm -rf $tempdir - -# Get extension -if [[ $filename == *.tar.gz ]]; then - extension=tar.gz -else - extension=${filename##*.} -fi - -# Rewrite source file -cat < conf/$src.src -SOURCE_URL=$asset_url -SOURCE_SUM=$checksum -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=$extension -SOURCE_IN_SUBDIR=true -EOT -echo "... conf/$src.src updated" - -else -echo "... asset ignored" -fi - -done - -#================================================= -# SPECIFIC UPDATE STEPS -#================================================= - -# Any action on the app's source code can be done. -# The GitHub Action workflow takes care of committing all changes after this script ends. - -#================================================= -# GENERIC FINALIZATION -#================================================= - -# Replace new version in manifest -echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json - -# No need to update the README, yunohost-bot takes care of it - -# The Action will proceed only if the PROCEED environment variable is set to true -echo "PROCEED=true" >> $GITHUB_ENV -exit 0 - diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml deleted file mode 100644 index a9ca97a..0000000 --- a/.github/workflows/updater.yml +++ /dev/null @@ -1,50 +0,0 @@ -# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. -# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. -# This file should be enough by itself, but feel free to tune it to your needs. -# It calls updater.sh, which is where you should put the app-specific update steps. -name: Check for new upstream releases -on: - # Allow to manually trigger the workflow - workflow_dispatch: - # Run it every day at 6:00 UTC - schedule: - - cron: '0 6 * * *' -jobs: - updater: - runs-on: ubuntu-latest - steps: - - name: Fetch the source code - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Run the updater script - id: run_updater - run: | - # Setting up Git user - git config --global user.name 'yunohost-bot' - git config --global user.email 'yunohost-bot@users.noreply.github.com' - # Run the updater script - /bin/bash .github/workflows/updater.sh - - name: Commit changes - id: commit - if: ${{ env.PROCEED == 'true' }} - run: | - git commit -am "Upgrade to v$VERSION" - - name: Create Pull Request - id: cpr - if: ${{ env.PROCEED == 'true' }} - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: Update to version ${{ env.VERSION }} - committer: 'yunohost-bot ' - author: 'yunohost-bot ' - signoff: false - branch: ci-auto-update-v${{ env.VERSION }} - base: testing - delete-branch: true - title: 'Upgrade to version ${{ env.VERSION }}' - body: | - Upgrade to v${{ env.VERSION }} - draft: false - diff --git a/check_process b/check_process deleted file mode 100644 index d804bfb..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=e0fcbf74138612f466fe0ce735060394245d8bb5 - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - ; commit=e0fcbf74138612f466fe0ce735060394245d8bb5 - name=2021-09-30 0.1.1.875~ynh1 - manifest_arg=domain=DOMAIN&path=PATH&admin=USER& diff --git a/conf/systemd.service b/conf/systemd.service index 3a169e7..c4c0a11 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ -ExecStart=__INSTALL_DIR__/Prowlarr -nobrowser -data=__DATA_PATH__ +ExecStart=__INSTALL_DIR__/Prowlarr -nobrowser -data=__DATA_DIR__ TimeoutStopSec=20 KillMode=process diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 2502870..0ded546 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,3 +1,2 @@ -* Supported architectures are `arm`, `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. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md index 1e71b63..eae4643 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DISCLAIMER_fr.md @@ -1,3 +1,2 @@ -* Les architectures compatibles sont `arm`, `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. diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 94db187..0000000 --- a/manifest.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "Prowlarr", - "id": "prowlarr", - "packaging_format": 1, - "description": { - "en": "Complete management of your indexers for Radarr, Sonarr, Lidarr...", - "fr": "Gestion complète de vos indexeurs pour Radarr, Sonarr, Lidarr..." - }, - "version": "1.13.1.4243~ynh1", - "url": "https://prowlarr.com", - "upstream": { - "license": "GPL-3.0-only", - "website": "https://prowlarr.com", - "admindoc": "https://wiki.servarr.com/prowlarr", - "code": "https://github.com/Prowlarr/Prowlarr" - }, - "license": "GPL-3.0-only", - "maintainer": { - "name": "tituspijean", - "email": "tituspijean@outlook.com" - }, - "requirements": { - "yunohost": ">= 11.2" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/prowlarr", - "default": "/prowlarr" - }, - { - "name": "admin", - "type": "user" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 658b8fd..c47ee7d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,31 +14,29 @@ license = "GPL-3.0-only" website = "https://prowlarr.com" admindoc = "https://wiki.servarr.com/prowlarr" code = "https://github.com/Prowlarr/Prowlarr" -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 = ">= 11.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"] +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 = "/prowlarr" [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [resources] @@ -55,5 +53,19 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.install_dir] + [resources.data_dir] + + [resources.ports] + [resources.permissions] main.url = "/" + main.allowed = "admins" + + api.url = "/api" + api.allowed = "visitors" + api.show_tile = false + api.protected = true + + [resources.apt] + packages = "curl, mediainfo, sqlite3" + \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index f9c07a4..ee3e43a 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,38 +10,11 @@ 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? data_path=$(ynh_app_setting_get --app=$app --key=data_path) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -52,7 +25,8 @@ ynh_backup --src_path="$install_dir" # BACKUP THE APP DATA DIR #================================================= -ynh_backup --src_path="$data_path" +# Only relevant if there is a "data_dir" resource for this app +ynh_backup --src_path="$data_dir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/change_url b/scripts/change_url index abcb60e..6b15eea 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,62 +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..." --time --weight=1 - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? data_path=$(ynh_app_setting_get --app=$app --key=data_path) -#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)..." --time --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 #================================================= @@ -81,45 +25,17 @@ 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" -#REMOVEME? path="$new_path" - # Create a dedicated NGINX config -#REMOVEME? ynh_add_nginx_config -else -#REMOVEME? path="$old_path" -#REMOVEME? path="$old_path" -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 #================================================= # UPDATE CONFIGURATION FILE #================================================= -ynh_exec_warn_less 'ynh_add_config --template="../conf/config.xml" --destination="$data_path/config.xml"' +ynh_exec_warn_less 'ynh_add_config --template="config.xml" --destination="$data_dir/config.xml"' -chmod 750 "$data_path/config.xml" -chmod o-rwx "$data_path/config.xml" -chown $app "$data_path/config.xml" +chmod 750 "$data_dir/config.xml" +chmod o-rwx "$data_dir/config.xml" +chown $app "$data_dir/config.xml" #================================================= # GENERIC FINALISATION @@ -130,13 +46,6 @@ ynh_script_progression --message="Starting a systemd service..." --time --weight ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index efd2847..9689d3a 100755 --- a/scripts/install +++ b/scripts/install @@ -9,89 +9,20 @@ source _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 - -#================================================= -# 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=/opt/yunohost/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="Installation path ($install_dir) already exists" - -data_path=/home/yunohost.app/$app -test ! -e "$data_path" || ynh_die --message="Data directory ($data_path) already exists" - -# 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_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" +api_key=$(ynh_string_random --length=32) +ynh_app_setting_set --app=$app --key=api_key --value=$api_key #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=3 -get_architecture - -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" +mkdir -p "$data_dir/logs" -#REMOVEME? ynh_app_setting_set --app=$app --key=data_path --value=$data_path -mkdir -p "$data_path/logs" +chmod -R o-rwx "$install_dir" +chown -R $app: "$install_dir" #================================================= # NGINX CONFIGURATION @@ -101,13 +32,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 - # Create a dedicated systemd config ynh_add_systemd_config @@ -116,26 +40,9 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Configuring Prowlarr..." --weight=2 -api_key=$(ynh_string_random --length=32) -ynh_app_setting_set --app=$app --key=api_key --value=$api_key - -ynh_add_config --template="../conf/config.xml" --destination="$data_path/config.xml" - -#================================================= -# SETUP FILE PERMISSIONS -#================================================= -ynh_script_progression --message="Setting files permissions and ownership..." --weight=1 - -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app: "$install_dir" - -chmod 750 "$data_path" -chmod -R o-rwx "$data_path" -chown -R $app: "$data_path" - -chmod 400 "$data_path/config.xml" -chown $app:$app "$data_path/config.xml" +ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" +chmod 400 "$data_dir/config.xml" +chown $app:$app "$data_dir/config.xml" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -156,14 +63,14 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate -ynh_use_logrotate --logfile="$data_path/logs" +ynh_use_logrotate --logfile="$data_dir/logs" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="Prowlarr daemon" --log="$data_path/logs/prowlarr.txt" +yunohost service add $app --description="Prowlarr daemon" --log="$data_dir/logs/prowlarr.txt" #================================================= # START SYSTEMD SERVICE @@ -174,23 +81,7 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" # FIXME Update config.xml checksum, for a mere file ending with or without a new line... -ynh_store_file_checksum --file="$data_path/config.xml" - -#================================================= -# 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 +ynh_store_file_checksum --file="$data_dir/config.xml" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index fdffcf9..d13cdf3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,18 +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) -#REMOVEME? data_path=$(ynh_app_setting_get --app=$app --key=data_path) - #================================================= # STANDARD REMOVE #================================================= @@ -34,84 +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 APP DATA DIR -#================================================= -ynh_script_progression --message="Removing app data directory..." --weight=1 - -# Remove the app directory securely -ynh_secure_remove --file="$data_path" - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." --weight=1 - -# Remove the log files -ynh_secure_remove --file="/var/log/$app" - -#================================================= -# 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 b8dbfed..f9efb6e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,57 +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) -#REMOVEME? data_path=$(ynh_app_setting_get --app=$app --key=data_path) - -#================================================= -# 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 " - -test ! -d $data_path \ - || ynh_die --message="There is already a directory: $data_path " - -#================================================= -# 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 #================================================= @@ -68,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" @@ -77,14 +25,14 @@ chown -R $app: "$install_dir" #================================================= ynh_script_progression --message="Restoring the app data directory..." --weight=2 -ynh_restore_file --origin_path="$data_path" +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -chmod 750 "$data_path" -chmod -R o-rwx "$data_path" -chown -R $app: "$data_path" +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service --quiet -chmod 400 "$data_path/config.xml" -chown $app:$app "$data_path/config.xml" +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + +yunohost service add $app --description="Prowlarr daemon" --log="$data_dir/logs/prowlarr.txt" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -96,31 +44,6 @@ ynh_multimedia_build_main_dir # Enable writing into these directories ynh_multimedia_addaccess $app -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=4 - -# Define and install dependencies -#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/systemd/system/$app.service" -systemctl enable $app.service --quiet - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Prowlarr daemon" --log="$data_path/logs/prowlarr.txt" - #================================================= # START SYSTEMD SERVICE #================================================= @@ -128,25 +51,11 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" -# FIXME Update config.xml checksum, for a mere file ending with or without a new line... -ynh_store_file_checksum --file="$data_path/config.xml" - -#================================================= -# 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 -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload +# FIXME Update config.xml checksum, for a mere file ending with or without a new line... +ynh_store_file_checksum --file="$data_dir/config.xml" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8ccc051..48c40f4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,47 +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? data_path=$(ynh_app_setting_get --app=$app --key=data_path) -#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 #================================================= @@ -59,31 +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 - -# Move data directory if needed -if [ -z "$data_path" ]; then - data_path=/home/yunohost.app/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=data_path --value=$data_path - mv "$install_dir/.data" "/home/yunohost.app/$app" -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" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -92,8 +32,6 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=3 - get_architecture - # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" fi @@ -102,11 +40,6 @@ chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" -mkdir -p "$data_path/logs" -chmod 750 "$data_path" -chmod -R o-rwx "$data_path" -chown -R $app: "$data_path" - #================================================= # NGINX CONFIGURATION #================================================= @@ -115,32 +48,20 @@ 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_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 +yunohost service add $app --description="Prowlarr daemon" --log="$data_dir/logs/prowlarr.txt" + #================================================= # UPDATE A CONFIG FILE #================================================= ynh_script_progression --message="Updating the configuration file.." --weight=1 -ynh_add_config --template="../conf/config.xml" --destination="$data_path/config.xml" +ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" -chmod 400 "$data_path/config.xml" -chown $app:$app "$data_path/config.xml" +chmod 400 "$data_dir/config.xml" +chown $app:$app "$data_dir/config.xml" #================================================= # GENERIC FINALIZATION @@ -151,14 +72,7 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --weight # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append -ynh_use_logrotate --non-append --logfile="$data_path/logs" - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Prowlarr daemon" --log="$data_path/logs/prowlarr.txt" +ynh_use_logrotate --non-append --logfile="$data_dir/logs" #================================================= # START SYSTEMD SERVICE @@ -168,14 +82,7 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" # FIXME Update config.xml checksum, for a mere file ending with or without a new line... -ynh_store_file_checksum --file="$data_path/config.xml" - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload +ynh_store_file_checksum --file="$data_dir/config.xml" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..cbbeef1 --- /dev/null +++ b/tests.toml @@ -0,0 +1,3 @@ +test_format = 1.0 + +[default] From 1edb1eb33ba81133081ea800e78f854789a48819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Nov 2023 18:19:00 +0100 Subject: [PATCH 03/26] Update _common.sh --- scripts/_common.sh | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 2a5ea2a..f6f8fb1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,29 +6,10 @@ version="0.8.1.2135" -# Supported architectures -supported_architectures=("arm" "arm64" "x64") - -# dependencies used by the app -#REMOVEME? pkg_dependencies="curl mediainfo sqlite3" - #================================================= # PERSONAL HELPERS #================================================= -get_architecture() { - architecture=$(dpkg --print-architecture) - if [ $architecture = "amd64" ]; then - architecture="x64" - elif [[ $architecture = arm* ]] && [[ $(getconf LONG_BIT) = 32 ]]; then - architecture="arm" - elif [[ $architecture = arm* ]] && [[ $(getconf LONG_BIT) = 64 ]]; then - architecture="arm64" - elif [[ $(echo ${supported_architectures[@]} | grep -ow "$architecture" | wc -w) = 0 ]]; then - ynh_die --message="Unsupported architecture $architecture" - fi -} - #================================================= # EXPERIMENTAL HELPERS #================================================= From b9d23e6f867b781949ce085ca7e3018a01727ffa Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 18 Nov 2023 17:18:07 +0000 Subject: [PATCH 04/26] Auto-update README --- README.md | 3 +-- README_fr.md | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0ac3b4a..7e5145a 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,8 @@ Complete management of your indexers for Radarr, Sonarr, Lidarr... ## Disclaimers / important information -* Supported architectures are `arm`, `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. ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index 6eccc4b..fbd747d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,9 +26,8 @@ Gestion complète de vos indexeurs pour Radarr, Sonarr, Lidarr... ## Avertissements / informations importantes -* Les architectures compatibles sont `arm`, `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. ## Documentations et ressources From 57c5cf15f8b22862f970446805261063970dd392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Nov 2023 18:36:03 +0100 Subject: [PATCH 05/26] cleaning --- doc/{DISCLAIMER.md => ADMIN.md} | 0 doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 0 doc/DESCRIPTION.fr.md | 1 + doc/DESCRIPTION.md | 1 + 4 files changed, 2 insertions(+) rename doc/{DISCLAIMER.md => ADMIN.md} (100%) rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (100%) create mode 100644 doc/DESCRIPTION.fr.md create mode 100644 doc/DESCRIPTION.md diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 100% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md diff --git a/doc/DESCRIPTION.fr.md b/doc/DESCRIPTION.fr.md new file mode 100644 index 0000000..033f326 --- /dev/null +++ b/doc/DESCRIPTION.fr.md @@ -0,0 +1 @@ +Gestion complète de vos indexeurs pour Radarr, Sonarr, Lidarr... \ No newline at end of file diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..33197e1 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +Complete management of your indexers for Radarr, Sonarr, Lidarr... \ No newline at end of file From b20ac9a77ab73a67630cb18fc1d0adc6bb2f0101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Nov 2023 18:39:42 +0100 Subject: [PATCH 06/26] cleaning --- scripts/change_url | 16 +++++++--------- scripts/restore | 4 ++-- scripts/upgrade | 1 - 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 6b15eea..5f4466a 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -14,14 +14,14 @@ source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_change_url_nginx_config @@ -31,18 +31,16 @@ ynh_change_url_nginx_config # UPDATE CONFIGURATION FILE #================================================= -ynh_exec_warn_less 'ynh_add_config --template="config.xml" --destination="$data_dir/config.xml"' - -chmod 750 "$data_dir/config.xml" -chmod o-rwx "$data_dir/config.xml" -chown $app "$data_dir/config.xml" +ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" +chmod 400 "$data_dir/config.xml" +chown $app:$app "$data_dir/config.xml" #================================================= # GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" @@ -50,4 +48,4 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/restore b/scripts/restore index f9efb6e..3fb68bd 100755 --- a/scripts/restore +++ b/scripts/restore @@ -21,9 +21,9 @@ chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" #================================================= -# RESTORE THE APP DATA DIR +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring the app data directory..." --weight=2 +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" diff --git a/scripts/upgrade b/scripts/upgrade index 48c40f4..efe314d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -36,7 +36,6 @@ then ynh_setup_source --dest_dir="$install_dir" fi -chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" From 397e88292db013f102883dd5eb1a05b6c05d47a7 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 18 Nov 2023 17:36:08 +0000 Subject: [PATCH 07/26] Auto-update README --- README.md | 5 ----- README_fr.md | 7 +------ 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/README.md b/README.md index 7e5145a..e05bfe2 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,6 @@ Complete management of your indexers for Radarr, Sonarr, Lidarr... ![Screenshot of Prowlarr](./doc/screenshots/screenshot.jpg) -## Disclaimers / important information - -* Access control is done with YunoHost's permissions system. - * API (`__DOMAIN____PATH__/api`) can be accessed by visitors to allow control by remote clients. - ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index fbd747d..081de3f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,7 +16,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -Gestion complète de vos indexeurs pour Radarr, Sonarr, Lidarr... +Complete management of your indexers for Radarr, Sonarr, Lidarr... **Version incluse :** 1.13.1.4243~ynh1 @@ -24,11 +24,6 @@ Gestion complète de vos indexeurs pour Radarr, Sonarr, Lidarr... ![Capture d’écran de Prowlarr](./doc/screenshots/screenshot.jpg) -## Avertissements / informations importantes - -* 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. - ## Documentations et ressources * Site officiel de l’app : From 85ecb3367ad771ed3f5a83fab327e3cc718f8548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Nov 2023 18:41:22 +0100 Subject: [PATCH 08/26] cleaning --- scripts/remove | 5 +++-- scripts/upgrade | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/remove b/scripts/remove index d13cdf3..5a8d063 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,10 +10,11 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE +# REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEMD SERVICE #================================================= +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 diff --git a/scripts/upgrade b/scripts/upgrade index efe314d..51f12f0 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,9 +40,9 @@ chmod -R o-rwx "$install_dir" chown -R $app: "$install_dir" #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -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 @@ -55,7 +55,7 @@ yunohost service add $app --description="Prowlarr daemon" --log="$data_dir/logs/ #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating the configuration file.." --weight=1 +ynh_script_progression --message="Updating the configuration file..." --weight=1 ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" From 20212d62d1753a8ac0684e1269f403c5218fa1e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Nov 2023 18:41:45 +0100 Subject: [PATCH 09/26] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 51f12f0..be861da 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -70,7 +70,7 @@ chown $app:$app "$data_dir/config.xml" ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +#ynh_use_logrotate --non-append ynh_use_logrotate --non-append --logfile="$data_dir/logs" #================================================= From bec52a14875d3eb104295addd73f6dfa9894570b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Nov 2023 18:41:58 +0100 Subject: [PATCH 10/26] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index be861da..51f12f0 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -70,7 +70,7 @@ chown $app:$app "$data_dir/config.xml" ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 # Use logrotate to manage app-specific logfile(s) -#ynh_use_logrotate --non-append +ynh_use_logrotate --non-append ynh_use_logrotate --non-append --logfile="$data_dir/logs" #================================================= From 2e4c4564ff53ec7a5afd4434febf1f707859e7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Nov 2023 18:42:35 +0100 Subject: [PATCH 11/26] Update remove --- scripts/remove | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/remove b/scripts/remove index 5a8d063..d9cee11 100755 --- a/scripts/remove +++ b/scripts/remove @@ -32,6 +32,9 @@ ynh_remove_nginx_config # Remove the app-specific logrotate config ynh_remove_logrotate +# Remove the log files +ynh_secure_remove --file="/var/log/$app" + #================================================= # END OF SCRIPT #================================================= From 757f58eada9e257aa4d7dddfc84dea77fabe5fc6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 14 Jan 2024 08:34:07 +0100 Subject: [PATCH 12/26] Update change_url --- scripts/change_url | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 5f4466a..31c6be8 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,9 +31,7 @@ ynh_change_url_nginx_config # UPDATE CONFIGURATION FILE #================================================= -ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" -chmod 400 "$data_dir/config.xml" -chown $app:$app "$data_dir/config.xml" +ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="$data_dir/config.xml" #================================================= # GENERIC FINALISATION From 89aa767dfd9df7cf6e3bf7f65a74b1d34082e6a0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 14 Jan 2024 08:36:03 +0100 Subject: [PATCH 13/26] Update _common.sh --- scripts/_common.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f6f8fb1..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,6 @@ # COMMON VARIABLES #================================================= -version="0.8.1.2135" - #================================================= # PERSONAL HELPERS #================================================= From 5d0d0fa12250c7a345f06512d94619175d0da02d Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 12 Feb 2024 22:02:34 +0100 Subject: [PATCH 14/26] Upgrade to v1.13.3.4273 --- manifest.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest.toml b/manifest.toml index c47ee7d..f8125de 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Prowlarr" description.en = "Complete management of your indexers for Radarr, Sonarr, Lidarr..." description.fr = "Gestion complète de vos indexeurs pour Radarr, Sonarr, Lidarr..." -version = "1.10.3.4070~ynh1" +version = "1.13.3.4273~ynh1" maintainers = ["tituspijean"] @@ -41,12 +41,12 @@ ram.runtime = "50M" [resources] [resources.sources.main] - armhf.url = "https://github.com/Prowlarr/Prowlarr/releases/download/v1.10.3.4070/Prowlarr.develop.1.10.3.4070.linux-core-arm.tar.gz" - armhf.sha256 = "4fe1f010685ebdae99f02920c124d3f83fa4f1daa89ac9fb111f82ae3b4529a3" - arm64.url = "https://github.com/Prowlarr/Prowlarr/releases/download/v1.10.3.4070/Prowlarr.develop.1.10.3.4070.linux-core-arm64.tar.gz" - arm64.sha256 = "8ef3cbe1b4af9e3604209c52d2c413f4bcab3958022140c369fe04944da7440e" - amd64.url = "https://github.com/Prowlarr/Prowlarr/releases/download/v1.10.3.4070/Prowlarr.develop.1.10.3.4070.linux-core-x64.tar.gz" - amd64.sha256 = "c185f08bd6ea522d93c3145c4f4af332a4dc5cc579c109a3c1ea3b87a5668cd6" + armhf.url = "https://github.com/Prowlarr/Prowlarr/releases/download/v1.13.3.4273/Prowlarr.master.1.13.3.4273.linux-core-arm.tar.gz" + armhf.sha256 = "6d3d5f57e9a5235cf415904a6361dbcbdd0229c6bb0c3a3d18d1eed47760d21a" + arm64.url = "https://github.com/Prowlarr/Prowlarr/releases/download/v1.13.3.4273/Prowlarr.master.1.13.3.4273.linux-core-arm64.tar.gz" + arm64.sha256 = "be72620b995454c125d122cb88aad8d67ad97fd2dcf3dc7bf8682a75eb97505b" + amd64.url = "https://github.com/Prowlarr/Prowlarr/releases/download/v1.13.3.4273/Prowlarr.master.1.13.3.4273.linux-core-x64.tar.gz" + amd64.sha256 = "f32112aaa20bad865784e3d72eb94456441c6b431845fcca3be1ad16ac8b786b" [resources.system_user] @@ -68,4 +68,4 @@ ram.runtime = "50M" [resources.apt] packages = "curl, mediainfo, sqlite3" - \ No newline at end of file + From b91ccb7a618f24c9dcd4a67cfb72ed496f417124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 18 Nov 2023 18:18:03 +0100 Subject: [PATCH 15/26] v2 --- manifest.toml | 4 ++++ scripts/change_url | 8 ++++++++ scripts/remove | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/manifest.toml b/manifest.toml index f8125de..d90779b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -68,4 +68,8 @@ ram.runtime = "50M" [resources.apt] packages = "curl, mediainfo, sqlite3" +<<<<<<< HEAD +======= + +>>>>>>> 64e384b (v2) diff --git a/scripts/change_url b/scripts/change_url index 31c6be8..1abcb0a 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,7 +31,15 @@ ynh_change_url_nginx_config # UPDATE CONFIGURATION FILE #================================================= +<<<<<<< HEAD ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="$data_dir/config.xml" +======= +ynh_exec_warn_less 'ynh_add_config --template="config.xml" --destination="$data_dir/config.xml"' + +chmod 750 "$data_dir/config.xml" +chmod o-rwx "$data_dir/config.xml" +chown $app "$data_dir/config.xml" +>>>>>>> 64e384b (v2) #================================================= # GENERIC FINALISATION diff --git a/scripts/remove b/scripts/remove index d9cee11..74439e0 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,9 +10,15 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= +<<<<<<< HEAD # REMOVE SYSTEM CONFIGURATIONS #================================================= # REMOVE SYSTEMD SERVICE +======= +# STANDARD REMOVE +#================================================= +# REMOVE SERVICE INTEGRATION IN YUNOHOST +>>>>>>> 64e384b (v2) #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 @@ -32,9 +38,12 @@ ynh_remove_nginx_config # Remove the app-specific logrotate config ynh_remove_logrotate +<<<<<<< HEAD # Remove the log files ynh_secure_remove --file="/var/log/$app" +======= +>>>>>>> 64e384b (v2) #================================================= # END OF SCRIPT #================================================= From 745a497cd117450cd038cd66ed73ce3969e0f6c3 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 12 Feb 2024 22:16:48 +0100 Subject: [PATCH 16/26] Fix botched rebase --- manifest.toml | 5 ----- scripts/change_url | 8 -------- scripts/remove | 11 +---------- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/manifest.toml b/manifest.toml index d90779b..b638ba5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -68,8 +68,3 @@ ram.runtime = "50M" [resources.apt] packages = "curl, mediainfo, sqlite3" -<<<<<<< HEAD - -======= - ->>>>>>> 64e384b (v2) diff --git a/scripts/change_url b/scripts/change_url index 1abcb0a..31c6be8 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,15 +31,7 @@ ynh_change_url_nginx_config # UPDATE CONFIGURATION FILE #================================================= -<<<<<<< HEAD ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="$data_dir/config.xml" -======= -ynh_exec_warn_less 'ynh_add_config --template="config.xml" --destination="$data_dir/config.xml"' - -chmod 750 "$data_dir/config.xml" -chmod o-rwx "$data_dir/config.xml" -chown $app "$data_dir/config.xml" ->>>>>>> 64e384b (v2) #================================================= # GENERIC FINALISATION diff --git a/scripts/remove b/scripts/remove index 74439e0..f7bd6fd 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,15 +10,9 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -<<<<<<< HEAD # REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SYSTEMD SERVICE -======= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST ->>>>>>> 64e384b (v2) +# REMOVE SYSTEMD SERVICE #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 @@ -38,12 +32,9 @@ ynh_remove_nginx_config # Remove the app-specific logrotate config ynh_remove_logrotate -<<<<<<< HEAD # Remove the log files ynh_secure_remove --file="/var/log/$app" -======= ->>>>>>> 64e384b (v2) #================================================= # END OF SCRIPT #================================================= From 842e2e0c8aaf5549ac0a173a48d76ed5233be184 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 12 Feb 2024 21:20:26 +0000 Subject: [PATCH 17/26] 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 e05bfe2..75ceb63 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Complete management of your indexers for Radarr, Sonarr, Lidarr... -**Shipped version:** 1.13.1.4243~ynh1 +**Shipped version:** 1.13.3.4273~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 081de3f..912fcdc 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Complete management of your indexers for Radarr, Sonarr, Lidarr... -**Version incluse :** 1.13.1.4243~ynh1 +**Version incluse :** 1.13.3.4273~ynh1 ## Captures d’écran From d80dfda45e582174a3e9eba53c4fe6e996ce5adc Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 12 Feb 2024 23:11:46 +0100 Subject: [PATCH 18/26] Add sleep at the end of restore in CI context --- scripts/restore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/restore b/scripts/restore index 3fb68bd..4fa3250 100755 --- a/scripts/restore +++ b/scripts/restore @@ -61,3 +61,7 @@ ynh_store_file_checksum --file="$data_dir/config.xml" #================================================= ynh_script_progression --message="Restoration completed for $app" --last + +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 5 +fi From b088352d1f27d2fbecee16e53a7910235d619708 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Mon, 12 Feb 2024 23:15:11 +0100 Subject: [PATCH 19/26] Remove new line at end of config file --- conf/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/config.xml b/conf/config.xml index 8c72176..747c329 100644 --- a/conf/config.xml +++ b/conf/config.xml @@ -14,4 +14,4 @@ False - + \ No newline at end of file From d69286f64b880a1fcf0d05229321ad53def58d0e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 4 Mar 2024 07:01:48 +0000 Subject: [PATCH 20/26] Upgrade to v1.14.1.4316 --- conf/app.arm.src | 4 ++-- conf/app.arm64.src | 4 ++-- conf/app.x64.src | 4 ++-- manifest.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/conf/app.arm.src b/conf/app.arm.src index 11b777e..01c5798 100644 --- a/conf/app.arm.src +++ b/conf/app.arm.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.13.1.4243/Prowlarr.develop.1.13.1.4243.linux-core-arm.tar.gz -SOURCE_SUM=3ab301d2e72bfa5334c53da55dd56ce91f77805fc0dd6a061646fdcae8779d33 +SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.14.1.4316/Prowlarr.develop.1.14.1.4316.linux-core-arm.tar.gz +SOURCE_SUM=11c8b3987946e0cc5fb9fac4f2dbc229d9d45ac5a2313a156af6c3f391ca2783 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/app.arm64.src b/conf/app.arm64.src index bd659fc..8c276f6 100644 --- a/conf/app.arm64.src +++ b/conf/app.arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.13.1.4243/Prowlarr.develop.1.13.1.4243.linux-core-arm64.tar.gz -SOURCE_SUM=1ef7ca4f6b5e5db7157b1be626fa1beddc36e73ce1e873a8d0a0c361b8dc6c9c +SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.14.1.4316/Prowlarr.develop.1.14.1.4316.linux-core-arm64.tar.gz +SOURCE_SUM=0376b24cdaa46da2bf829f7e08f577638452dce2ba177fb764d3371e81f86bb6 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/app.x64.src b/conf/app.x64.src index d848d47..ba08a5d 100644 --- a/conf/app.x64.src +++ b/conf/app.x64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.13.1.4243/Prowlarr.develop.1.13.1.4243.linux-core-x64.tar.gz -SOURCE_SUM=20e14f37b64ca8b95189e24d46719086224d889dc6e77cce1729b6ec5f4ccfba +SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.14.1.4316/Prowlarr.develop.1.14.1.4316.linux-core-x64.tar.gz +SOURCE_SUM=ac363215a54cd6d648e3e7c35d4ec85d05a6c79fb66fa8b13988bc01429affde SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 94db187..c7df30e 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Complete management of your indexers for Radarr, Sonarr, Lidarr...", "fr": "Gestion complète de vos indexeurs pour Radarr, Sonarr, Lidarr..." }, - "version": "1.13.1.4243~ynh1", + "version": "1.14.1.4316~ynh1", "url": "https://prowlarr.com", "upstream": { "license": "GPL-3.0-only", From c63bcb4f7ce93537f38d63b65a05d23cdb810911 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 4 Mar 2024 07:01:52 +0000 Subject: [PATCH 21/26] Auto-update README --- README.md | 6 +++--- README_fr.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0ac3b4a..6dc5a0c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Complete management of your indexers for Radarr, Sonarr, Lidarr... -**Shipped version:** 1.13.1.4243~ynh1 +**Shipped version:** 1.14.1.4316~ynh1 ## Screenshots @@ -50,4 +50,4 @@ or sudo yunohost app upgrade prowlarr -u https://github.com/YunoHost-Apps/prowlarr_ynh/tree/testing --debug ``` -**More info regarding app packaging:** +**More info regarding app packaging:** \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index 6eccc4b..99a1757 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,5 +1,5 @@ @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Gestion complète de vos indexeurs pour Radarr, Sonarr, Lidarr... -**Version incluse :** 1.13.1.4243~ynh1 +**Version incluse :** 1.14.1.4316~ynh1 ## Captures d’écran From 39f2f43bc29d0b087da6ce26523e5eddcaa30325 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 11 Mar 2024 06:15:31 +0000 Subject: [PATCH 22/26] Upgrade to v1.14.2.4318 --- conf/app.arm.src | 4 ++-- conf/app.arm64.src | 4 ++-- conf/app.x64.src | 4 ++-- manifest.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/conf/app.arm.src b/conf/app.arm.src index 01c5798..a9abfc1 100644 --- a/conf/app.arm.src +++ b/conf/app.arm.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.14.1.4316/Prowlarr.develop.1.14.1.4316.linux-core-arm.tar.gz -SOURCE_SUM=11c8b3987946e0cc5fb9fac4f2dbc229d9d45ac5a2313a156af6c3f391ca2783 +SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.14.2.4318/Prowlarr.develop.1.14.2.4318.linux-core-arm.tar.gz +SOURCE_SUM=773345040665e546e20f1b4b698b51d2787f8d73fe2ff4e8957786343fc3c522 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/app.arm64.src b/conf/app.arm64.src index 8c276f6..6b1dec1 100644 --- a/conf/app.arm64.src +++ b/conf/app.arm64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.14.1.4316/Prowlarr.develop.1.14.1.4316.linux-core-arm64.tar.gz -SOURCE_SUM=0376b24cdaa46da2bf829f7e08f577638452dce2ba177fb764d3371e81f86bb6 +SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.14.2.4318/Prowlarr.develop.1.14.2.4318.linux-core-arm64.tar.gz +SOURCE_SUM=e53bec878a5b947a35acd397b4a38d4e199d5b5d95a79c5238063f4abe0fe76a SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/app.x64.src b/conf/app.x64.src index ba08a5d..763caba 100644 --- a/conf/app.x64.src +++ b/conf/app.x64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.14.1.4316/Prowlarr.develop.1.14.1.4316.linux-core-x64.tar.gz -SOURCE_SUM=ac363215a54cd6d648e3e7c35d4ec85d05a6c79fb66fa8b13988bc01429affde +SOURCE_URL=https://github.com/Prowlarr/Prowlarr/releases/download/v1.14.2.4318/Prowlarr.develop.1.14.2.4318.linux-core-x64.tar.gz +SOURCE_SUM=7d0a803f899ca27f5d7cb03e60944df240fe9b8ff5266b60227df65dc92136b7 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index c7df30e..be41dae 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Complete management of your indexers for Radarr, Sonarr, Lidarr...", "fr": "Gestion complète de vos indexeurs pour Radarr, Sonarr, Lidarr..." }, - "version": "1.14.1.4316~ynh1", + "version": "1.14.2.4318~ynh1", "url": "https://prowlarr.com", "upstream": { "license": "GPL-3.0-only", From 587b44bf5ee72bcc50f872540903b09f115ad688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 13 Mar 2024 00:53:13 +0100 Subject: [PATCH 23/26] fix nginx linter --- conf/nginx.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index cb18632..2260216 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -19,7 +19,7 @@ location __PATH__/api { proxy_pass http://127.0.0.1:__PORT____PATH__/api; } -#location ~ __PATH__/[0-9]+/api { +#location ~ ^__PATH__/[0-9]+/api { # auth_request off; # proxy_pass http://127.0.0.1:__PORT____PATH__; #} @@ -28,4 +28,3 @@ location __PATH__/Content { auth_request off; proxy_pass http://127.0.0.1:__PORT____PATH__/Content; } - From 1f860f5147f002ec1aba6bdb6ca91634cfab32fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 13 Mar 2024 01:06:34 +0100 Subject: [PATCH 24/26] Cleanup for version 2 --- manifest.toml | 1 + scripts/backup | 2 -- scripts/change_url | 14 +++-------- scripts/install | 56 +++++++++++++++++-------------------------- scripts/remove | 10 ++------ scripts/restore | 39 ++++++++++++++---------------- scripts/upgrade | 60 +++++++++++++++------------------------------- 7 files changed, 65 insertions(+), 117 deletions(-) diff --git a/manifest.toml b/manifest.toml index 35119b6..31c10b2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -61,6 +61,7 @@ ram.runtime = "50M" [resources.install_dir] [resources.data_dir] + subdirs = ["logs"] [resources.ports] diff --git a/scripts/backup b/scripts/backup index ee3e43a..ea1738f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= diff --git a/scripts/change_url b/scripts/change_url index 31c6be8..607333d 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC STARTING #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,12 +7,10 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression --message="Stopping $app's systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" @@ -25,22 +21,18 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config -#================================================= -# SPECIFIC MODIFICATIONS #================================================= # UPDATE CONFIGURATION FILE #================================================= ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="$data_dir/config.xml" -#================================================= -# GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 9689d3a..12f220e 100755 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,8 +7,12 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# INITIALIZE AND STORE SETTINGS +#================================================= + 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" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -18,31 +20,19 @@ ynh_app_setting_set --app=$app --key=api_key --value=$api_key ynh_script_progression --message="Setting up source files..." --weight=3 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" -mkdir -p "$data_dir/logs" +ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app: "$install_dir" +chown -R "$app:" "$install_dir" #================================================= -# NGINX CONFIGURATION +# APP INITIAL CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring Prowlarr..." --weight=2 +ynh_script_progression --message="Adding $app's configuration files..." --weight=1 ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" chmod 400 "$data_dir/config.xml" -chown $app:$app "$data_dir/config.xml" +chown "$app:$app" "$data_dir/config.xml" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -52,33 +42,31 @@ 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" #================================================= -# GENERIC FINALIZATION +# SYSTEM CONFIGURATION #================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 + +# Create a dedicated NGINX config +ynh_add_nginx_config + +# Create a dedicated systemd config +ynh_add_systemd_config +yunohost service add "$app" --description="Prowlarr daemon" --log="$data_dir/logs/prowlarr.txt" # Use logrotate to manage application logfile(s) ynh_use_logrotate ynh_use_logrotate --logfile="$data_dir/logs" -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Prowlarr daemon" --log="$data_dir/logs/prowlarr.txt" - #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=2 +ynh_script_progression --message="Starting $app's systemd service..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" # FIXME Update config.xml checksum, for a mere file ending with or without a new line... ynh_store_file_checksum --file="$data_dir/config.xml" diff --git a/scripts/remove b/scripts/remove index f7bd6fd..230271a 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,18 +7,14 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# REMOVE SYSTEM CONFIGURATIONS #================================================= # REMOVE SYSTEMD SERVICE #================================================= 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 diff --git a/scripts/restore b/scripts/restore index 4fa3250..bc63c4a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -18,21 +16,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: "$install_dir" - -#================================================= -# RESTORE SYSTEM CONFIGURATIONS -#================================================= -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 - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - -yunohost service add $app --description="Prowlarr daemon" --log="$data_dir/logs/prowlarr.txt" +chown -R "$app:" "$install_dir" #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -42,14 +26,27 @@ 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" + +#================================================= +# RESTORE SYSTEM CONFIGURATIONS +#================================================= +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 +yunohost service add "$app" --description="Prowlarr daemon" --log="$data_dir/logs/prowlarr.txt" + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=2 +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="CommandExecutor: Starting" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" ynh_systemd_action --service_name=nginx --action=reload @@ -62,6 +59,6 @@ ynh_store_file_checksum --file="$data_dir/config.xml" ynh_script_progression --message="Restoration completed for $app" --last -if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then +if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then sleep 5 fi diff --git a/scripts/upgrade b/scripts/upgrade index 51f12f0..ce3232b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,35 +7,33 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression --message="Stopping $app's 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" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=3 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=3 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" -fi +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" --full_replace=1 chmod -R o-rwx "$install_dir" -chown -R $app: "$install_dir" +chown -R "$app:" "$install_dir" + +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating the configuration file..." --weight=1 + +ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" + +chmod 400 "$data_dir/config.xml" +chown "$app:$app" "$data_dir/config.xml" #================================================= # REAPPLY SYSTEM CONFIGURATIONS @@ -49,25 +45,7 @@ ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config - -yunohost service add $app --description="Prowlarr daemon" --log="$data_dir/logs/prowlarr.txt" - -#================================================= -# UPDATE A CONFIG FILE -#================================================= -ynh_script_progression --message="Updating the configuration file..." --weight=1 - -ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" - -chmod 400 "$data_dir/config.xml" -chown $app:$app "$data_dir/config.xml" - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 +yunohost service add "$app" --description="Prowlarr daemon" --log="$data_dir/logs/prowlarr.txt" # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -76,9 +54,9 @@ ynh_use_logrotate --non-append --logfile="$data_dir/logs" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=2 +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" # FIXME Update config.xml checksum, for a mere file ending with or without a new line... ynh_store_file_checksum --file="$data_dir/config.xml" From c0b069384a80ad42da4998650c83119de9076615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 13 Mar 2024 01:21:48 +0100 Subject: [PATCH 25/26] Fix restore: restore / fix config.xml --- conf/config.xml | 2 +- scripts/restore | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/conf/config.xml b/conf/config.xml index 747c329..8c72176 100644 --- a/conf/config.xml +++ b/conf/config.xml @@ -14,4 +14,4 @@ False - \ No newline at end of file + diff --git a/scripts/restore b/scripts/restore index bc63c4a..cef1846 100755 --- a/scripts/restore +++ b/scripts/restore @@ -18,6 +18,21 @@ ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" chown -R "$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:www-data" "$data_dir" + +if [ ! -f "$data_dir/config.xml" ]; then + ynh_add_config --template="config.xml" --destination="$data_dir/config.xml" + chmod 400 "$data_dir/config.xml" + chown "$app:$app" "$data_dir/config.xml" +fi + #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= From 2b60cf1ae5d80dda5695ebe192650577ab7985e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 13 Mar 2024 01:59:33 +0100 Subject: [PATCH 26/26] try to fix modified file --- scripts/change_url | 3 +++ scripts/install | 3 --- scripts/restore | 3 --- scripts/upgrade | 6 +++--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 607333d..6d8700b 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -25,6 +25,9 @@ ynh_change_url_nginx_config # UPDATE CONFIGURATION FILE #================================================= +# Add newline at end of file if required +sed -i -e '$a\' "$data_dir/config.xml" + ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="$data_dir/config.xml" #================================================= diff --git a/scripts/install b/scripts/install index 12f220e..b22abf1 100755 --- a/scripts/install +++ b/scripts/install @@ -68,9 +68,6 @@ ynh_script_progression --message="Starting $app's systemd service..." --weight=2 # Start a systemd service ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" -# FIXME Update config.xml checksum, for a mere file ending with or without a new line... -ynh_store_file_checksum --file="$data_dir/config.xml" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index cef1846..b8df9d7 100755 --- a/scripts/restore +++ b/scripts/restore @@ -65,9 +65,6 @@ ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" - ynh_systemd_action --service_name=nginx --action=reload -# FIXME Update config.xml checksum, for a mere file ending with or without a new line... -ynh_store_file_checksum --file="$data_dir/config.xml" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ce3232b..c7801c3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,6 +30,9 @@ chown -R "$app:" "$install_dir" #================================================= ynh_script_progression --message="Updating the configuration file..." --weight=1 +# 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 400 "$data_dir/config.xml" @@ -58,9 +61,6 @@ ynh_script_progression --message="Starting $app's systemd service..." --weight=1 ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="CommandExecutor: Starting" -# FIXME Update config.xml checksum, for a mere file ending with or without a new line... -ynh_store_file_checksum --file="$data_dir/config.xml" - #================================================= # END OF SCRIPT #=================================================