1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lidarr_ynh.git synced 2024-09-03 19:35:58 +02:00
This commit is contained in:
Éric Gaspar 2023-03-23 23:22:09 +01:00
parent beca965077
commit 50c132c036
12 changed files with 40 additions and 453 deletions

View file

@ -9,6 +9,7 @@ location __PATH__ {
proxy_no_cache $cookie_session; proxy_no_cache $cookie_session;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection; proxy_set_header Connection $http_connection;
# Allow the Lidarr API # Allow the Lidarr API
location __PATH__/api { location __PATH__/api {
auth_request off; auth_request off;

View file

@ -7,7 +7,7 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/ WorkingDirectory=__INSTALL_DIR__/
ExecStart=__INSTALL_DIR__/Lidarr -nobrowser -data=__DATA_PATH__ ExecStart=__INSTALL_DIR__/Lidarr -nobrowser -data=__DATA_DIR__
TimeoutStopSec=20 TimeoutStopSec=20
KillMode=process KillMode=process

View file

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

View file

@ -14,31 +14,26 @@ license = "GPL-3.0-only"
website = "https://lidarr.audio" website = "https://lidarr.audio"
admindoc = "https://wiki.servarr.com/Lidarr" admindoc = "https://wiki.servarr.com/Lidarr"
code = "https://github.com/Lidarr/Lidarr" code = "https://github.com/Lidarr/Lidarr"
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] [integration]
yunohost = ">= 4.3.0" yunohost = ">= 11.1.15"
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"] architectures = "all"
multi_instance = true 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. ldap = false
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. sso = false
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... disk = "50M"
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... ram.build = "50M"
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... ram.runtime = "50M"
[install] [install]
[install.domain] [install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain" type = "domain"
[install.path] [install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path" type = "path"
default = "/lidarr" default = "/lidarr"
[install.admin] [install.admin]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "user" type = "user"
[resources] [resources]
@ -52,6 +47,7 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
i386.url = "https://github.com/Lidarr/Lidarr/releases/download/v1.0.2.2592/Lidarr.master.1.0.2.2592.linux-core-x86.tar.gz" i386.url = "https://github.com/Lidarr/Lidarr/releases/download/v1.0.2.2592/Lidarr.master.1.0.2.2592.linux-core-x86.tar.gz"
i386.sha256 = "4e0a3828f9479c9b99210536903660839f38e5dd2764514d69b9661e0d087d00" i386.sha256 = "4e0a3828f9479c9b99210536903660839f38e5dd2764514d69b9661e0d087d00"
[resources.ports]
[resources.system_user] [resources.system_user]
@ -59,3 +55,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"
api.main.url = "/api"
api.allowed="visitors"
api.show_tile = false
api.protected = true
[resources.apt]
packages = "curl mediainfo sqlite3"

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
# dependencies used by the app
#REMOVEME? pkg_dependencies="curl mediainfo sqlite3"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================

View file

@ -10,28 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#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
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_print_info --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#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 # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================

View file

@ -9,62 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
#REMOVEME? old_path=$YNH_APP_OLD_PATH
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
#REMOVEME? new_path=$YNH_APP_NEW_PATH
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
#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
#=================================================
#REMOVEME? 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
#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.
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
#REMOVEME? change_domain=0
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
then
#REMOVEME? change_domain=1
fi
#REMOVEME? change_path=0
#REMOVEME? if [ "$old_path" != "$new_path" ]
then
#REMOVEME? change_path=1
fi
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -81,35 +25,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
ynh_change_url_nginx_config 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
#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
#REMOVEME? domain="$old_domain"
#REMOVEME? path="$new_path"
#REMOVEME? path="$new_path"
# Create a dedicated NGINX config
#REMOVEME? ynh_add_nginx_config
else
#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
#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
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
#REMOVEME? domain="$new_domain"
fi
#================================================= #=================================================
# SPECIFIC MODIFICATIONS # SPECIFIC MODIFICATIONS
#================================================= #=================================================
@ -131,13 +46,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -9,88 +9,15 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#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
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
#REMOVEME? path=$YNH_APP_ARG_PATH
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
architecture=$YNH_ARCH
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
#REMOVEME? install_dir=/opt/yunohost/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
data_path=/home/yunohost.app/$app
test ! -e "$data_path" || ynh_die --message="Data directory ($data_path) already exists"
# Register (book) web path
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
#REMOVEME? port=$(ynh_find_port --port=8095)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=4
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=3 ynh_script_progression --message="Setting up source files..." --weight=3
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# 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="$install_dir" ynh_setup_source --dest_dir="$install_dir"
#REMOVEME? ynh_app_setting_set --app=$app --key=data_path --value=$data_path mkdir -p "$data_dir/logs"
mkdir -p "$data_path/logs"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -129,12 +56,8 @@ chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app: "$install_dir" chown -R $app: "$install_dir"
chmod 750 "$data_path" chmod 400 "$data_dir/config.xml"
chmod -R o-rwx "$data_path" chown $app:$app "$data_dir/config.xml"
chown -R $app: "$data_path"
chmod 400 "$data_path/config.xml"
chown $app:$app "$data_path/config.xml"
#================================================= #=================================================
# YUNOHOST MULTIMEDIA INTEGRATION # YUNOHOST MULTIMEDIA INTEGRATION
@ -155,14 +78,14 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
ynh_use_logrotate --logfile="$data_path/logs" ynh_use_logrotate --logfile="$data_dir/logs"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Lidarr daemon" --log="$data_path/logs/lidarr.txt" yunohost service add $app --description="Lidarr daemon" --log="$data_dir/logs/lidarr.txt"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -172,22 +95,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started"
#=================================================
# SETUP SSOWAT
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
#REMOVEME? ynh_permission_update --permission="main" --add="$admin" --remove="all_users"
#REMOVEME? ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --show_tile="false" --protected="true"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -9,18 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#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)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
@ -42,29 +30,13 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=3
# Remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
#REMOVEME? ynh_secure_remove --file="$install_dir"
#================================================= #=================================================
# REMOVE APP DATA DIR # REMOVE APP DATA DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app data directory..." --weight=1 ynh_script_progression --message="Removing app data directory..." --weight=1
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$data_path" ynh_secure_remove --file="$data_dir"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
@ -92,16 +64,6 @@ ynh_script_progression --message="Removing various files..." --weight=1
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
#REMOVEME? ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -10,39 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#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
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#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)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
#REMOVEME? test ! -d $install_dir || ynh_die --message="There is already a directory: $install_dir "
test ! -d $data_path || ynh_die --message="There is already a directory: $data_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
@ -52,14 +19,6 @@ ynh_script_progression --message="Restoring the NGINX configuration..." --weight
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
@ -76,14 +35,14 @@ chown -R $app: "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Restoring the app data directory..." --weight=2 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"
chmod 750 "$data_path" chmod 750 "$data_dir"
chmod -R o-rwx "$data_path" chmod -R o-rwx "$data_dir"
chown -R $app: "$data_path" chown -R $app: "$data_dir"
chmod 400 "$data_path/config.xml" chmod 400 "$data_dir/config.xml"
chown $app:$app "$data_path/config.xml" chown $app:$app "$data_dir/config.xml"
#================================================= #=================================================
# YUNOHOST MULTIMEDIA INTEGRATION # YUNOHOST MULTIMEDIA INTEGRATION
@ -95,16 +54,6 @@ ynh_multimedia_build_main_dir
# Enable writing into these directories # Enable writing into these directories
ynh_multimedia_addaccess $app ynh_multimedia_addaccess $app
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=4
# Define and install dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
@ -118,7 +67,7 @@ systemctl enable $app.service --quiet
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Lidarr daemon" --log="$data_path/logs/lidarr.txt" yunohost service add $app --description="Lidarr daemon" --log="$data_dir/logs/lidarr.txt"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -9,42 +9,12 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#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? api_key=$(ynh_app_setting_get --app=$app --key=api_key)
architecture=$YNH_ARCH
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -54,31 +24,6 @@ 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"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Create a permission if needed
#REMOVEME? if ! ynh_permission_exists --permission="api"; then
#REMOVEME? 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
#REMOVEME? ynh_app_setting_set --app=$app --key=data_path --value=$data_path
mv "$install_dir/.data" "/home/yunohost.app/$app"
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -95,11 +40,6 @@ chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app: "$install_dir" chown -R $app: "$install_dir"
mkdir -p "$data_path/logs"
chmod 750 "$data_path"
chmod -R o-rwx "$data_path"
chown -R $app: "$data_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -108,13 +48,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=4
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
@ -130,10 +63,10 @@ ynh_add_systemd_config
#================================================= #=================================================
ynh_script_progression --message="Updating the configuration file.." --weight=1 ynh_script_progression --message="Updating the configuration file.." --weight=1
ynh_add_config --template="../conf/config.xml" --destination="$data_path/config.xml" ynh_add_config --template="../conf/config.xml" --destination="$data_dir/config.xml"
chmod 400 "$data_path/config.xml" chmod 400 "$data_dir/config.xml"
chown $app:$app "$data_path/config.xml" chown $app:$app "$data_dir/config.xml"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -144,14 +77,14 @@ ynh_script_progression --message="Upgrading logrotate configuration..." --weight
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append 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 # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Lidarr daemon" --log="$data_path/logs/lidarr.txt" yunohost service add $app --description="Lidarr daemon" --log="$data_dir/logs/lidarr.txt"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -160,13 +93,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Application started"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

5
tests.toml Normal file
View file

@ -0,0 +1,5 @@
test_format = 1.0
[default]
test_upgrade_from.cd2f91ab.name = "Upgrade from 0.8.1.2135"