Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multimedia directories, apply latest app example, fix Python call for Bullseye #1

Merged
merged 12 commits into from
Feb 6, 2022
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Bazarr is a companion application to Sonarr and Radarr that manages and download
- Subtitles upgrade whenever better ones are released


**Shipped version:** 1.0.1~ynh1
**Shipped version:** 1.0.1~ynh2



Expand Down
2 changes: 1 addition & 1 deletion README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Bazarr is a companion application to Sonarr and Radarr that manages and download
- Subtitles upgrade whenever better ones are released


**Version incluse :** 1.0.1~ynh1
**Version incluse :** 1.0.1~ynh2



Expand Down
13 changes: 4 additions & 9 deletions check_process
Original file line number Diff line number Diff line change
@@ -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
; pre-install
# sudo yunohost domain add arr.domain.tld
Expand All @@ -20,7 +15,7 @@
setup_private=1
setup_public=0
upgrade=1
#upgrade=1 from_commit=CommitHash
upgrade=1 from_commit=22445f018b70ed1a89593107afff498b672f93ad
backup_restore=1
multi_instance=1
port_already_use=0
Expand All @@ -29,6 +24,6 @@
Email=
Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
; commit=22445f018b70ed1a89593107afff498b672f93ad
name=2022-01-13 v1.0.1~ynh1
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&
2 changes: 1 addition & 1 deletion conf/config.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[general]
ip = 127.0.0.1
port = __PORT__
base_url = __PATH__
base_url = __PATH_URL__
path_mappings = []
debug = False
branch = master
Expand Down
2 changes: 2 additions & 0 deletions conf/systemd.service
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ StandardOutput=append:/var/log/__APP__/__APP__.log
StandardError=inherit

# 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
NoNewPrivileges=yes
PrivateTmp=yes
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"en": "Automated subtitle downloading for Sonarr and 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",
"upstream": {
"license": "GPL-3.0",
Expand All @@ -27,7 +27,7 @@
"nginx"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
Expand Down
12 changes: 3 additions & 9 deletions scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@
python_version="3.7"
python_major_version=$(echo $python_version | cut -d. -f1)

# dependencies used by the app
if [[ $YNH_ARCH != arm* ]]
then
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"
pkg_dependencies="libxml2-dev libxslt1-dev unrar-free ffmpeg libatlas-base-dev"
pkg_dependencies+=" python${python_major_version}-libxml2 python${python_major_version}-lxml"
pkg_dependencies+=" python${python_major_version}-dev python${python_major_version}-venv"

#=================================================
# PERSONAL HELPERS
Expand Down
1 change: 0 additions & 1 deletion scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================

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
Expand Down
16 changes: 14 additions & 2 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers
#=================================================

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
Expand Down Expand Up @@ -112,7 +111,7 @@ ynh_script_progression --message="Installing Bazarr and its dependencies..." --w

pushd $final_path
# 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"
popd
Expand All @@ -138,13 +137,26 @@ ynh_systemd_action --service_name=$app --action="stop" --line_match="Bazarr exit
detect_and_read_radarr_and_sonarr_settings

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)
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"

chmod 660 "$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
#=================================================
Expand Down
16 changes: 8 additions & 8 deletions scripts/remove
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config
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
#=================================================
Expand All @@ -73,6 +65,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated 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
#=================================================
Expand Down
11 changes: 10 additions & 1 deletion scripts/restore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================

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
Expand Down Expand Up @@ -98,6 +97,16 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
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
#=================================================
Expand Down
19 changes: 12 additions & 7 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ detect_and_read_radarr_and_sonarr_settings
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."

upgrade_type=$(ynh_check_app_version_changed)

Expand All @@ -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"

#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1


#=================================================
# CREATE DEDICATED USER
#=================================================
Expand Down Expand Up @@ -114,7 +109,7 @@ ynh_script_progression --message="Upgrading Bazarr and its dependencies..." --we

pushd $final_path
# 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"
popd
Expand All @@ -129,6 +124,16 @@ ynh_add_config --template="config.ini" --destination="$final_path/data/config/co
chmod 660 "$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
#=================================================
Expand Down