diff --git a/scripts/upgrade b/scripts/upgrade index 78df5c3..48d81eb 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,7 +24,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) random_key=$(ynh_app_setting_get --app=$app --key=random_key) email=$(ynh_user_get_info --username=$admin --key=mail) -update=$(ynh_app_setting_get --app=$app --key=update) +tag=$(ynh_app_upstream_version) phpversion=$YNH_PHP_VERSION #================================================= @@ -90,17 +90,10 @@ then if [ `cd $final_path && git rev-parse --is-inside-work-tree` ]; then pushd "$final_path" - if [ $update -eq 1 ] - then - git fetch --quiet origin tag $latest_tag --no-tags - git checkout --quiet $latest_tag - else - git fetch --quiet origin tag $tag --no-tags - git checkout --quiet $tag --quiet - fi - ynh_secure_remove --file="$final_path/bootstrap/cache/*" - ynh_secure_remove --file="$final_path/vendor/" - popd + ynh_setup_source --dest_dir=$final_path + ynh_secure_remove --file="$final_path/bootstrap/cache/*" + ynh_secure_remove --file="$final_path/vendor/" + popd else ynh_script_progression --message="Upgrading source files..." # Create a temporary directory @@ -116,18 +109,10 @@ then cp -aT "$final_path/storage/export" "$tmpdir/storage/export/" ynh_secure_remove --file="$final_path" - # Download, check integrity, uncompress and patch the source from app.src - if [ $update -eq 1 ] - then - - git clone --quiet -b $latest_tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir=$final_path - else - git clone --quiet -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path - - fi - - ynh_secure_remove bootstrap/cache/* + ynh_secure_remove bootstrap/cache/* # Restore the config file and data mkdir -p "$final_path/storage/upload/" mkdir -p "$final_path/storage/export/"