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

[autopatch] Automatic patch attempt for helpers 2.1

This commit is contained in:
Yunohost-Bot 2024-08-31 01:03:00 +02:00 committed by Alexandre Aubin
parent 470978ad34
commit fe91329c3b
9 changed files with 93 additions and 158 deletions

View file

@ -1,11 +1,11 @@
# Génération des statistiques. Tous les jours, à 5h. # Génération des statistiques. Tous les jours, à 5h.
0 5 * * * __USER__ cd "__INSTALL_DIR__" && /usr/bin/carton exec script/lufi cron stats 0 5 * * * __APP__ cd "__INSTALL_DIR__" && /usr/bin/carton exec script/lufi cron stats
# Suppression des adresses IP obsolètes. Tous les jours, à 6h. # Suppression des adresses IP obsolètes. Tous les jours, à 6h.
0 6 * * * __USER__ cd "__INSTALL_DIR__" && /usr/bin/carton exec script/lufi cron cleanbdd 0 6 * * * __APP__ cd "__INSTALL_DIR__" && /usr/bin/carton exec script/lufi cron cleanbdd
# Suppression des images dont le délai a expiré. Tous les jours, à 6h. # Suppression des images dont le délai a expiré. Tous les jours, à 6h.
0 6 * * * __USER__ cd "__INSTALL_DIR__" && /usr/bin/carton exec script/lufi cron cleanfiles 0 6 * * * __APP__ cd "__INSTALL_DIR__" && /usr/bin/carton exec script/lufi cron cleanfiles
# Vérification de l'occupation du dossier des images. Tous les jours, à 7h. # Vérification de l'occupation du dossier des images. Tous les jours, à 7h.
0 7 * * * __USER__ cd "__INSTALL_DIR__" && /usr/bin/carton exec script/lufi cron watch 0 7 * * * __APP__ cd "__INSTALL_DIR__" && /usr/bin/carton exec script/lufi cron watch

View file

@ -17,7 +17,8 @@ code = "https://framagit.org/fiat-tux/hat-softwares/lufi"
website = "https://git.framasoft.org/luc/lufi" website = "https://git.framasoft.org/luc/lufi"
[integration] [integration]
yunohost = ">= 11.1.21" yunohost = ">= 11.2.18"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = true ldap = true

View file

