diff --git a/scripts/upgrade b/scripts/upgrade index 4598e9a..9746ad3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -15,11 +15,11 @@ source /usr/share/yunohost/helpers app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -final_path=$(ynh_app_setting_get $app final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -db_pwd=$(ynh_app_setting_get $app mysqlpwd) +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) #================================================= # CHECK VERSION @@ -61,15 +61,20 @@ ynh_abort_if_errors ynh_maintenance_mode_ON #================================================= -# STANDARD UPGRADE STEPS +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_setup_source "$final_path" # Télécharge la source, décompresse et copie dans $final_path - + ynh_setup_source "$final_path" # Delete the install directory. # Keep it for the manual upgrade process... # ynh_secure_remove "$final_path/install" @@ -78,20 +83,18 @@ fi #================================================= # NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 +# Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= - -ynh_system_user_create $app # Create the dedicated user, if not exist - #================================================= # PHP-FPM CONFIGURATION #================================================= +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 -ynh_add_fpm_config # Créer le fichier de configuration du pool php-fpm et le configure. +# Create a dedicated PHP-FPM config +ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE @@ -141,11 +144,11 @@ then # Run database upgrades # Upgrade to 2.1.23.4 - ynh_mysql_execute_as_root "ALTER TABLE teampass_misc ADD id INT(12) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (id);" $app >&2 + #ynh_mysql_execute_as_root "ALTER TABLE teampass_misc ADD id INT(12) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (id);" $app >&2 # Upgrade to 2.1.24.4 - ynh_mysql_execute_as_root "ALTER TABLE teampass_items CHANGE pw_len pw_len INT(5) NOT NULL DEFAULT '0';" $app >&2 + #ynh_mysql_execute_as_root "ALTER TABLE teampass_items CHANGE pw_len pw_len INT(5) NOT NULL DEFAULT '0';" $app >&2 # Upgrade to 2.1.25.2 - ynh_mysql_execute_as_root "INSERT INTO teampass_misc (id, type, intitule, valeur) VALUES (NULL, 'admin', 'encryption_protocol', 'ctr');" $app >&2 + #ynh_mysql_execute_as_root "INSERT INTO teampass_misc (id, type, intitule, valeur) VALUES (NULL, 'admin', 'encryption_protocol', 'ctr');" $app >&2 # Upgrade to 2.1.27.x ynh_mysql_execute_as_root "ALTER TABLE teampass_misc CHANGE id increment_id INT(12) NOT NULL AUTO_INCREMENT;" $app >&2 fi