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

English translation and typo

This commit is contained in:
Maniack Crudelis 2019-01-18 19:56:43 +01:00
parent 9d37c8b9f5
commit 189baff6c8
7 changed files with 91 additions and 74 deletions

View file

@ -43,11 +43,12 @@ fi
if [ $is_public -eq 0 ] if [ $is_public -eq 0 ]
then then
# Si l'app est privée, seul le visionnage des images reste public # If the app is private, viewing images stays publicly accessible.
if [ "$path_url" == "/" ]; then if [ "$path_url" == "/" ]; then
path_url="" # Si path correspond à la racine, supprime le / pour éviter une erreur de la regex. # If the path is /, clear it to prevent any error with the regex.
path_url=""
fi fi
# Modifie le domaine pour qu'il passe dans une regex # Modify the domain to be used in a regex
domain_regex=$(echo "$domain" | sed 's@-@.@g') domain_regex=$(echo "$domain" | sed 's@-@.@g')
ynh_app_setting_set $app protected_regex "$domain_regex$path_url/stats$","$domain_regex$path_url/manifest.webapp$","$domain_regex$path_url/$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/m/.*$" ynh_app_setting_set $app protected_regex "$domain_regex$path_url/stats$","$domain_regex$path_url/manifest.webapp$","$domain_regex$path_url/$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/m/.*$"
else else

View file

@ -28,14 +28,14 @@ domain=$(ynh_app_setting_get $app domain)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
#================================================= #=================================================
# BACKUP OF THE MAIN DIR OF THE APP # BACKUP THE APP MAIN DIR
#================================================= #=================================================
CHECK_SIZE "$final_path" CHECK_SIZE "$final_path"
ynh_backup "$final_path" ynh_backup "$final_path"
#================================================= #=================================================
# BACKUP OF THE NGINX CONFIGURATION # BACKUP NGINX CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
@ -55,7 +55,7 @@ ynh_backup "/etc/logrotate.d/$app"
ynh_backup "/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app.service"
#================================================= #=================================================
# BACKUP OF THE CRON FILE # BACKUP A CRON FILE
#================================================= #=================================================
ynh_backup "/etc/cron.d/$app" ynh_backup "/etc/cron.d/$app"

View file

@ -67,7 +67,7 @@ fi
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
# Nettoyage des résidus d'installation non pris en charge par le script remove. # Clean installation remaining that are not handle by the remove script.
ynh_clean_check_starting ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -114,11 +114,13 @@ fi
#================================================= #=================================================
if [ $is_public -eq 0 ] if [ $is_public -eq 0 ]
then # Si l'app est privée, seul le visionnage des images reste public then
# If the app is private, viewing images stays publicly accessible.
if [ "$new_path" == "/" ]; then if [ "$new_path" == "/" ]; then
new_path="" # Si path correspond à la racine, supprime le / pour éviter une erreur de la regex. # If the path is /, clear it to prevent any error with the regex.
new_path=""
fi fi
# Modifie le domaine pour qu'il passe dans une regex # Modify the domain to be used in a regex
domain_regex=$(echo "$new_domain" | sed 's@-@.@g') domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
ynh_app_setting_set $app protected_regex "$domain_regex$new_path/stats$","$domain_regex$new_path/manifest.webapp$","$domain_regex$new_path/$","$domain_regex$new_path/d/.*$","$domain_regex$new_path/m/.*$" ynh_app_setting_set $app protected_regex "$domain_regex$new_path/stats$","$domain_regex$new_path/manifest.webapp$","$domain_regex$new_path/$","$domain_regex$new_path/d/.*$","$domain_regex$new_path/m/.*$"
fi fi
@ -143,7 +145,7 @@ ynh_systemd_action --action=reload --service_name=nginx
# START AND CHECK LUTIM BOOTING # START AND CHECK LUTIM BOOTING
#================================================= #=================================================
# Wait for lutim fully started # Wait for lutim to be fully started
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120" ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
#================================================= #=================================================

View file

