1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lidarr_ynh.git synced 2024-09-03 19:35:58 +02:00

Merge pull request #4 from YunoHost-Apps/testing

Testing
This commit is contained in:
tituspijean 2021-12-02 11:37:23 +01:00 committed by GitHub
commit cd2f91ab84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 28 additions and 86 deletions

View file

@ -15,9 +15,9 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview ## Overview
A music collection manager for Usenet and BitTorrent users. Music collection manager for Usenet and BitTorrent users
**Shipped version:** 0.8.1.2135~ynh1 **Shipped version:** 0.8.1.2135~ynh2

View file

@ -11,9 +11,9 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble ## Vue d'ensemble
Un gestionnaire de discothèque pour utilisateurs de Usenet et BitTorrent. Gestionnaire de discothèque pour utilisateurs de Usenet et BitTorrent
**Version incluse :** 0.8.1.2135~ynh1 **Version incluse :** 0.8.1.2135~ynh2

View file

@ -1,14 +1,8 @@
# 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 ;; Test complet
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
admin="john" admin="john"
port="666"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -20,7 +14,6 @@
#upgrade=1 from_commit=CommitHash #upgrade=1 from_commit=CommitHash
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://github.com/Lidarr/Lidarr/releases/download/v__VERSION__/Lidarr.master.__VERSION__.linux-core-__ARCHITECTURE__.tar.gz
SOURCE_SUM=__CHECKSUM__
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_EXTRACT=true
SOURCE_FILENAME=lidarr.tar.gz

View file

@ -1,11 +1,6 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__ { location __PATH__ {
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
proxy_pass http://127.0.0.1:__PORT____PATH__; proxy_pass http://127.0.0.1:__PORT____PATH__;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View file

@ -3,10 +3,10 @@
"id": "lidarr", "id": "lidarr",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "A music collection manager for Usenet and BitTorrent users.", "en": "Music collection manager for Usenet and BitTorrent users",
"fr": "Un gestionnaire de discothèque pour utilisateurs de Usenet et BitTorrent." "fr": "Gestionnaire de discothèque pour utilisateurs de Usenet et BitTorrent"
}, },
"version": "0.8.1.2135~ynh1", "version": "0.8.1.2135~ynh2",
"url": "https://lidarr.audio", "url": "https://lidarr.audio",
"upstream": { "upstream": {
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@ -20,7 +20,7 @@
"email": "tituspijean@outlook.com" "email": "tituspijean@outlook.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.2" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -32,8 +32,7 @@
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"example": "example.com"
}, },
{ {
"name": "path", "name": "path",
@ -43,8 +42,7 @@
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user"
"example": "johndoe"
} }
] ]
} }

View file

@ -6,9 +6,6 @@
version="0.8.1.2135" version="0.8.1.2135"
# Supported architectures
supported_architectures=("arm" "arm64" "x64")
# dependencies used by the app # dependencies used by the app
pkg_dependencies="curl mediainfo sqlite3" pkg_dependencies="curl mediainfo sqlite3"
@ -16,19 +13,6 @@ pkg_dependencies="curl mediainfo sqlite3"
# PERSONAL HELPERS # 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 # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -36,11 +36,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
#================================================= #=================================================
ynh_print_info --message="Declaring files to be backed up..." 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 # BACKUP THE APP MAIN DIR
#================================================= #=================================================

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1 ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -34,7 +34,7 @@ api_key=$(ynh_app_setting_get --app=$app --key=api_key)
#================================================= #=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP # 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 ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -69,14 +69,14 @@ fi
#================================================= #=================================================
# STOP SYSTEMD SERVICE # 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" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # 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
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -88,8 +88,12 @@ then
# Set global variables for NGINX helper # Set global variables for NGINX helper
domain="$old_domain" domain="$old_domain"
path_url="$new_path" path_url="$new_path"
path="$new_path"
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
else
path_url="$old_path"
path="$old_path"
fi fi
# Change the domain for NGINX # Change the domain for NGINX
@ -100,6 +104,7 @@ then
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location # Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
domain="$new_domain"
fi fi
#================================================= #=================================================
@ -108,7 +113,7 @@ fi
# UPDATE CONFIGURATION FILE # UPDATE CONFIGURATION FILE
#================================================= #=================================================
ynh_exec_warn_less 'ynh_add_config --template="../conf/config.xml" --destination="$final_path/.data/config.xml"' ynh_add_config --template="../conf/config.xml" --destination="$final_path/.data/config.xml"
chmod 750 "$final_path/.data/config.xml" chmod 750 "$final_path/.data/config.xml"
chmod o-rwx "$final_path/.data/config.xml" chmod o-rwx "$final_path/.data/config.xml"
@ -119,14 +124,14 @@ chown $app "$final_path/.data/config.xml"
#================================================= #=================================================
# START SYSTEMD SERVICE # 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="Starting Web Server" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Starting Web Server"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -134,4 +139,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # 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

View file

@ -27,6 +27,7 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
architecture=$YNH_ARCH
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -81,11 +82,9 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=3 ynh_script_progression --message="Setting up source files..." --weight=3
get_architecture
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # 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="$final_path" --source_id="$architecture"
mkdir -p "$final_path/.data/logs" mkdir -p "$final_path/.data/logs"

View file

@ -73,16 +73,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate 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 # SPECIFIC REMOVE
#================================================= #=================================================

View file

@ -37,10 +37,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \ test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS

View file

@ -21,17 +21,12 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
architecture=$YNH_ARCH
#================================================= #=================================================
# CHECK VERSION # 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) upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
@ -83,10 +78,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." --weight=3 ynh_script_progression --message="Upgrading source files..." --weight=3
get_architecture
# Download, check integrity, uncompress and patch the source from app.src # 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="$final_path" --source_id="$architecture"
fi fi
mkdir -p "$final_path/.data/logs" mkdir -p "$final_path/.data/logs"