mirror of
https://github.com/YunoHost-Apps/radarr_ynh.git
synced 2024-09-03 20:16:13 +02:00
Packaging v2
This commit is contained in:
parent
4af0b9903f
commit
679346ebfb
10 changed files with 53 additions and 446 deletions
|
@ -7,7 +7,7 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
ExecStart=__INSTALL_DIR__/Radarr -nobrowser -data=__DATA_PATH__
|
||||
ExecStart=__INSTALL_DIR__/Radarr -nobrowser -data=__DATA_DIR__
|
||||
|
||||
TimeoutStopSec=20
|
||||
KillMode=process
|
||||
|
|
|
@ -21,7 +21,7 @@ yunohost = ">= 11.2"
|
|||
architectures = ["armhf", "arm64", "amd64", "i386"]
|
||||
multi_instance = true
|
||||
ldap = false
|
||||
sso = false
|
||||
sso = not_relevant
|
||||
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
|
@ -40,21 +40,23 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
|
|||
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"
|
||||
[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"
|
||||
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]
|
||||
|
||||
|
@ -62,3 +64,10 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
|
|||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
api.url = "/api"
|
||||
api.allowed = "visitors"
|
||||
api.show_tile = false
|
||||
api.protected = true
|
||||
|
||||
[resources.apt]
|
||||
packages = "curl mediainfo sqlite3"
|
||||
|
|
|
@ -6,29 +6,10 @@
|
|||
|
||||
version="3.2.2.5080"
|
||||
|
||||
# Supported architectures
|
||||
supported_architectures=("arm" "arm64" "x64")
|
||||
|
||||
# dependencies used by the app
|
||||
#REMOVEME? 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
|
||||
#=================================================
|
||||
|
|
|
@ -10,38 +10,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
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
|
||||
#=================================================
|
||||
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
|
||||
#=================================================
|
||||
|
|
|
@ -9,62 +9,6 @@
|
|||
source _common.sh
|
||||
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=3
|
||||
|
||||
# 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
|
||||
#=================================================
|
||||
|
@ -81,44 +25,17 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
|
|||
|
||||
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"
|
||||
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"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# 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
|
||||
|
@ -129,13 +46,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" --timeout=30
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
|
108
scripts/install
108
scripts/install
|
@ -9,89 +9,15 @@
|
|||
source _common.sh
|
||||
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
|
||||
|
||||
#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="Installation path ($install_dir) 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
|
||||
#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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=3
|
||||
|
||||
get_architecture
|
||||
|
||||
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
#REMOVEME? 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,7 +45,7 @@ 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
|
||||
|
@ -130,12 +56,12 @@ 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
|
||||
|
@ -173,22 +99,6 @@ 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="Application started" --timeout=30
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
|
|
@ -9,18 +9,6 @@
|
|||
source _common.sh
|
||||
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
|
||||
#=================================================
|
||||
|
@ -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
|
||||
#=================================================
|
||||
#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
|
||||
#=================================================
|
||||
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
|
||||
|
@ -102,16 +74,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
|
||||
#=================================================
|
||||
#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
|
||||
#=================================================
|
||||
|
|
|
@ -10,40 +10,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
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
|
||||
#=================================================
|
||||
|
@ -53,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"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
@ -68,7 +26,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
|||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
|
||||
|
@ -77,14 +34,13 @@ chown -R $app:$app "$install_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
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=4
|
||||
|
||||
# Define and install dependencies
|
||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
@ -119,7 +65,7 @@ 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
|
||||
|
|
|
@ -9,47 +9,12 @@
|
|||
source _common.sh
|
||||
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)
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
#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
|
||||
#=================================================
|
||||
|
@ -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
|
||||
#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
|
||||
#=================================================
|
||||
|
@ -92,21 +32,13 @@ 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="$install_dir"
|
||||
fi
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$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
|
||||
#=================================================
|
||||
|
@ -115,13 +47,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
|||
# Create a dedicated 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
|
||||
#=================================================
|
||||
|
@ -137,10 +62,10 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
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"
|
||||
chown $app:$app "$data_path/config.xml"
|
||||
chmod 400 "$data_dir/config.xml"
|
||||
chown $app:$app "$data_dir/config.xml"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -151,14 +76,14 @@ 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
|
||||
|
@ -167,13 +92,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" --timeout=30
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
|
3
tests.toml
Normal file
3
tests.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
test_format = 1.0
|
||||
|
||||
[default]
|
Loading…
Add table
Reference in a new issue