@ -16,7 +16,7 @@ source _variables
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
# Nettoyage des résidus d'installation non pris en charge par le script remove. # Clean installation remaining that are not handle by the remove script.
ynh_clean_check_starting ynh_clean_check_starting
} }
ynh_abort_if_errors ynh_abort_if_errors
@ -56,20 +56,15 @@ ynh_app_setting_set $app overwrite_settings "1"
ynh_app_setting_set $app overwrite_nginx "1" ynh_app_setting_set $app overwrite_nginx "1"
ynh_app_setting_set $app overwrite_systemd "1" ynh_app_setting_set $app overwrite_systemd "1"
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================
ynh_maintenance_mode_ON
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
port=$(ynh_find_port 8095) # Cherche un port libre. # Find a free port
# Ouvre le port dans le firewall port=$(ynh_find_port 8095)
# Open this port
ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port
ynh_app_setting_set $app port $port ynh_app_setting_set $app port $port
@ -78,7 +73,8 @@ ynh_app_setting_set $app port $port
#================================================= #=================================================
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set $app final_path $final_path
ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path # Download, check integrity and uncompress the source from app.src
ynh_setup_source "$final_path"
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
@ -90,13 +86,15 @@ ynh_install_app_dependencies $app_depencencies
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
# Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_system_user_create $app # Créer un utilisateur système dédié à l'app # Create a dedicated system user
ynh_system_user_create $app
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -104,7 +102,7 @@ ynh_system_user_create $app # Créer un utilisateur système dédié à l'app
# SETUP LUTIM # SETUP LUTIM
#================================================= #=================================================
## Copie et configuration du fichier de conf. # Configure Lutim
cp ../conf/lutim.conf.template "$final_path/lutim.conf" cp ../conf/lutim.conf.template "$final_path/lutim.conf"
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/lutim.conf" ynh_replace_string "__DOMAIN__" "$domain" "$final_path/lutim.conf"
ynh_replace_string "__PATH__" "$path_url" "$final_path/lutim.conf" ynh_replace_string "__PATH__" "$path_url" "$final_path/lutim.conf"
@ -113,12 +111,14 @@ ynh_replace_string "__ENCRYPT__" "$always_encrypt" "$final_path/lutim.conf"
secret=$(ynh_string_random) secret=$(ynh_string_random)
ynh_replace_string "__SECRET__" "$secret" "$final_path/lutim.conf" ynh_replace_string "__SECRET__" "$secret" "$final_path/lutim.conf"
ynh_app_setting_set $app secret "$secret" ynh_app_setting_set $app secret "$secret"
ynh_store_file_checksum "$final_path/lutim.conf" # Enregistre la somme de contrôle du fichier de config # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/lutim.conf"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
# Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
#================================================= #=================================================
@ -137,11 +137,11 @@ mkdir -p /var/log/$app/
(cd $final_path (cd $final_path
carton install 2>&1 | tee -a "/var/log/$app/setup_carton.log") carton install 2>&1 | tee -a "/var/log/$app/setup_carton.log")
# Configure le path du dossier perl en fonction de l'architecture système # Use a perl path adapted to the system architecture
arch_dir=$(ls -1 $final_path/local/lib/perl5/ | grep linux-gnu) arch_dir=$(ls -1 $final_path/local/lib/perl5/ | grep linux-gnu)
if [ "$?" -ne 0 ] if [ "$?" -ne 0 ]
then then
ynh_die "Impossible de trouver le dossier relatif à l'architecture système." ynh_die "Unable to find the perl directory for your architecture."
fi fi
ynh_replace_string "__ARCHDIR__" "$arch_dir" "$final_path/script/lutim" ynh_replace_string "__ARCHDIR__" "$arch_dir" "$final_path/script/lutim"
@ -149,7 +149,7 @@ ynh_replace_string "__ARCHDIR__" "$arch_dir" "$final_path/script/lutim"
# SETUP LOG FILE # SETUP LOG FILE
#================================================= #=================================================
# Making log symbolic link to /var/log # Making log a symbolic link to /var/log
touch /var/log/$app/production.log touch /var/log/$app/production.log
chown $app -R /var/log/$app chown $app -R /var/log/$app
ln -s /var/log/$app/production.log "$final_path/log/production.log" ln -s /var/log/$app/production.log "$final_path/log/production.log"
@ -158,6 +158,7 @@ ln -s /var/log/$app/production.log "$final_path/log/production.log"
# SECURING FILES AND DIRECTORIES # SECURING FILES AND DIRECTORIES
#================================================= #=================================================
# Set permissions to app files
chown -R $app: $final_path chown -R $app: $final_path
#================================================= #=================================================
@ -166,10 +167,11 @@ chown -R $app: $final_path
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
# Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
#================================================= #=================================================
# ENABLE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add lutim -l $final_path/log/production.log yunohost service add lutim -l $final_path/log/production.log
@ -180,11 +182,13 @@ yunohost service add lutim -l $final_path/log/production.log
ynh_app_setting_set $app skipped_uris "/" ynh_app_setting_set $app skipped_uris "/"
if [ $is_public -eq 0 ] if [ $is_public -eq 0 ]
then # Si l'app est privée, seul le visionnage des images reste public then
# If the app is private, viewing images stays publicly accessible.
if [ "$path_url" == "/" ]; then if [ "$path_url" == "/" ]; then
path_url="" # Si path correspond à la racine, supprime le / pour éviter une erreur de la regex. # If the path is /, clear it to prevent any error with the regex.
path_url=""
fi fi
# Modifie le domaine pour qu'il passe dans une regex # Modify the domain to be used in a regex
domain_regex=$(echo "$domain" | sed 's@-@.@g') domain_regex=$(echo "$domain" | sed 's@-@.@g')
ynh_app_setting_set $app protected_regex "$domain_regex$path_url/stats$","$domain_regex$path_url/manifest.webapp$","$domain_regex$path_url/$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/m/.*$" ynh_app_setting_set $app protected_regex "$domain_regex$path_url/stats$","$domain_regex$path_url/manifest.webapp$","$domain_regex$path_url/$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/m/.*$"
fi fi
@ -199,24 +203,18 @@ ynh_systemd_action --action=reload --service_name=nginx
# CHECK LUTIM BOOTING # CHECK LUTIM BOOTING
#================================================= #=================================================
# Wait for lutim fully started # Wait for lutim to be fully started
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120" ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
# Set right permissions on new files created at first start # Set right permissions on new files created at first start
chown -R $app: $final_path chown -R $app: $final_path
#=================================================
# DEACTIVE MAINTENANCE MODE
#=================================================
ynh_maintenance_mode_OFF
#================================================= #=================================================
# SEND A README FOR THE ADMIN # SEND A README FOR THE ADMIN
#================================================= #=================================================
message="You can find a config file at $final_path/lutim.conf message="You can find a config file at $final_path/lutim.conf
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/lutim_ynh" If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/lutim_ynh"
ynh_send_readme_to_admin --app_message="$message" --recipients="root" ynh_send_readme_to_admin --app_message="$message" --recipients="root"

