1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lutim_ynh.git synced 2024-09-03 19:36:24 +02:00

Merge pull request #70 from YunoHost-Apps/upgrade

Upgrade
This commit is contained in:
yalh76 2022-07-29 17:16:16 +02:00 committed by GitHub
commit ca162f25f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 96 additions and 125 deletions

View file

@ -103,7 +103,7 @@
# if set to 1, all the images will be encrypted and the encryption option will no be displayed
# optional, default is 0
always_encrypt => __ENCRYPT__,
always_encrypt => __ALWAYS_ENCRYPT__,
# you can allow to use a watermark on the uploaded images (or enforce its use)
# define a path to the watermark image (provide an image with alpha channel)

View file

@ -109,23 +109,15 @@ ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# SETUP LUTIM
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Configure $app" --weight=2
ynh_script_progression --message="Adding a configuration file..." --weight=2
# Configure Lutim
cp ../conf/lutim.conf.template "$final_path/lutim.conf"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/lutim.conf"
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/lutim.conf"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/lutim.conf"
ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$final_path/lutim.conf"
workers="$(( $(nproc) * 2 ))"
ynh_add_config --template="../conf/lutim.conf.template" --destination="$final_path/lutim.conf"
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$final_path/lutim.conf"
# Set the number of process for Lutim to twice the number of CPU core.
ynh_replace_string --match_string="__WORKERS__" --replace_string="$(( $(nproc) * 2 ))" --target_file="$final_path/lutim.conf"
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/lutim.conf"
chmod 400 "$final_path/lutim.conf"
chown $app:$app "$final_path/lutim.conf"
#=================================================
# SETUP HOOKS FILE
@ -134,14 +126,6 @@ ynh_store_file_checksum --file="$final_path/lutim.conf"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# SETUP CRON
#=================================================
@ -175,6 +159,14 @@ touch /var/log/$app/production.log
chown $app -R /var/log/$app
ln -s /var/log/$app/production.log "$final_path/log/production.log"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -217,19 +217,11 @@ ynh_script_progression --message="Reconfiguring $app..."
# Overwrite the settings config file only if it's allowed
if [ $overwrite_settings -eq 1 ]
then
# Configure Lutim
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
ynh_backup_if_checksum_is_different --file="$final_path/lutim.conf"
cp ../conf/lutim.conf.template "$final_path/lutim.conf"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/lutim.conf"
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/lutim.conf"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/lutim.conf"
ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$final_path/lutim.conf"
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$final_path/lutim.conf"
# Set the number of process for Lutim to twice the number of CPU core.
ynh_replace_string --match_string="__WORKERS__" --replace_string="$(( $(nproc) * 2 ))" --target_file="$final_path/lutim.conf"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/lutim.conf"
workers="$(( $(nproc) * 2 ))"
ynh_add_config --template="../conf/lutim.conf.template" --destination="$final_path/lutim.conf"
chmod 400 "$final_path/lutim.conf"
chown $app:$app "$final_path/lutim.conf"
# Optional parameters from config-panel feature
if [ -n "$antiflood" ]; then

View file

@ -1,13 +0,0 @@
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
BEGIN { unshift @INC, "$FindBin::Bin/../lib" }
BEGIN { unshift @INC, "$FindBin::Bin/../local/lib/perl5" }
BEGIN { unshift @INC, "$FindBin::Bin/../local/lib/perl5/__ARCHDIR__" }
# Start command line interface for application
require Mojolicious::Commands;
Mojolicious::Commands->start_app('Mounter');