1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/codimd_ynh.git synced 2024-09-03 18:16:32 +02:00

remove Downward compatibility

This commit is contained in:
ericgaspar 2020-05-21 19:06:18 +02:00
parent c0aeb6c612
commit 7ced7bcd2e
No known key found for this signature in database
GPG key ID: 574F281483054D44

View file

@ -32,35 +32,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
mkdir -p $final_path
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -91,26 +62,25 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=160
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Backup the config file in the temp dir
cp -a "$final_path/config.json" "$tmpdir/config.json"
cp -a "$final_path/.sequelizerc" "$tmpdir/.sequelizerc"
# Backup the config file in the temp dir
cp -a "$final_path/config.json" "$tmpdir/config.json"
cp -a "$final_path/.sequelizerc" "$tmpdir/.sequelizerc"
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
#Copy the admin saved settings from tmp directory to final path
cp -a "$tmpdir/config.json" "$final_path/config.json"
cp -a "$tmpdir/.sequelizerc" "$final_path/.sequelizerc"
#Copy the admin saved settings from tmp directory to final path
cp -a "$tmpdir/config.json" "$final_path/config.json"
cp -a "$tmpdir/.sequelizerc" "$final_path/.sequelizerc"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
fi