mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
helpers2.1: replace ynh_check_app_version_changed with a much simpler ynh_app_upstream_version_changed that can directly be used with 'if ynh_app_upstream_version_changed' instead of the current mess
This commit is contained in:
parent
66508d5fd6
commit
47b2a5695f
1 changed files with 5 additions and 16 deletions
|
@ -476,23 +476,12 @@ ynh_app_upstream_version() {
|
|||
echo "${$YNH_APP_MANIFEST_VERSION/~ynh*/}"
|
||||
}
|
||||
|
||||
# Checks the app version to upgrade with the existing app version and returns:
|
||||
# Return 0 if the "upstream" part of the version changed, or 1 otherwise (ie only the ~ynh suffix changed)
|
||||
#
|
||||
# usage: ynh_check_app_version_changed
|
||||
# | ret: `UPGRADE_APP` if the upstream version changed, `UPGRADE_PACKAGE` otherwise.
|
||||
#
|
||||
# This helper should be used to avoid an upgrade of an app, or the upstream part
|
||||
# of it, when it's not needed
|
||||
#
|
||||
# Requires YunoHost version 3.5.0 or higher.
|
||||
ynh_check_app_version_changed() {
|
||||
local return_value=${YNH_APP_UPGRADE_TYPE}
|
||||
|
||||
if [ "$return_value" == "UPGRADE_SAME" ] || [ "$return_value" == "DOWNGRADE" ]; then
|
||||
return_value="UPGRADE_APP"
|
||||
fi
|
||||
|
||||
echo $return_value
|
||||
# usage: if ynh_app_upstream_version_changed; then ...
|
||||
ynh_app_upstream_version_changed() {
|
||||
# "UPGRADE_PACKAGE" means only the ~ynh prefix changed
|
||||
[[ "$YNH_APP_UPGRADE_TYPE" == "UPGRADE_PACKAGE" ]] && return 1 || return 0
|
||||
}
|
||||
|
||||
# Compare the current package version is strictly lower than another version given as an argument
|
||||
|
|
Loading…
Add table
Reference in a new issue