@ -1,17 +1,5 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES AND CUSTOM HELPERS
#=================================================
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -1,37 +1,28 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE DATA DIR # BACKUP THE DATA DIR
#================================================= #=================================================
ynh_backup --src_path="$data_dir" --is_big ynh_backup "$data_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
@ -39,29 +30,29 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup "/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app.service"
#================================================= #=================================================
# BACKUP VARIOUS FILES # BACKUP VARIOUS FILES
#================================================= #=================================================
ynh_backup --src_path="/etc/cron.d/$app" ynh_backup "/etc/cron.d/$app"
#================================================= #=================================================
# BACKUP THE POSTGRESQL DATABASE # BACKUP THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_print_info --message="Backing up the PostgreSQL database..." ynh_print_info "Backing up the PostgreSQL database..."
ynh_psql_dump_db --database="$db_name" > db.sql ynh_psql_dump_db > db.sql
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,41 +1,33 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." ynh_script_progression "Stopping $app's systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="$install_dir/log/production.log" ynh_systemctl --service=$app --action="stop" --log_path="$install_dir/log/production.log"
if [ -f "$install_dir/script/hypnotoad.pid" ]; then if [ -f "$install_dir/script/hypnotoad.pid" ]; then
ynh_print_info --message="Removing the PID file..." ynh_print_info "Removing the PID file..."
ynh_secure_remove --file="$install_dir/script/hypnotoad.pid" ynh_safe_rm "$install_dir/script/hypnotoad.pid"
fi fi
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config ynh_config_change_url_nginx
#================================================= #=================================================
# SPECIFIC MODIFICATIONS # SPECIFIC MODIFICATIONS
#================================================= #=================================================
# CONFIGURE LUFI # CONFIGURE LUFI
#================================================= #=================================================
ynh_script_progression --message="Configuring lufi..." ynh_script_progression "Configuring lufi..."
domain="$new_domain" domain="$new_domain"
path="$new_path" path="$new_path"
@ -46,23 +38,21 @@ then
ldap="" ldap=""
fi fi
ynh_add_config --template="../conf/lufi.conf" --destination="$install_dir/lufi.conf" ynh_config_add --template="lufi.conf" --destination="$install_dir/lufi.conf"
chmod 600 $install_dir/lufi.conf chmod 600 $install_dir/lufi.conf
chown $app:$app $install_dir/lufi.conf chown $app:$app $install_dir/lufi.conf
#=================================================
# GENERIC FINALISATION
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="$install_dir/log/production.log" --line_match="Creating process id file" ynh_systemctl --service=$app --action="start" --log_path="$install_dir/log/production.log" --wait_until="Creating process id file"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app" ynh_script_progression "Change of URL completed for $app"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -20,44 +14,43 @@ use_ldap=$YNH_APP_ARG_USE_LDAP
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_app_setting_set --app=$app --key=use_ldap --value=$use_ldap ynh_app_setting_set --key=use_ldap --value=$use_ldap
ynh_app_setting_set --app=$app --key=max_file_size --value=$max_file_size ynh_app_setting_set --key=max_file_size --value=$max_file_size
ynh_app_setting_set --app=$app --key=secret --value=$secret ynh_app_setting_set --key=secret --value=$secret
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." ynh_script_progression "Setting up source files..."
# 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"
chmod -R o-rwx "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring NGINX web server..." ynh_script_progression "Configuring NGINX web server..."
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_config_add_nginx
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_config_add_systemd
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_config_add_logrotate
yunohost service add $app --description="Lufi service" --log="$install_dir/log/production.log" yunohost service add $app --description="Lufi service" --log="$install_dir/log/production.log"
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" ynh_config_add --template="cron" --destination="/etc/cron.d/$app"
chmod +x $install_dir/script/lufi chmod +x $install_dir/script/lufi
#================================================= #=================================================
# CONFIGURE LUFI # CONFIGURE LUFI
#================================================= #=================================================
ynh_script_progression --message="Configuring $app..." ynh_script_progression "Configuring $app..."
ldap="#" ldap="#"
if [ $use_ldap -eq 1 ]; if [ $use_ldap -eq 1 ];
@ -65,7 +58,7 @@ then
ldap="" ldap=""
fi fi
ynh_add_config --template="../conf/lufi.conf" --destination="$install_dir/lufi.conf" ynh_config_add --template="lufi.conf" --destination="$install_dir/lufi.conf"
chmod 600 $install_dir/lufi.conf chmod 600 $install_dir/lufi.conf
chown $app:$app $install_dir/lufi.conf chown $app:$app $install_dir/lufi.conf
@ -73,7 +66,7 @@ chown $app:$app $install_dir/lufi.conf
#================================================= #=================================================
# INSTALL LUFI # INSTALL LUFI
#================================================= #=================================================
ynh_script_progression --message="Installing $app..." ynh_script_progression "Installing $app..."
pushd $install_dir pushd $install_dir
# Patch cpanfile.snapshot to bump dependency # Patch cpanfile.snapshot to bump dependency
@ -85,13 +78,13 @@ popd
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --line_match="Creating process id file" --log_path="$install_dir/log/production.log" ynh_systemctl --service=$app --action="start" --wait_until="Creating process id file" --log_path="$install_dir/log/production.log"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" ynh_script_progression "Installation of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -16,29 +10,29 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# 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_hide_warnings yunohost service status $app >/dev/null
then then
ynh_script_progression --message="Removing $app service integration..." ynh_script_progression "Removing $app service integration..."
yunohost service remove $app yunohost service remove $app
fi fi
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_config_remove_systemd
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_config_remove_logrotate
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_config_remove_nginx
# Remove a cron file # Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app" ynh_safe_rm "/etc/cron.d/$app"
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" #REMOVEME? (Apps should not remove their log dir during remove ... this should only happen if --purge is used, and be handled by the core...) ynh_safe_rm "/var/log/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" ynh_script_progression "Removal of $app completed"

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -13,51 +7,48 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." ynh_script_progression "Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir" ynh_restore "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# RESTORE THE POSTGRESQL DATABASE # RESTORE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostregSQL database..." ynh_script_progression "Restoring the PostregSQL database..."
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" ynh_psql_db_shell " < "./db.sql""
#================================================= #=================================================
# RESTORE SYSTEM CONFIGURATIONS # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/cron.d/$app" ynh_restore "/etc/cron.d/$app"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore "/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore "/etc/logrotate.d/$app"
yunohost service add $app --description="Lufi service" --log="$install_dir/log/production.log" yunohost service add $app --description="Lufi service" --log="$install_dir/log/production.log"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_script_progression "Reloading NGINX web server and $app's service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="$install_dir/log/production.log" --line_match="Creating process id file" ynh_systemctl --service=$app --action="start" --log_path="$install_dir/log/production.log" --wait_until="Creating process id file"
ynh_systemd_action --service_name=nginx --action=reload ynh_systemctl --service=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" ynh_script_progression "Restoration completed for $app"

