1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_ynh.git synced 2024-09-03 20:26:22 +02:00

Update upgrade extionsions script

This commit is contained in:
Fabian Wilkens 2021-02-07 00:02:09 +01:00
parent a5b21ea4d2
commit a4785f8611
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
4 changed files with 16 additions and 28 deletions

View file

@ -29,7 +29,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
install_extensions=$(ynh_app_setting_get --app=$app --key=install_extensions)
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain) access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
# Add settings here as needed by your application # Add settings here as needed by your application

View file

@ -194,9 +194,6 @@ basename=$(basename -as .src $file)
ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename" ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
done done
install_extensions=1
ynh_app_setting_set --app=$app --key=install_extensions --value=$install_extensions
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================

View file

@ -35,7 +35,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
install_extensions=$(ynh_app_setting_get --app=$app --key=install_extensions)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED

View file

@ -25,7 +25,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
install_extensions=$(ynh_app_setting_get --app=$app --key=install_extensions)
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain) access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
mail=$(ynh_app_setting_get --app=$app --key=mail) mail=$(ynh_app_setting_get --app=$app --key=mail)
@ -81,12 +80,6 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
# If install_extensions doesn't exist, create it
if [ -z "$install_extensions" ]; then
install_extensions=0
ynh_app_setting_set --app=$app --key=install_extensions --value=$install_extensions
fi
# If access_domain doesn't exist, create it # If access_domain doesn't exist, create it
if [ -z "$access_domain" ]; then if [ -z "$access_domain" ]; then
access_domain=$domain access_domain=$domain
@ -99,15 +92,6 @@ if [ -z "$mail" ]; then
ynh_app_setting_set --app=$app --key=mail --value=$mail ynh_app_setting_set --app=$app --key=mail --value=$mail
fi fi
if [[ ! -d "$final_path/live/public/extensions/" || \
! -d "$final_path/live/public/extensions/src/" ]]
then
if test -e "../sources/extra_files/app"
then
cp -a "../sources/extra_files/app/." "$final_path/live"
fi
fi
if ynh_compare_current_package_version --comparison lt --version "3.13.6~ynh4" if ynh_compare_current_package_version --comparison lt --version "3.13.6~ynh4"
then then
# Add Variables to .env config file # Add Variables to .env config file
@ -140,10 +124,9 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Backup files to keep # Backup files to keep
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
if [ -d "$final_path/live/.env" ] ; then if [ -d "$final_path/live/.env" ] ; then
@ -165,6 +148,20 @@ then
fi fi
fi fi
if [ "$upgrade_type" == "UPGRADE_PACKAGE" ]
then
ynh_secure_remove --file="$final_path/live/public/extensions"
fi
if [[ ! -d "$final_path/live/public/extensions/" || \
! -d "$final_path/live/public/extensions/src/" ]]
then
if test -e "../sources/extra_files/app"
then
cp -a "../sources/extra_files/app/." "$final_path/live"
fi
fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -244,7 +241,7 @@ fi
#================================================= #=================================================
# INSTALLING Standard Notes - Extensions # INSTALLING Standard Notes - Extensions
#================================================= #=================================================
ynh_script_progression --message="Reinstalling Standard Notes - Extensions..." --weight=1 ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
if [ $path_url = "/" ] if [ $path_url = "/" ]
then then
@ -266,10 +263,6 @@ do
ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename" ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
done done
install_extensions=1
ynh_app_setting_set --app=$app --key=install_extensions --value=$install_extensions
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================