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

simplier and safer code upgrade process

This commit is contained in:
Jean-Baptiste Holcroft 2019-01-24 08:56:59 +01:00
parent fa3a32da4a
commit aa4a7ab2cc
2 changed files with 11 additions and 4 deletions

View file

@ -79,6 +79,7 @@ then
mv "$final_path/media" "$final_path/code/data/media" mv "$final_path/media" "$final_path/code/data/media"
mv "$final_path/import" "$final_path/code/data/music" mv "$final_path/import" "$final_path/code/data/music"
ynh_secure_remove "$final_path/code" ynh_secure_remove "$final_path/code"
ynh_app_setting_delete "$app" code_migration
fi fi
#================================================= #=================================================

View file

@ -24,6 +24,7 @@ db_user=$db_name
port=$(ynh_app_setting_get "$app" port) port=$(ynh_app_setting_get "$app" port)
db_pwd=$(ynh_app_setting_get "$app" psqlpwd) db_pwd=$(ynh_app_setting_get "$app" psqlpwd)
redis_db=$(ynh_app_setting_get "$app" redis_db) redis_db=$(ynh_app_setting_get "$app" redis_db)
code_migration=$(ynh_app_setting_get "$app" code_migration)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
@ -37,10 +38,15 @@ fi
# make sure we have the last code organization # make sure we have the last code organization
if [ ! -d "$final_path/code/" ]; then if [ ! -d "$final_path/code/" ]; then
mkdir "$final_path-tmp"
mv "$final_path"/* "$final_path-tmp/"
mkdir "$final_path/code" mkdir "$final_path/code"
mv "$final_path"/!(code) "$final_path/code/" mv "$final_path-tmp/data/media" "$final_path/media"
mv "$final_path/code/data/media" "$final_path/media" mv "$final_path-tmp/data/music" "$final_path/import"
mv "$final_path/code/data/music" "$final_path/import" mv "$final_path-tmp"/* "$final_path/code"
ynh_secure_remove "$final_path-tmp/"
ynh_app_setting_set "$app" code_migration 1 ynh_app_setting_set "$app" code_migration 1
fi fi
@ -266,4 +272,4 @@ systemctl reload nginx
# REMOVE CODE MIGRATION FLAG # REMOVE CODE MIGRATION FLAG
#================================================= #=================================================
ynh_app_setting_delete "$app" code_migration ynh_app_setting_set "$app" code_migration 2