View file

@ -1,69 +1,56 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." ynh_script_progression "Stopping $app's systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="$install_dir/log/production.log" ynh_systemctl --service=$app --action="stop" --log_path="$install_dir/log/production.log"
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression "Ensuring downward compatibility..."
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=max_file_size --value=100 # 100 Mo
if [ -z "${max_file_size:-}" ]; then if [ -z "${max_file_size:-}" ]; then
max_file_size=100 # 100 Mo max_file_size=100 # 100 Mo
ynh_app_setting_set --app=$app --key=max_file_size --value=$max_file_size ynh_app_setting_set --key=max_file_size --value=$max_file_size
fi fi
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=use_ldap --value=0
if [ -z "${use_ldap:-}" ]; then if [ -z "${use_ldap:-}" ]; then
use_ldap=0 use_ldap=0
ynh_app_setting_set --app=$app --key=use_ldap --value=$use_ldap ynh_app_setting_set --key=use_ldap --value=$use_ldap
fi fi
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=secret --value=$(ynh_string_random --length=24)
if [ -z "${secret:-}" ]; then if [ -z "${secret:-}" ]; then
secret=$(ynh_string_random --length=24) secret=$(ynh_string_random --length=24)
ynh_app_setting_set --app=$app --key=secret --value=$secret ynh_app_setting_set --key=secret --value=$secret
fi fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] # FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then then
ynh_script_progression --message="Upgrading source files..." ynh_script_progression "Upgrading source files..."
# 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"
fi fi
chmod -R o-rwx "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" #REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#=================================================
# SPECIFIC UPGRADE
#================================================= #=================================================
# SETUP LUFI # SETUP LUFI
#================================================= #=================================================
ynh_script_progression --message="Configuring Lufi..." ynh_script_progression "Configuring Lufi..."
ldap="#" ldap="#"
if [ $use_ldap -eq 1 ]; if [ $use_ldap -eq 1 ];
@ -71,7 +58,7 @@ then
ldap="" ldap=""
fi fi
ynh_add_config --template="../conf/lufi.conf" --destination="$install_dir/lufi.conf" ynh_config_add --template="lufi.conf" --destination="$install_dir/lufi.conf"
chmod 600 $install_dir/lufi.conf chmod 600 $install_dir/lufi.conf
chown $app:$app $install_dir/lufi.conf chown $app:$app $install_dir/lufi.conf
@ -79,7 +66,7 @@ chown $app:$app $install_dir/lufi.conf
#================================================= #=================================================
# BUILD LUFI # BUILD LUFI
#================================================= #=================================================
ynh_script_progression --message="Building Lufi..." ynh_script_progression "Building Lufi..."
pushd $install_dir pushd $install_dir
# Patch cpanfile.snapshot to bump dependency # Patch cpanfile.snapshot to bump dependency
@ -91,31 +78,31 @@ popd
#================================================= #=================================================
# SETUP CRON # SETUP CRON
#================================================= #=================================================
ynh_script_progression --message="Setuping cron..." ynh_script_progression "Setuping cron..."
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_config_add_nginx
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" ynh_config_add --template="cron" --destination="/etc/cron.d/$app"
chmod +x $install_dir/script/lufi chmod +x $install_dir/script/lufi
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_config_add_systemd
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append ynh_config_add_logrotate
yunohost service add $app --description="Lufi service" --log="$install_dir/log/production.log" yunohost service add $app --description="Lufi service" --log="$install_dir/log/production.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression "Starting $app's systemd service..."
ynh_systemd_action --service_name=$app --action="restart" --log_path="$install_dir/log/production.log" --line_match="Creating process id file" ynh_systemctl --service=$app --action="restart" --log_path="$install_dir/log/production.log" --wait_until="Creating process id file"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" ynh_script_progression "Upgrade of $app completed"