mirror of
https://github.com/YunoHost-Apps/lutim_ynh.git
synced 2024-09-03 19:36:24 +02:00
commit
2de4ea8227
5 changed files with 96 additions and 125 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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');
|
Loading…
Reference in a new issue