1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lidarr_ynh.git synced 2024-09-03 19:35:58 +02:00

Merge pull request #14 from YunoHost-Apps/cleaning

cleaning
This commit is contained in:
Éric Gaspar 2023-07-28 07:14:57 +01:00 committed by GitHub
commit cf488675b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 68 deletions

View file

@ -16,7 +16,7 @@ admindoc = "https://wiki.servarr.com/Lidarr"
code = "https://github.com/Lidarr/Lidarr" code = "https://github.com/Lidarr/Lidarr"
[integration] [integration]
yunohost = ">= 11.1.15" yunohost = ">= 11.1.19"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = false ldap = false
@ -60,6 +60,7 @@ ram.runtime = "50M"
[resources.install_dir] [resources.install_dir]
[resources.data_dir] [resources.data_dir]
subdirs = ["logs"]
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"

View file

@ -25,7 +25,7 @@ ynh_backup --src_path="$install_dir"
# BACKUP THE APP DATA DIR # BACKUP THE APP DATA DIR
#================================================= #=================================================
ynh_backup --src_path="$data_dir" ynh_backup --src_path="$data_dir" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION

View file

@ -17,9 +17,6 @@ ynh_script_progression --message="Setting up source files..." --weight=3
# 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"
mkdir -p "$data_dir/logs"
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"

View file

@ -10,10 +10,11 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# STANDARD REMOVE # REMOVE SYSTEM CONFIGURATIONS
#================================================= #=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST # REMOVE SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null if ynh_exec_warn_less yunohost service status $app >/dev/null
@ -22,45 +23,15 @@ then
yunohost service remove $app yunohost service remove $app
fi fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE APP DATA DIR
#=================================================
ynh_script_progression --message="Removing app data directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$data_dir"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
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"

View file

@ -26,7 +26,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"
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"
@ -35,10 +34,8 @@ 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_dir" ynh_restore_file --origin_path="$data_dir" --not_mandatory
chmod 750 "$data_dir"
chmod -R o-rwx "$data_dir"
chown -R $app: "$data_dir" chown -R $app: "$data_dir"
chmod 400 "$data_dir/config.xml" chmod 400 "$data_dir/config.xml"

View file

@ -36,28 +36,25 @@ then
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
fi fi
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"
#================================================= #=================================================
# NGINX CONFIGURATION # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append --logfile="$data_dir/logs"
yunohost service add $app --description="Lidarr daemon" --log="$data_dir/logs/lidarr.txt"
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
@ -68,23 +65,6 @@ ynh_add_config --template="../conf/config.xml" --destination="$data_dir/config.x
chmod 400 "$data_dir/config.xml" chmod 400 "$data_dir/config.xml"
chown $app:$app "$data_dir/config.xml" chown $app:$app "$data_dir/config.xml"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# Use logrotate to manage app-specific logfile(s)
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="Lidarr daemon" --log="$data_dir/logs/lidarr.txt"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================