View file

@ -23,13 +23,15 @@ domain=$(ynh_app_setting_get $app domain)
# STOP AND REMOVE SERVICE # STOP AND REMOVE SERVICE
#================================================= #=================================================
# Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#================================================= #=================================================
# DISABLE SERVICE IN ADMIN PANEL # REMOVE SERVICE FROM ADMIN PANEL
#================================================= #=================================================
if yunohost service status | grep -q $app # Test l'existence du service dans Yunohost # Check if the service is declared in YunoHost
if yunohost service status | grep -q $app
then then
ynh_print_info "Remove $app service" >&2 ynh_print_info "Remove $app service" >&2
yunohost service remove $app yunohost service remove $app
@ -39,30 +41,34 @@ fi
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
# Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE THE MAIN DIR OF THE APP # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_secure_remove "/var/www/$app" # Suppression du dossier de l'application # Remove the app directory securely
ynh_secure_remove "/var/www/$app"
#================================================= #=================================================
# REMOVE THE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_remove_nginx_config # Suppression de la configuration nginx # Remove the dedicated nginx config
ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE THE LOGROTATE CONFIG # REMOVE LOGROTATE CONFIGURATION
#================================================= #=================================================
ynh_remove_logrotate # Suppression de la configuration de logrotate # Remove the app-specific logrotate config
ynh_remove_logrotate
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
# REMOVE CRON JOBS # REMOVE CRON JOB
#================================================= #=================================================
ynh_secure_remove "/etc/cron.d/$app" ynh_secure_remove "/etc/cron.d/$app"

View file

