1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/radarr_ynh.git synced 2024-09-03 20:16:13 +02:00

Merge pull request #23 from YunoHost-Apps/testing

Packaging v2 and v4.3.2.6857
This commit is contained in:
tituspijean 2023-09-13 00:53:07 +02:00 committed by GitHub
commit 78849befd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 139 additions and 583 deletions

View file

@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
@ -33,7 +33,7 @@ jobs:
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}

View file

@ -6,6 +6,7 @@ It shall NOT be edited by hand.
# Radarr for YunoHost
[![Integration level](https://dash.yunohost.org/integration/radarr.svg)](https://dash.yunohost.org/appci/app/radarr) ![Working status](https://ci-apps.yunohost.org/ci/badges/radarr.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/radarr.maintain.svg)
[![Install Radarr with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=radarr)
*[Lire ce readme en français.](./README_fr.md)*
@ -23,13 +24,6 @@ Movie collection manager for Usenet and BitTorrent users
![Screenshot of Radarr](./doc/screenshots/screenshot.jpg)
## 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.
* The app uses YunoHost's multimedia directories, hence it has write access to users' and shared directories in `/home/yunohost.multimedia`. After installation, you can choose these directories to store your media.
## Documentation and resources
* Official app website: <https://radarr.video>

View file

@ -6,6 +6,7 @@ It shall NOT be edited by hand.
# Radarr pour YunoHost
[![Niveau dintégration](https://dash.yunohost.org/integration/radarr.svg)](https://dash.yunohost.org/appci/app/radarr) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/radarr.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/radarr.maintain.svg)
[![Installer Radarr avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=radarr)
*[Read this readme in english.](./README.md)*
@ -15,7 +16,7 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
## Vue densemble
Gestionnaire de filmothèque pour utilisateurs de Usenet et BitTorrent
Movie collection manager for Usenet and BitTorrent users
**Version incluse :** 4.3.2.6857~ynh1
@ -23,13 +24,6 @@ Gestionnaire de filmothèque pour utilisateurs de Usenet et BitTorrent
![Capture décran de Radarr](./doc/screenshots/screenshot.jpg)
## 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'application utilise les dossiers multimédia de YunoHost, elle a donc accès en écriture aux dossiers utilisateurs et communs de `/home/yunohost.multimedia`. Après installation, vous pourrez choisir ces dossiers pour y stocker vos médias.
## Documentations et ressources
* Site officiel de lapp : <https://radarr.video>

View file

@ -1,35 +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=CommitHash
upgrade=1 from_commit=164fa2341225bc8ce7671d0f70cc696ed8ab58a7
upgrade=1 from_commit=35c7ebe40c8893321c39570608ac0deacc9407c0
backup_restore=1
multi_instance=1
port_already_use=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=164fa2341225bc8ce7671d0f70cc696ed8ab58a7
name=2021-06-03 v3.2.0.5048
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&
; commit=35c7ebe40c8893321c39570608ac0deacc9407c0
name=2021-06-13 3.2.2.5080~ynh1
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&

View file

@ -1,5 +0,0 @@
SOURCE_URL=https://github.com/Radarr/Radarr/releases/download/v4.3.2.6857/Radarr.master.4.3.2.6857.linux-core-arm.tar.gz
SOURCE_SUM=20e8b2f3734327495af285e70b32fccb3c52a1794a723d2d69ef50973a2382d1
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -1,5 +0,0 @@
SOURCE_URL=https://github.com/Radarr/Radarr/releases/download/v4.3.2.6857/Radarr.master.4.3.2.6857.linux-core-arm64.tar.gz
SOURCE_SUM=3aa4e2ae25cec14ebc911000d54f8764bcb4eb602dca495de5aa30e7a11cd37b
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -1,5 +0,0 @@
SOURCE_URL=https://github.com/Radarr/Radarr/releases/download/v4.3.2.6857/Radarr.master.4.3.2.6857.linux-core-x64.tar.gz
SOURCE_SUM=ece6681ef0c92015e88143c774aa6189a8ed08138ea2e48f7bfa60645df4b52f
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -7,10 +7,11 @@
<UrlBase>__PATH__</UrlBase>
<ApiKey>__API_KEY__</ApiKey>
<AuthenticationMethod>None</AuthenticationMethod>
<UpdateMechanism>External</UpdateMechanism>
<UpdateMechanism>BuiltIn</UpdateMechanism>
<Branch>develop</Branch>
<SslPort>__PORT__</SslPort>
<LaunchBrowser>False</LaunchBrowser>
<SslCertPassword></SslCertPassword>
<AnalyticsEnabled>False</AnalyticsEnabled>
<InstanceName>Radarr</InstanceName>
</Config>

View file

@ -6,8 +6,8 @@ After=syslog.target network.target
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/
ExecStart=__FINALPATH__/Radarr -nobrowser -data=__DATA_PATH__
WorkingDirectory=__INSTALL_DIR__/
ExecStart=__INSTALL_DIR__/Radarr -nobrowser -data=__DATA_DIR__
TimeoutStopSec=20
KillMode=process

View file

@ -1,4 +1,3 @@
* 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.
* The app uses YunoHost's multimedia directories, hence it has write access to users' and shared directories in `/home/yunohost.multimedia`. After installation, you can choose these directories to store your media.

View file

@ -1,4 +1,3 @@
* 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'application utilise les dossiers multimédia de YunoHost, elle a donc accès en écriture aux dossiers utilisateurs et communs de `/home/yunohost.multimedia`. Après installation, vous pourrez choisir ces dossiers pour y stocker vos médias.

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
Movie collection manager for Usenet and BitTorrent users

View file

@ -1,49 +0,0 @@
{
"name": "Radarr",
"id": "radarr",
"packaging_format": 1,
"description": {
"en": "Movie collection manager for Usenet and BitTorrent users",
"fr": "Gestionnaire de filmothèque pour utilisateurs de Usenet et BitTorrent"
},
"version": "4.3.2.6857~ynh1",
"url": "https://radarr.video",
"upstream": {
"license": "GPL-3.0-only",
"website": "https://radarr.video",
"admindoc": "https://wiki.servarr.com/Radarr",
"code": "https://github.com/Radarr/Radarr"
},
"license": "GPL-3.0-only",
"maintainer": {
"name": "tituspijean",
"email": "tituspijean@outlook.com"
},
"requirements": {
"yunohost": ">= 4.3"
},
"multi_instance": true,
"services": [
"nginx",
"php7.3-fpm",
"mysql"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"default": "/radarr",
"example": "/radarr"
},
{
"name": "admin",
"type": "user"
}
]
}
}

75
manifest.toml Normal file
View file

@ -0,0 +1,75 @@
packaging_format = 2
id = "radarr"
name = "Radarr"
description.en = "Movie collection manager for Usenet and BitTorrent users"
description.fr = "Gestionnaire de filmothèque pour utilisateurs de Usenet et BitTorrent"
version = "4.3.2.6857~ynh1"
maintainers = ["tituspijean"]
[upstream]
license = "GPL-3.0-only"
website = "https://radarr.video"
admindoc = "https://wiki.servarr.com/Radarr"
code = "https://github.com/Radarr/Radarr"
fund = "https://radarr.video/donate"
[integration]
yunohost = ">= 11.2"
architectures = ["armhf", "arm64", "amd64", "i386"]
multi_instance = true
ldap = false
sso = "not_relevant"
disk = "300M"
ram.build = "100M"
ram.runtime = "100M"
[install]
[install.domain]
type = "domain"
[install.path]
type = "path"
default = "/radarr"
[install.init_main_permission]
type = "group"
help.en = "Logging in is disabled for Radarr on YunoHost, use this permission to manage who will have access."
help.fr = "La connexion est désactivée pour Radarr sur YunoHost, utilisez cette permission pour gérer qui y aura accès."
[resources]
[resources.sources.main]
armhf.url = "https://github.com/Radarr/Radarr/releases/download/v4.7.5.7809/Radarr.master.4.7.5.7809.linux-core-arm.tar.gz"
armhf.sha256 = "00972d3d587f214c1b3a446c5db2d9ef0823edba5a311670f81d6038bb11c1be"
arm64.url = "https://github.com/Radarr/Radarr/releases/download/v4.7.5.7809/Radarr.master.4.7.5.7809.linux-core-arm64.tar.gz"
arm64.sha256 = "82cc30caaf5920e6f0adcb3a3c006170de2c685f150d01cba4fdadac09d549c9"
amd64.url = "https://github.com/Radarr/Radarr/releases/download/v4.7.5.7809/Radarr.master.4.7.5.7809.linux-core-x64.tar.gz"
amd64.sha256 = "634f262eafe5a56ab071f7cf7332fe9ed4bb0962e63a0cfd8ab7db84829b2f90"
i386.url = "https://github.com/Radarr/Radarr/releases/download/v4.7.5.7809/Radarr.master.4.7.5.7809.linux-core-x86.tar.gz"
i386.sha256 = "e5ae54b2fdd2e310bdd720ce8b6e0bd9ebe4c9500a4af72c092bf8da052108e1"
autoupdate.strategy = "latest_github_release"
autoupdate.asset.armhf = ".*linux-core-arm.tar.gz"
autoupdate.asset.arm64 = ".*linux-core-arm64.tar.gz"
autoupdate.asset.amd64 = ".*linux-core-x64.tar.gz"
autoupdate.asset.i386 = ".*linux-core-x86.tar.gz"
[resources.ports]
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
[resources.permissions]
main.url = "/"
api.url = "/api"
api.allowed = "visitors"
api.show_tile = false
api.protected = true
[resources.apt]
packages = "curl mediainfo sqlite3"

View file

@ -6,29 +6,10 @@
version="3.2.2.5080"
# Supported architectures
supported_architectures=("arm" "arm64" "x64")
# dependencies used by the app
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
#=================================================

View file

@ -10,49 +10,17 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
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
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
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)
#=================================================
# 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
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE APP DATA DIR
#=================================================
ynh_backup --src_path="$data_path"
ynh_backup --src_path="$data_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -9,62 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --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)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=3
# Backup the current version of the app
ynh_backup_before_upgrade
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"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -79,32 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
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"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
path="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
else
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
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
ynh_change_url_nginx_config
#=================================================
# SPECIFIC MODIFICATIONS
@ -112,11 +31,11 @@ fi
# 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="../conf/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
@ -125,14 +44,7 @@ chown $app "$data_path/config.xml"
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started" --timeout=30
#=================================================
# END OF SCRIPT

View file

@ -9,89 +9,15 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
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
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
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"
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
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
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
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
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
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=4
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=3
get_architecture
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# 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
mkdir -p "$data_path/logs"
mkdir -p "$data_dir/logs"
#=================================================
# NGINX CONFIGURATION
@ -119,23 +45,23 @@ ynh_script_progression --message="Configuring Radarr..." --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"
ynh_add_config --template="../conf/config.xml" --destination="$data_dir/config.xml"
#=================================================
# SETUP FILE PERMISSIONS
#=================================================
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"
chown -R $app: "$data_path"
chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir"
chown -R $app: "$data_dir"
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"
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
@ -156,14 +82,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="Radarr daemon" --log="$data_path/logs/radarr.txt"
yunohost service add $app --description="Radarr daemon" --log="$data_dir/logs/radarr.txt"
#=================================================
# START SYSTEMD SERVICE
@ -171,23 +97,7 @@ yunohost service add $app --description="Radarr daemon" --log="$data_path/logs/r
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
ynh_permission_update --permission="main" --add="$admin" --remove="all_users"
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
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started" --timeout=30
#=================================================
# END OF SCRIPT

View file

@ -9,18 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
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)
#=================================================
# STANDARD REMOVE
#=================================================
@ -42,29 +30,13 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=3
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# 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"
ynh_secure_remove --file="$data_dir"
#=================================================
# REMOVE NGINX CONFIGURATION
@ -82,16 +54,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# 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
#=================================================
@ -102,16 +64,6 @@ 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
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,40 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
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
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
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)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
test ! -d $data_path \
|| ynh_die --message="There is already a directory: $data_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
@ -53,38 +19,28 @@ ynh_script_progression --message="Restoring the NGINX configuration..." --weight
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
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# 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:$app "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# RESTORE THE APP DATA DIR
#=================================================
ynh_script_progression --message="Restoring the app data directory..." --weight=2
ynh_restore_file --origin_path="$data_path"
ynh_restore_file --origin_path="$data_dir" --not_mandatory
chmod 750 "$data_path"
chmod -R o-rwx "$data_path"
chown -R $app: "$data_path"
# (Same as for install dir)
chown -R $app: "$data_dir"
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"
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
@ -96,16 +52,6 @@ ynh_multimedia_build_main_dir
# Enable writing into these directories
ynh_multimedia_addaccess $app
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=4
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE SYSTEMD
#=================================================
@ -119,14 +65,14 @@ systemctl enable $app.service --quiet
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Radarr daemon" --log="$data_path/logs/radarr.txt"
yunohost service add $app --description="Radarr daemon" --log="$data_dir/logs/radarr.txt"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started" --timeout=30
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION

View file

@ -9,47 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
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)
#=================================================
# 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
#=================================================
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 () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
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
if ! ynh_permission_exists --permission="api"; then
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"
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
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"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -92,20 +32,12 @@ 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="$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"
mkdir -p "$data_path/logs"
chmod 750 "$data_path"
chmod -R o-rwx "$data_path"
chown -R $app: "$data_path"
chmod -R o-rwx "$install_dir"
chown -R $app: "$install_dir"
#=================================================
# NGINX CONFIGURATION
@ -115,13 +47,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=4
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC UPGRADE
#=================================================
@ -132,16 +57,6 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# 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"
chmod 400 "$data_path/config.xml"
chown $app:$app "$data_path/config.xml"
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -151,28 +66,23 @@ 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"
ynh_use_logrotate --non-append --logfile="$data_dir/logs"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Radarr daemon" --log="$data_path/logs/radarr.txt"
yunohost service add $app --description="Radarr daemon" --log="$data_dir/logs/radarr.txt"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Starting Web Server" --timeout=30
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started" --timeout=30
# We might need to wait a bit further for migrations to finish
sleep 5
#=================================================
# END OF SCRIPT

13
tests.toml Normal file
View file

@ -0,0 +1,13 @@
test_format = 1.0
[default]
# -------------------------------
# Commits to test upgrade from
# -------------------------------
test_upgrade_from.35c7ebe4.name = "Upgrade from 3.2.2.5080~ynh1"
test_upgrade_from.35c7ebe4.args.domain = "sub.domain.tld"
test_upgrade_from.35c7ebe4.args.path = "/radarr"
test_upgrade_from.35c7ebe4.args.admin = "package_checker"