1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bazarr_ynh.git synced 2024-09-03 18:06:27 +02:00

Merge pull request #1 from YunoHost-Apps/testing

Add support for multimedia directories, apply latest app example, fix Python call for Bullseye
This commit is contained in:
tituspijean 2022-02-06 08:47:29 +01:00 committed by GitHub
commit 4b0240056d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 58 additions and 42 deletions

View file

@ -24,7 +24,7 @@ Bazarr is a companion application to Sonarr and Radarr that manages and download
- Subtitles upgrade whenever better ones are released - Subtitles upgrade whenever better ones are released
**Shipped version:** 1.0.1~ynh1 **Shipped version:** 1.0.1~ynh2

View file

@ -20,7 +20,7 @@ Bazarr is a companion application to Sonarr and Radarr that manages and download
- Subtitles upgrade whenever better ones are released - Subtitles upgrade whenever better ones are released
**Version incluse :** 1.0.1~ynh1 **Version incluse :** 1.0.1~ynh2

View file

@ -1,8 +1,3 @@
# 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
; pre-install ; pre-install
# sudo yunohost domain add arr.domain.tld # sudo yunohost domain add arr.domain.tld
@ -20,7 +15,7 @@
setup_private=1 setup_private=1
setup_public=0 setup_public=0
upgrade=1 upgrade=1
#upgrade=1 from_commit=CommitHash upgrade=1 from_commit=22445f018b70ed1a89593107afff498b672f93ad
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0 port_already_use=0
@ -29,6 +24,6 @@
Email= Email=
Notification=none Notification=none
;;; Upgrade options ;;; Upgrade options
; commit=CommitHash ; commit=22445f018b70ed1a89593107afff498b672f93ad
name=Name and date of the commit. name=2022-01-13 v1.0.1~ynh1
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& manifest_arg=domain=DOMAIN&path=PATH&admin=USER&

View file

@ -1,7 +1,7 @@
[general] [general]
ip = 127.0.0.1 ip = 127.0.0.1
port = __PORT__ port = __PORT__
base_url = __PATH__ base_url = __PATH_URL__
path_mappings = [] path_mappings = []
debug = False debug = False
branch = master branch = master

View file

@ -14,6 +14,8 @@ StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit StandardError=inherit
# Sandboxing options to harden security # Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these
# .. but this should be a good baseline
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html # Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
NoNewPrivileges=yes NoNewPrivileges=yes
PrivateTmp=yes PrivateTmp=yes

View file

@ -6,7 +6,7 @@
"en": "Automated subtitle downloading for Sonarr and Radarr", "en": "Automated subtitle downloading for Sonarr and Radarr",
"fr": "Téléchargement automatique de sous-titres pour Sonarr et Radarr" "fr": "Téléchargement automatique de sous-titres pour Sonarr et Radarr"
}, },
"version": "1.0.1~ynh1", "version": "1.0.1~ynh2",
"url": "https://bazarr.media", "url": "https://bazarr.media",
"upstream": { "upstream": {
"license": "GPL-3.0", "license": "GPL-3.0",
@ -27,7 +27,7 @@
"nginx" "nginx"
], ],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain" "type": "domain"

View file

@ -7,15 +7,9 @@
python_version="3.7" python_version="3.7"
python_major_version=$(echo $python_version | cut -d. -f1) python_major_version=$(echo $python_version | cut -d. -f1)
# dependencies used by the app pkg_dependencies="libxml2-dev libxslt1-dev unrar-free ffmpeg libatlas-base-dev"
if [[ $YNH_ARCH != arm* ]] pkg_dependencies+=" python${python_major_version}-libxml2 python${python_major_version}-lxml"
then pkg_dependencies+=" python${python_major_version}-dev python${python_major_version}-venv"
pkg_dependencies="libxml2-dev libxslt1-dev python3-dev python3-libxml2 python3-lxml unrar-free ffmpeg libatlas-base-dev"
else
pkg_dependencies="libxml2-dev libxslt1-dev python3-dev python3-libxml2 python3-lxml unrar-free ffmpeg libatlas-base-dev"
fi
pkg_dependencies+=" python${python_major_version}-venv"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script

View file

@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -112,7 +111,7 @@ ynh_script_progression --message="Installing Bazarr and its dependencies..." --w
pushd $final_path pushd $final_path
# Initialize virtual environment # Initialize virtual environment
ynh_exec_as $app python${python_version} -m venv venv ynh_exec_as $app python${python_major_version} -m venv venv
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt" ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt"
popd popd
@ -138,13 +137,26 @@ ynh_systemd_action --service_name=$app --action="stop" --line_match="Bazarr exit
detect_and_read_radarr_and_sonarr_settings detect_and_read_radarr_and_sonarr_settings
flask_key=$(ynh_string_random --length=32) flask_key=$(ynh_string_random --length=32)
ynh_app_setting_set --app=$app --key=flask_key --value=$flask_key
api_key=$(ynh_string_random --length=32) api_key=$(ynh_string_random --length=32)
ynh_app_setting_set --app=$app --key=api_key --value=$api_key
ynh_add_config --template="config.ini" --destination="$final_path/data/config/config.ini" ynh_add_config --template="config.ini" --destination="$final_path/data/config/config.ini"
chmod 660 "$final_path/data/config/config.ini" chmod 660 "$final_path/data/config/config.ini"
chown $app: "$final_path/data/config/config.ini" chown $app: "$final_path/data/config/config.ini"
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
ynh_script_progression --message="Adding multimedia directories..." --weight=1
# Build YunoHost multimedia directories
ynh_multimedia_build_main_dir
# Enable writing into these directories
ynh_multimedia_addaccess $app
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -49,14 +49,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
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=2
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
@ -73,6 +65,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=2
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================

View file

@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
#### Remove this function if there's nothing to clean before calling the remove script.
true true
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -98,6 +97,16 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
ynh_script_progression --message="Adding multimedia directories..." --weight=1
# Build YunoHost multimedia directories
ynh_multimedia_build_main_dir
# Enable writing into these directories
ynh_multimedia_addaccess $app
#================================================= #=================================================
# RESTORE THE LOGROTATE CONFIGURATION # RESTORE THE LOGROTATE CONFIGURATION
#================================================= #=================================================

View file

@ -27,6 +27,7 @@ detect_and_read_radarr_and_sonarr_settings
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
@ -53,12 +54,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
@ -114,7 +109,7 @@ ynh_script_progression --message="Upgrading Bazarr and its dependencies..." --we
pushd $final_path pushd $final_path
# Initialize virtual environment # Initialize virtual environment
ynh_exec_as $app python${python_version} -m venv venv ynh_exec_as $app python${python_major_version} -m venv venv
ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt" ynh_exec_as $app $final_path/venv/bin/pip install -r "$final_path/requirements.txt"
popd popd
@ -129,6 +124,16 @@ ynh_add_config --template="config.ini" --destination="$final_path/data/config/co
chmod 660 "$final_path/data/config/config.ini" chmod 660 "$final_path/data/config/config.ini"
chown $app: "$final_path/data/config/config.ini" chown $app: "$final_path/data/config/config.ini"
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
ynh_script_progression --message="Adding multimedia directories..." --weight=1
# Build YunoHost multimedia directories
ynh_multimedia_build_main_dir
# Enable writing into these directories
ynh_multimedia_addaccess $app
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================