From f1da5932782870a78e2babafb0608a2a245dd517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 2 Mar 2019 00:00:55 +0100 Subject: [PATCH] Reload variable before create user --- scripts/upgrade | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0faa002..5d2a156 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,11 +43,6 @@ systemctl stop "$app".service ynh_handle_app_migration gogs gogs_migrations if [[ $migration_process -eq 1 ]]; then - # Replace the user - ynh_system_user_delete $old_app - test getent passwd "$app" &>/dev/null || \ - useradd -d "$DATADIR" --system --user-group "$app" --shell /bin/bash || \ - ynh_die "Unable to create $app system account" # Reload variables dbname=$app @@ -57,6 +52,12 @@ if [[ $migration_process -eq 1 ]]; then REPO_PATH="$DATADIR/repositories" DATA_PATH="$DATADIR/data" + # Replace the user + ynh_system_user_delete $old_app + test getent passwd "$app" &>/dev/null || \ + useradd -d "$DATADIR" --system --user-group "$app" --shell /bin/bash || \ + ynh_die "Unable to create $app system account" + # Clean old binary ynh_secure_remove $final_path/gogs ynh_secure_remove $final_path/custom/conf/auth.d