mirror of
https://github.com/YunoHost-Apps/keeweb_ynh.git
synced 2024-09-03 19:26:33 +02:00
Fix
This commit is contained in:
parent
1ee9a26566
commit
4f0f627176
7 changed files with 43 additions and 341 deletions
|
@ -4,243 +4,3 @@
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Install or update the main directory yunohost.multimedia
|
|
||||||
#
|
|
||||||
# usage: ynh_multimedia_build_main_dir
|
|
||||||
ynh_multimedia_build_main_dir () {
|
|
||||||
local ynh_media_release="v1.0"
|
|
||||||
local checksum="4852c8607db820ad51f348da0dcf0c88"
|
|
||||||
|
|
||||||
# Download yunohost.multimedia scripts
|
|
||||||
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1
|
|
||||||
|
|
||||||
# Check the control sum
|
|
||||||
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|
|
||||||
|| ynh_die "Corrupt source"
|
|
||||||
|
|
||||||
# Extract
|
|
||||||
mkdir yunohost.multimedia-master
|
|
||||||
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
|
|
||||||
./yunohost.multimedia-master/script/ynh_media_build.sh
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add a directory in yunohost.multimedia
|
|
||||||
# This "directory" will be a symbolic link to a existing directory.
|
|
||||||
#
|
|
||||||
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
|
|
||||||
#
|
|
||||||
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
|
|
||||||
# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
|
|
||||||
ynh_multimedia_addfolder () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
|
|
||||||
local source_dir
|
|
||||||
local dest_dir
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
|
|
||||||
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Move a directory in yunohost.multimedia, and replace by a symbolic link
|
|
||||||
#
|
|
||||||
# usage: ynh_multimedia_movefolder "Source directory" "Destination directory"
|
|
||||||
#
|
|
||||||
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
|
|
||||||
# It will be moved to "Destination directory"
|
|
||||||
# A symbolic link will replace it.
|
|
||||||
# | arg: -d, --dest_dir= - Destination directory - The new name and place of the directory, relative to "/home/yunohost.multimedia"
|
|
||||||
ynh_multimedia_movefolder () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
|
|
||||||
local source_dir
|
|
||||||
local dest_dir
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
|
|
||||||
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --inv --source="$source_dir" --dest="$dest_dir"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Allow an user to have an write authorisation in multimedia directories
|
|
||||||
#
|
|
||||||
# usage: ynh_multimedia_addaccess user_name
|
|
||||||
#
|
|
||||||
# | arg: -u, --user_name= - The name of the user which gain this access.
|
|
||||||
ynh_multimedia_addaccess () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
declare -Ar args_array=( [u]=user_name=)
|
|
||||||
local user_name
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
|
|
||||||
groupadd -f multimedia
|
|
||||||
usermod -a -G multimedia $user_name
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Send an email to inform the administrator
|
|
||||||
#
|
|
||||||
# usage: ynh_send_readme_to_admin app_message [recipients]
|
|
||||||
# | arg: -m --app_message= - The message to send to the administrator.
|
|
||||||
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
|
||||||
# example: "root admin@domain"
|
|
||||||
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
|
||||||
# example: "root admin@domain user1 user2"
|
|
||||||
ynh_send_readme_to_admin() {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
declare -Ar args_array=( [m]=app_message= [r]=recipients= [s]=subject= )
|
|
||||||
local app_message
|
|
||||||
local recipients
|
|
||||||
local subject
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
local app_message="${app_message:-...No specific information...}"
|
|
||||||
local recipients="${recipients:-root}"
|
|
||||||
local subject="☁️🆈🅽🅷☁️: \`$app\`${subject:-" was just installed!"}"
|
|
||||||
|
|
||||||
# Retrieve the email of users
|
|
||||||
find_mails () {
|
|
||||||
local list_mails="$1"
|
|
||||||
local mail
|
|
||||||
local recipients=" "
|
|
||||||
# Read each mail in argument
|
|
||||||
for mail in $list_mails
|
|
||||||
do
|
|
||||||
# Keep root or a real email address as it is
|
|
||||||
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
|
|
||||||
then
|
|
||||||
recipients="$recipients $mail"
|
|
||||||
else
|
|
||||||
# But replace an user name without a domain after by its email
|
|
||||||
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
|
|
||||||
then
|
|
||||||
recipients="$recipients $mail"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "$recipients"
|
|
||||||
}
|
|
||||||
recipients=$(find_mails "$recipients")
|
|
||||||
|
|
||||||
local mail_message="This is an automated message from your beloved YunoHost server.
|
|
||||||
|
|
||||||
Specific information for the application $app.
|
|
||||||
|
|
||||||
$app_message
|
|
||||||
|
|
||||||
---
|
|
||||||
Automatic diagnosis data from YunoHost
|
|
||||||
|
|
||||||
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
|
||||||
|
|
||||||
# Define binary to use for mail command
|
|
||||||
if [ -e /usr/bin/bsd-mailx ]
|
|
||||||
then
|
|
||||||
local mail_bin=/usr/bin/bsd-mailx
|
|
||||||
else
|
|
||||||
local mail_bin=/usr/bin/mail.mailutils
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Send the email to the recipients
|
|
||||||
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$subject" "$recipients"
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Reload (or other actions) a service and print a log in case of failure.
|
|
||||||
#
|
|
||||||
# usage: ynh_system_reload service_name [action]
|
|
||||||
# | arg: -n, --service_name= - Name of the service to reload
|
|
||||||
# | arg: -a, --action= - Action to perform with systemctl. Default: reload
|
|
||||||
ynh_system_reload () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
declare -Ar args_array=( [n]=service_name= [a]=action= )
|
|
||||||
local service_name
|
|
||||||
local action
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
local action=${action:-reload}
|
|
||||||
|
|
||||||
# Reload, restart or start and print the log if the service fail to start or reload
|
|
||||||
systemctl $action $service_name || ( journalctl --lines=20 -u $service_name >&2 && false)
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_maintenance_mode_ON () {
|
|
||||||
# Load value of $path_url and $domain from the config if their not set
|
|
||||||
if [ -z $path_url ]; then
|
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
|
||||||
fi
|
|
||||||
if [ -z $domain ]; then
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create an html to serve as maintenance notice
|
|
||||||
echo "<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="refresh" content="3">
|
|
||||||
<title>Your app $app is currently under maintenance!</title>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
width: 70em;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Your app $app is currently under maintenance!</h1>
|
|
||||||
<p>This app has been put under maintenance by your administrator at $(date)</p>
|
|
||||||
<p>Please wait until the maintenance operation is done. This page will be reloaded as soon as your app will be back.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>" > "/var/www/html/maintenance.$app.html"
|
|
||||||
|
|
||||||
# Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
|
|
||||||
echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice
|
|
||||||
rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect;
|
|
||||||
# Use another location, to not be in conflict with the original config file
|
|
||||||
location ${path_url}_maintenance/ {
|
|
||||||
alias /var/www/html/ ;
|
|
||||||
|
|
||||||
try_files maintenance.$app.html =503;
|
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
}" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
|
||||||
|
|
||||||
# The current config file will redirect all requests to the root of the app.
|
|
||||||
# To keep the full path, we can use the following rewrite rule:
|
|
||||||
# rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect;
|
|
||||||
# The difference will be in the $1 at the end, which keep the following queries.
|
|
||||||
# But, if it works perfectly for a html request, there's an issue with any php files.
|
|
||||||
# This files are treated as simple files, and will be downloaded by the browser.
|
|
||||||
# Would be really be nice to be able to fix that issue. So that, when the page is reloaded after the maintenance, the user will be redirected to the real page he was.
|
|
||||||
|
|
||||||
systemctl reload nginx
|
|
||||||
}
|
|
||||||
|
|
||||||
ynh_maintenance_mode_OFF () {
|
|
||||||
# Load value of $path_url and $domain from the config if their not set
|
|
||||||
if [ -z $path_url ]; then
|
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
|
||||||
fi
|
|
||||||
if [ -z $domain ]; then
|
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app.
|
|
||||||
echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
|
||||||
systemctl reload nginx
|
|
||||||
|
|
||||||
# Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
|
|
||||||
sleep 4
|
|
||||||
|
|
||||||
# Then remove the temporary files used for the maintenance.
|
|
||||||
rm "/var/www/html/maintenance.$app.html"
|
|
||||||
rm "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
|
|
||||||
|
|
||||||
systemctl reload nginx
|
|
||||||
}
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
|
|
@ -24,25 +24,26 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE SYNTAX OF THE PATHS
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||||
|
|
||||||
test -n "$old_path" || old_path="/"
|
# Backup the current version of the app
|
||||||
test -n "$new_path" || new_path="/"
|
ynh_backup_before_upgrade
|
||||||
new_path=$(ynh_normalize_url_path $new_path)
|
ynh_clean_setup () {
|
||||||
old_path=$(ynh_normalize_url_path $old_path)
|
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||||
|
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
# Restore it if the upgrade fails
|
||||||
# ACTIVATE MAINTENANCE MODE
|
ynh_restore_upgradebackup
|
||||||
#=================================================
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
path_url=$old_path
|
ynh_abort_if_errors
|
||||||
domain=$old_domain
|
|
||||||
ynh_maintenance_mode_ON
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
|
@ -60,18 +61,12 @@ then
|
||||||
change_path=1
|
change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE FAILURE OF THE SCRIPT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
|
@ -112,14 +107,6 @@ ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# DEACTIVE MAINTENANCE MODE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
path_url=$old_path
|
|
||||||
domain=$old_domain
|
|
||||||
ynh_maintenance_mode_OFF
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -79,15 +79,9 @@ ynh_replace_string "(no-config)" "config.json" "$final_path/index.html"
|
||||||
#=================================================
|
#=================================================
|
||||||
# COPY THE CONFIG FILE
|
# COPY THE CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding a configuration file..."
|
||||||
|
|
||||||
cp ../conf/config.json "$final_path/config.json"
|
ynh_add_config --template="../conf/config.json" --destination="$final_path/config.json"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Enregistre la somme de contrôle du fichier de config
|
|
||||||
ynh_store_file_checksum "$final_path/config.json"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
@ -116,14 +110,6 @@ ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SEND A README FOR THE ADMIN
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/keeweb_ynh"
|
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="$message" --recipients="root"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -42,4 +42,3 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --last
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
||||||
|
|
|
@ -29,17 +29,9 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Validating restoration parameters..."
|
||||||
|
|
||||||
ynh_webpath_available $domain $path_url \
|
test ! -d $final_path || ynh_die "There is already a directory: $final_path "
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|
||||||
test ! -d $final_path \
|
|
||||||
|| ynh_die "There is already a directory: $final_path "
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ACTIVATE MAINTENANCE MODE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORE STEPS
|
# STANDARD RESTORE STEPS
|
||||||
|
@ -71,20 +63,6 @@ ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# DEACTIVE MAINTENANCE MODE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_maintenance_mode_OFF
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SEND A README FOR THE ADMIN
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
message="If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/keeweb_ynh"
|
|
||||||
|
|
||||||
ynh_send_readme_to_admin --app_message="$message" --recipients="root"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -25,6 +25,19 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
# restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -41,33 +54,20 @@ if ynh_legacy_permissions_exists; then
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Backup the current version of the app
|
|
||||||
ynh_backup_before_upgrade
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# restore it if the upgrade fails
|
|
||||||
ynh_restore_upgradebackup
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ACTIVATE MAINTENANCE MODE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL SOURCES
|
# INSTALL SOURCES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Upgrading source files..." --time --weight=1
|
||||||
|
|
||||||
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
mkdir -p "$final_path"
|
mkdir -p "$final_path"
|
||||||
cp -r ../sources/extra_files/app/* "$final_path"
|
cp -r ../sources/extra_files/app/* "$final_path"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -88,9 +88,7 @@ ynh_replace_string "(no-config)" "config.json" "$final_path/index.html"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Copie ou modification d'un fichier de config
|
# Copie ou modification d'un fichier de config
|
||||||
ynh_backup_if_checksum_is_different "$final_path/config.json" # Créé un backup du fichier de config si il a été modifié.
|
ynh_add_config --template="../conf/config.json" --destination="$final_path/config.json"
|
||||||
cp ../conf/config.json "$final_path/config.json"
|
|
||||||
ynh_store_file_checksum "$final_path/config.json" # Réenregistre la somme de contrôle du fichier de config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
@ -108,12 +106,6 @@ ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# DEACTIVE MAINTENANCE MODE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_maintenance_mode_OFF
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue