From 6b83a679c4efb6096c15a076386614f651091111 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 19 Mar 2023 03:51:19 +0100 Subject: [PATCH] Rework stop release handling / determination (#103) * Rework stop release handling / determination * Adapt referenced line number in comment * Add comments * Fix typos * Set version-release to 3.10.0-release1 --- rpm/sfos-upgrade.spec | 4 ++-- usr/bin/sfos-upgrade | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rpm/sfos-upgrade.spec b/rpm/sfos-upgrade.spec index 412b437..ddd0c50 100644 --- a/rpm/sfos-upgrade.spec +++ b/rpm/sfos-upgrade.spec @@ -12,8 +12,8 @@ Summary: Scripts for fail-safe upgrading of SailfishOS at the command lin # and OBS, when configured accordingly; mind the sorting (`adud` < `alpha`). # For details and reasons, see # https://github.com/Olf0/sfos-upgrade/wiki/Git-tag-format -Version: 3.9.22 -Release: release14 +Version: 3.10.0 +Release: release1 Group: Applications/System Distribution: SailfishOS License: LGPL-2.1-only diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index b767556..343ba02 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -7,7 +7,7 @@ export BLOCK_SIZE=512 # For `df` et al, see man-page for GNU `df` export DF_BLOCK_SIZE=512 # For `df` et al, see man-page for GNU `df` # Switched to use bash since version 2.1 of this script (in its first line), as this ensures that "-o pipefail" -# (in line 679) is available, after checking that bash seems to be present in mer-core at least since 2011-10-04 +# (in line 683) is available, after checking that bash seems to be present in mer-core at least since 2011-10-04 # (see https://git.sailfishos.org/mer-core/bash / https://git.merproject.org/mer-core/bash ) and consequently in # SailfishOS since its beginnings (checked v1.0.0.5 per # curl https://releases.sailfishos.org/sources/sailfish-1.0.0.5-oss.tar.bz2 | tar -tv | fgrep 'bash' , as no earlier @@ -223,7 +223,8 @@ else sailfishdocs_stop_releases="" # Because Jolla regularly fails to document their stop releases in a timely manner (see e.g., https://forum.sailfishos.org/t/scripted-download-of-https-jolla-zendesk-com-hc-en-us-articles-201836347-fails/7935/2 ), # I had to change the policy how to deal with this lacking information: All final releases, which are not documented not to be a stop release, are handled as one starting with sfos-upgrade 3.9.1. - mylist_stop_releases="4.5.0.18,4.4.0.72,4.3.0.15,4.2.0.21,4.1.0.24,4.0.1.48,3.4.0.24,3.2.0.12,3.0.0.8,2.2.0.29,2.0.5.6,2.0.0.10,1.1.9.30,1.1.7.28,1.1.2.16,1.0.2.5,1.0.0.5" + # mylist_stop_releases="4.5.0.18,4.4.0.72,4.3.0.15,4.2.0.21,4.1.0.24,4.0.1.48,3.4.0.24,3.2.0.12,3.0.0.8,2.2.0.29,2.0.5.6,2.0.0.10,1.1.9.30,1.1.7.28,1.1.2.16,1.0.2.5,1.0.0.5" + mylist_stop_versions="4.5.0,4.4.0,4.3.0,4.2.0,4.1.0,4.0.1,3.4.0,3.2.0,3.0.0,2.2.0,2.0.5,2.0.0,1.1.9,1.1.7,1.1.2,1.0.2,1.0.0" # 0.99.5.11 and 1.0.1.10 are not documented to be "stop releases" at https://docs.sailfishos.org/Support/Releases/ # But 2.0.5.6 seems to be a "stop release", at least on some devices, see comments thread to # https://together.jolla.com/question/207172/downgrade-sailfish-os/?answer=207190#post-id-207190 @@ -246,7 +247,10 @@ else echo >&2 fi fi - all_stop_releases="$(echo -e "${sailfishdocs_stop_releases}\n$(echo "$mylist_stop_releases" | tr ',' '\n')" | grep -vx '' | sort -u)" + # As of 2023-03-18 (i.e., 4.5.0.18 is the newest release) this works fine despite *and* because of busybox's `sort` lacking `-V`: 3.0.0.11, which was a release only for the Inoi R7, is treated as smaller than 3.0.0.8, which is the correct stop release version of 3.0.0.x. + # But as soon as a stop release version X.Y.Z is publicly released (cBetas are *not* public) with both, point releases smaller and larger than 10, this ceases to work as intended. Likely it will still work out O.K. in practice. + all_stop_versions="$(echo -e "$(echo "$sailfishdocs_stop_releases" | cut -s -d '.' -f 1-3)\n$(echo "$mylist_stop_versions" | tr ',' '\n')" | grep -vx '' | sort -u)" + all_stop_releases="$(for i in $all_stop_versions; do echo "$all_sfos_releases" | grep -xm 1 "${i}\.[0-9][0-9]*"; done)" compar0="$(compare_versions "$installed_release" "$upgrade_release")" case "$compar0" in e?) # Equality