@ -16,7 +16,7 @@ source ../settings/scripts/_variables
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
# Nettoyage des résidus d'installation non pris en charge par le script remove. # Clean installation remaining that are not handle by the remove script.
ynh_clean_check_starting ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -50,28 +50,29 @@ ynh_maintenance_mode_ON
#================================================= #=================================================
# STANDARD RESTORE STEPS # STANDARD RESTORE STEPS
#================================================= #=================================================
# RESTORE OF THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE OF THE MAIN DIR OF THE APP # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_restore_file "$final_path" ynh_restore_file "$final_path"
#================================================= #=================================================
# RECREATE OF THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_system_user_create $app # Recreate the dedicated user, if not exist # Create the dedicated user (if not existing)
ynh_system_user_create $app
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
# Les fichiers appartiennent à root # Restore permissions on app files
chown -R $app: $final_path chown -R $app: $final_path
#================================================= #=================================================
@ -83,7 +84,7 @@ chown -R $app: $final_path
ynh_install_app_dependencies $app_depencencies ynh_install_app_dependencies $app_depencencies
#================================================= #=================================================
# ENABLE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add $app --log "/var/log/$app/APP.log" yunohost service add $app --log "/var/log/$app/APP.log"
@ -93,11 +94,10 @@ yunohost service add $app --log "/var/log/$app/APP.log"
#================================================= #=================================================
ynh_restore_file "/etc/systemd/system/$app.service" ynh_restore_file "/etc/systemd/system/$app.service"
## Démarrage auto du service
systemctl enable $app.service systemctl enable $app.service
#================================================= #=================================================
# RESTORE OF THE CRON FILE # RESTORE THE CRON FILE
#================================================= #=================================================
ynh_restore_file "/etc/cron.d/$app" ynh_restore_file "/etc/cron.d/$app"
@ -106,13 +106,13 @@ ynh_restore_file "/etc/cron.d/$app"
# SETUP LOG FILE # SETUP LOG FILE
#================================================= #=================================================
# Making log symbolic link to /var/log # Making log a symbolic link to /var/log
mkdir -p /var/log/$app/ mkdir -p /var/log/$app/
touch /var/log/$app/production.log touch /var/log/$app/production.log
chown $app -R /var/log/$app chown $app -R /var/log/$app
#================================================= #=================================================
# RESTORE THE LOGROTATE CONFIGURATION # RESTORE LOGROTATE CONFIGURATION
#================================================= #=================================================
ynh_restore_file "/etc/logrotate.d/$app" ynh_restore_file "/etc/logrotate.d/$app"
@ -129,7 +129,7 @@ ynh_systemd_action --action=reload --service_name=nginx
# START AND CHECK LUTIM BOOTING # START AND CHECK LUTIM BOOTING
#================================================= #=================================================
# Wait for lutim fully started # Wait for lutim to be fully started
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120" ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
#================================================= #=================================================
@ -144,6 +144,6 @@ ynh_maintenance_mode_OFF
message="You can find a config file at $final_path/lutim.conf message="You can find a config file at $final_path/lutim.conf
If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/lutim_ynh" If you're facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/lutim_ynh"
ynh_send_readme_to_admin --app_message="$message" --recipients="root" ynh_send_readme_to_admin --app_message="$message" --recipients="root"

View file

