diff --git a/scripts/restore b/scripts/restore index d94668b..318c488 100755 --- a/scripts/restore +++ b/scripts/restore @@ -9,6 +9,15 @@ # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# CHECK IF THE APP CAN BE RESTORED +#================================================= + +yunohost app checkurl "${domain}${path_url}" -a "$app" \ + || ynh_die "Path not available: ${domain}${path_url}" +test ! -d $final_path \ + || ynh_die "There is already a directory: $final_path " + #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -32,15 +41,6 @@ path_url=$(ynh_app_setting_get $app path) final_path=$(ynh_app_setting_get $app final_path) db_name=$(ynh_app_setting_get $app db_name) -#================================================= -# CHECK IF THE APP CAN BE RESTORED -#================================================= - -yunohost app checkurl "${domain}${path_url}" -a "$app" \ - || ynh_die "Path not available: ${domain}${path_url}" -test ! -d $final_path \ - || ynh_die "There is already a directory: $final_path " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -70,20 +70,6 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql # Create the dedicated user (if not existing) ynh_system_user_create $app -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files -chown -R www-data: $final_path - -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= - -#ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" -#ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini" - #================================================= # SPECIFIC RESTORATION #================================================= @@ -102,6 +88,11 @@ cd $final_path && sudo_path pnpm install cd $final_path && sudo_path pnpm install -g bower gulp cd $final_path && sudo_path bower install -f --allow-root +#================================================= +# RESTORE USER RIGHTS +#================================================= + +# Restore permissions on app files chown -R www-data: $final_path #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 39b7bb3..6d0c13f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -113,8 +113,7 @@ sudo sed -i "s/yunodomain/$domain/g" $final_path/.env ## uses commas because path url contains a slash sudo sed -i "s,yunopath,${path_url},g" $final_path/.env -exec_composer "$final_path" update --quiet --no-dev --prefer-dist \ - || ynh_die "Unable to update monica core dependencies" +exec_composer "$final_path" update --quiet --no-dev --prefer-dist # setup application config cd $final_path && sudo /usr/bin/php7.1 artisan migrate --force