Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ericgaspar authored and tituspijean committed Feb 12, 2024
1 parent 05eaf95 commit ef0c7cf
Show file tree
Hide file tree
Showing 12 changed files with 199 additions and 153 deletions.
5 changes: 0 additions & 5 deletions conf/app.arm.src

This file was deleted.

5 changes: 0 additions & 5 deletions conf/app.arm64.src

This file was deleted.

5 changes: 0 additions & 5 deletions conf/app.x64.src

This file was deleted.

4 changes: 2 additions & 2 deletions conf/systemd.service
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
59 changes: 59 additions & 0 deletions manifest.toml
Original file line number Diff line number Diff line change
@@ -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 = "/"
2 changes: 1 addition & 1 deletion scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
74 changes: 38 additions & 36 deletions scripts/change_url
Original file line number Diff line number Diff line change
Expand Up @@ -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

#=================================================
Expand All @@ -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

#=================================================
Expand All @@ -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
Expand Down
Loading

0 comments on commit ef0c7cf

Please sign in to comment.