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

Update upgrade

This commit is contained in:
Éric Gaspar 2022-07-23 10:13:51 +02:00
parent 1f305ad64f
commit 7e4cd0263c
No known key found for this signature in database
GPG key ID: 574F281483054D44

View file

@ -64,6 +64,12 @@ if [ -z "$db_name" ]; then
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi 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 lfs_key doesn't exist, create it
if [ -z "$lfs_key" ]; then if [ -z "$lfs_key" ]; then
lfs_key=$(ynh_string_random) 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 if [[ $migration_process -eq 1 ]]; then
# Reload variables # Reload variables
dbname=$app #db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$app #db_user=$db_name
final_path="/opt/$app" #final_path="/opt/$app"
datadir="/home/""$app" #datadir="/home/$app"
repos_path="$datadir/repositories" #repos_path="$datadir/repositories"
data_path="$datadir/data" #data_path="$datadir/data"
# Replace the user # Replace the user
ynh_system_user_delete $old_app ynh_system_user_delete $old_app
@ -121,7 +127,7 @@ if [[ $migration_process -eq 1 ]]; then
# Restore authentication from SQL database # Restore authentication from SQL database
ynh_replace_string --match_string __APP__ --replace_string "$app" --target_file ../conf/login_source.sql 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 # Fix hooks
if [[ -e $repos_path ]];then if [[ -e $repos_path ]];then