diff --git a/scripts/upgrade b/scripts/upgrade index 25f14a5..b8bc9e9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -64,6 +64,12 @@ if [ -z "$db_name" ]; then 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=/opt/$app + ynh_app_setting_set --app=$app --key=final_path --value=$final_path +fi + # If lfs_key doesn't exist, create it if [ -z "$lfs_key" ]; then lfs_key=$(ynh_string_random) @@ -102,12 +108,12 @@ ynh_handle_app_migration --migration_id=gogs --migration_list=gogs_migrations if [[ $migration_process -eq 1 ]]; then # Reload variables - dbname=$app - db_user=$app - final_path="/opt/$app" - datadir="/home/""$app" - repos_path="$datadir/repositories" - data_path="$datadir/data" + #db_name=$(ynh_sanitize_dbid --db_name=$app) + #db_user=$db_name + #final_path="/opt/$app" + #datadir="/home/$app" + #repos_path="$datadir/repositories" + #data_path="$datadir/data" # Replace the user ynh_system_user_delete $old_app @@ -121,7 +127,7 @@ if [[ $migration_process -eq 1 ]]; then # Restore authentication from SQL database ynh_replace_string --match_string __APP__ --replace_string "$app" --target_file ../conf/login_source.sql - ynh_mysql_connect_as "$db_user" "$db_password" "$dbname" < ../conf/login_source.sql + ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" < ../conf/login_source.sql # Fix hooks if [[ -e $repos_path ]];then