1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/tinyfilemanager_ynh.git synced 2024-09-03 20:36:01 +02:00

Update upgrade

This commit is contained in:
jarod5001 2022-05-08 20:49:46 +02:00 committed by GitHub
parent 55aba69e65
commit 5a228a8b29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,12 +16,13 @@ ynh_script_progression --message="Loading installation settings..." --time --wei
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
domain=$(ynh_app_setting_get --app=$app --key=domain)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
password=$(ynh_app_setting_get --app=$app --key=password)
admin=$(ynh_app_setting_get --app=$app --key=admin)
language=$(ynh_app_setting_get --app=$app --key=language)
#=================================================
# CHECK VERSION
@ -54,9 +55,9 @@ ynh_abort_if_errors
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
# ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
# ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
@ -170,13 +171,13 @@ ynh_script_progression --message="Updating a configuration file..." --time --wei
### The file will automatically be backed-up if it's found to be manually modified (because
### ynh_add_config keeps track of the file's checksum)
ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file"
ynh_add_config --template="../conf/config.php" --destination="$final_path/config.php"
# FIXME: this should be handled by the core in the future
# You may need to use chmod 600 instead of 400,
# for example if the app is expected to be able to modify its own config
chmod 400 "$final_path/some_config_file"
chown $app:$app "$final_path/some_config_file"
chmod 600 "$final_path/config.php"
chown $app:$app "$final_path/config.php"
### For more complex cases where you want to replace stuff using regexes,
### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
@ -188,10 +189,10 @@ chown $app:$app "$final_path/some_config_file"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1
# ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
# ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
@ -206,24 +207,24 @@ ynh_use_logrotate --non-append
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
# ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
# yunohost service add $app --description="A short description of the app" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
# ynh_script_progression --message="Starting a systemd service..." --time --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
# ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# UPGRADE FAIL2BAN
#=================================================
ynh_script_progression --message="Reconfiguring Fail2Ban..." --time --weight=1
# ynh_script_progression --message="Reconfiguring Fail2Ban..." --time --weight=1
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
# ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
#=================================================
# RELOAD NGINX