@ -42,22 +42,25 @@ upgrade_type=$(ynh_check_app_version_changed)
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
# Fix is_public as a boolean
if [ "$is_public" = "Yes" ]; then if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set $app is_public 1 # Fixe is_public en booléen ynh_app_setting_set $app is_public 1
is_public=1 is_public=1
elif [ "$is_public" = "No" ]; then elif [ "$is_public" = "No" ]; then
ynh_app_setting_set $app is_public 0 ynh_app_setting_set $app is_public 0
is_public=0 is_public=0
fi fi
# if final_path isn't set, which can happens with old scripts, set final_path.
if [ "${#final_path}" -eq 0 ] if [ "${#final_path}" -eq 0 ]
then # Si final_path n'est pas renseigné dans la config yunohost, cas d'ancien script, code final_path en dur then
final_path=/var/www/$app final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set $app final_path $final_path
fi fi
# Fix always_encrypt as a boolean
if [ "$always_encrypt" = "Yes" ]; then if [ "$always_encrypt" = "Yes" ]; then
ynh_app_setting_set $app always_encrypt 1 # Fixe always_encrypt en booléen ynh_app_setting_set $app always_encrypt 1
always_encrypt=1 always_encrypt=1
elif [ "$always_encrypt" = "No" ]; then elif [ "$always_encrypt" = "No" ]; then
ynh_app_setting_set $app always_encrypt 0 ynh_app_setting_set $app always_encrypt 0
@ -95,7 +98,7 @@ fi
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
# Nettoyage des résidus d'installation non pris en charge par le script remove. # Clean installation remaining that are not handle by the remove script.
ynh_clean_check_starting ynh_clean_check_starting
# restore it if the upgrade fails # restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
@ -107,7 +110,8 @@ ynh_abort_if_errors
# CHECK THE PATH # CHECK THE PATH
#================================================= #=================================================
path_url=$(ynh_normalize_url_path $path_url) # Vérifie et corrige la syntaxe du path. # Normalize the URL path syntax
path_url=$(ynh_normalize_url_path $path_url)
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
@ -123,7 +127,8 @@ ynh_maintenance_mode_ON
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
fi fi
#================================================= #=================================================
@ -146,7 +151,8 @@ fi
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_system_user_create $app # Create the dedicated user, if not exist # Create a dedicated user (if not existing)
ynh_system_user_create $app
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -157,15 +163,17 @@ ynh_system_user_create $app # Create the dedicated user, if not exist
# Overwrite the settings config file only if it's allowed # Overwrite the settings config file only if it's allowed
if [ $overwrite_settings -eq 1 ] if [ $overwrite_settings -eq 1 ]
then then
## Copie et configuration du fichier de conf. # Configure Lutim
ynh_backup_if_checksum_is_different "$final_path/lutim.conf" # Créé un backup du fichier de config si il a été modifié. # Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
ynh_backup_if_checksum_is_different "$final_path/lutim.conf"
cp ../conf/lutim.conf.template "$final_path/lutim.conf" cp ../conf/lutim.conf.template "$final_path/lutim.conf"
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/lutim.conf" ynh_replace_string "__DOMAIN__" "$domain" "$final_path/lutim.conf"
ynh_replace_string "__PATH__" "$path_url" "$final_path/lutim.conf" ynh_replace_string "__PATH__" "$path_url" "$final_path/lutim.conf"
ynh_replace_string "__PORT__" "$port" "$final_path/lutim.conf" ynh_replace_string "__PORT__" "$port" "$final_path/lutim.conf"
ynh_replace_string "__ENCRYPT__" "$always_encrypt" "$final_path/lutim.conf" ynh_replace_string "__ENCRYPT__" "$always_encrypt" "$final_path/lutim.conf"
ynh_replace_string "__SECRET__" "$secret" "$final_path/lutim.conf" ynh_replace_string "__SECRET__" "$secret" "$final_path/lutim.conf"
ynh_store_file_checksum "$final_path/lutim.conf" # Réenregistre la somme de contrôle du fichier de config # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum "$final_path/lutim.conf"
# Optional parameters from config-panel feature # Optional parameters from config-panel feature
if [ -n "$antiflood" ]; then if [ -n "$antiflood" ]; then
@ -211,6 +219,7 @@ fi
# SECURING FILES AND DIRECTORIES # SECURING FILES AND DIRECTORIES
#================================================= #=================================================
# Set permissions on app files
chown -R $app: $final_path chown -R $app: $final_path
#================================================= #=================================================
@ -228,8 +237,9 @@ chown $app -R /var/log/$app
ynh_app_setting_set $app skipped_uris "/" ynh_app_setting_set $app skipped_uris "/"
if [ $is_public -eq 0 ] if [ $is_public -eq 0 ]
then # Si l'app est privée, seul le visionnage des images reste public then
# Modifie le domaine pour qu'il passe dans une regex # If the app is private, viewing images stays publicly accessible.
# Modify the domain to be used in a regex
domain_regex=$(echo "$domain" | sed 's@-@.@g') domain_regex=$(echo "$domain" | sed 's@-@.@g')
ynh_app_setting_set $app protected_regex "$domain_regex$path_url/stats$","$domain_regex$path_url/manifest.webapp$","$domain_regex$path_url/$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/m/.*$" ynh_app_setting_set $app protected_regex "$domain_regex$path_url/stats$","$domain_regex$path_url/manifest.webapp$","$domain_regex$path_url/$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/m/.*$"
fi fi
@ -244,7 +254,7 @@ ynh_systemd_action --action=reload --service_name=nginx
# START AND CHECK LUTIM BOOTING # START AND CHECK LUTIM BOOTING
#================================================= #=================================================
# Wait for lutim fully started # Wait for lutim to be fully started
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120" ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
#================================================= #=================================================