diff --git a/bin/post_sfos-upgrade b/bin/post_sfos-upgrade index def6446..34e016a 100644 --- a/bin/post_sfos-upgrade +++ b/bin/post_sfos-upgrade @@ -34,12 +34,12 @@ printf '%s\n' "- Cleaning logfiles of duplicate entries." tidy_log-dupes "$@" printf '\n' -if command -v store-client > /dev/null 2>&1 +if command -v store-client >/dev/null 2>&1 then printf '%s\n' "- Removing outdated SailfishOS version info for the Jolla Store." for i in -TERM -INT -TERM -HUP -KILL -Failed_to_kill_store-client do - if pgrep -x store-client > /dev/null + if pgrep -x store-client >/dev/null then pkill $i -x store-client else break fi @@ -57,7 +57,7 @@ rm -f "/home/${primuser}/.cache/sailfish-osupdateservice/os-info" "/home/${primu printf '%s\n' "- Cleansing ssu(d)'s caches and restarting it." for i in -TERM -INT -TERM -HUP -KILL -Failed_to_kill_ssud do - if pgrep -x ssud > /dev/null + if pgrep -x ssud >/dev/null then pkill $i -x ssud else break fi @@ -67,7 +67,7 @@ printf '\n' rm -rf /var/cache/ssu/* ssu ur -if command -v zypper > /dev/null 2>&1 +if command -v zypper >/dev/null 2>&1 then # No need to be "brutal": # printf '%s\n' "- Cleansing zypper's caches:" @@ -79,7 +79,7 @@ then zypper update -y -l printf '\n' fi # Not executing either zypper or pkcon but both, because refreshing both of their caches is an important aspect. -if command -v pkcon > /dev/null 2>&1 # Is usually installed, but PackageKit is deliberately not specified as a dependency. +if command -v pkcon >/dev/null 2>&1 # Is usually installed, but PackageKit is deliberately not specified as a dependency. then # This may have become superfluous with SFOS 3.2.0, see # https://together.jolla.com/question/214572/changelog-320-torronsuo/#214572-packagekit diff --git a/bin/sfos-upgrade b/bin/sfos-upgrade index 78d646c..bc425be 100644 --- a/bin/sfos-upgrade +++ b/bin/sfos-upgrade @@ -174,7 +174,7 @@ then exit 3 fi -mylist_sfos_releases='4.5.0.24,4.5.0.21,4.5.0.19,4.5.0.18,4.5.0.16,4.4.0.72,4.4.0.68,4.4.0.64,4.4.0.58,4.3.0.15,4.3.0.12,4.2.0.21,4.2.0.19,4.1.0.24,4.1.0.23,4.0.1.48,4.0.1.45,3.4.0.24,3.4.0.22,3.3.0.16,3.3.0.14,3.2.1.20,3.2.1.19,3.2.0.14,3.2.0.12,3.1.0.12,3.1.0.11,3.0.3.10,3.0.3.9,3.0.3.8,3.0.2.8,3.0.1.14,3.0.1.13,3.0.1.11,3.0.0.11,3.0.0.8,3.0.0.5,2.2.1.23,2.2.1.20,2.2.1.19,2.2.1.18,2.2.0.29,2.1.4.15,2.1.4.14,2.1.4.13,2.1.4.12,2.1.3.7,2.1.3.5,2.1.3.3,2.1.2.3,2.1.1.26,2.1.1.25,2.1.1.24,2.1.1.23,2.1.1.12,2.1.0.11,2.1.0.10,2.1.0.9,2.0.5.6,2.0.4.14,2.0.4.13,2.0.3.14,2.0.3.11,2.0.2.51,2.0.2.48,2.0.2.47,2.0.2.45,2.0.2.43,2.0.1.11,2.0.1.9,2.0.1.7,2.0.0.10,1.1.9.30,1.1.9.28,1.1.9.27,1.1.9.24,1.1.9.23,1.1.7.28,1.1.7.27,1.1.7.25,1.1.7.24,1.1.7.23,1.1.6.27,1.1.6.26,1.1.6.24,1.1.4.29,1.1.4.28,1.1.4.24,1.1.4.22,1.1.2.16,1.1.2.15,1.1.2.13,1.1.2.10,1.1.1.27,1.1.1.26,1.1.1.24,1.1.0.39,1.1.0.38,1.1.0.37,1.1.0.29,1.1.0.26,1.1.0.23,1.1.0.22,1.1.0.19,1.0.8.21,1.0.8.20,1.0.8.19,1.0.8.18,1.0.7.18,1.0.7.16,1.0.7.14,1.0.7.12,1.0.5.19,1.0.5.16,1.0.5.13,1.0.5.12,1.0.5.11,1.0.4.20,1.0.4.16,1.0.4.12,1.0.4.10,1.0.3.8,1.0.3.7,1.0.3.5,1.0.2.5,1.0.1.12,1.0.1.10,1.0.1.6,1.0.0.5,1.0.0.3,1.0.0.1,0.99.6.8,0.99.6.3,0.99.5.11,0.99.5.8,0.99.5.6' +mylist_sfos_releases='4.5.0.25,4.5.0.24,4.5.0.21,4.5.0.19,4.5.0.18,4.5.0.16,4.4.0.72,4.4.0.68,4.4.0.64,4.4.0.58,4.3.0.15,4.3.0.12,4.2.0.21,4.2.0.19,4.1.0.24,4.1.0.23,4.0.1.48,4.0.1.45,3.4.0.24,3.4.0.22,3.3.0.16,3.3.0.14,3.2.1.20,3.2.1.19,3.2.0.14,3.2.0.12,3.1.0.12,3.1.0.11,3.0.3.10,3.0.3.9,3.0.3.8,3.0.2.8,3.0.1.14,3.0.1.13,3.0.1.11,3.0.0.11,3.0.0.8,3.0.0.5,2.2.1.23,2.2.1.20,2.2.1.19,2.2.1.18,2.2.0.29,2.1.4.15,2.1.4.14,2.1.4.13,2.1.4.12,2.1.3.7,2.1.3.5,2.1.3.3,2.1.2.3,2.1.1.26,2.1.1.25,2.1.1.24,2.1.1.23,2.1.1.12,2.1.0.11,2.1.0.10,2.1.0.9,2.0.5.6,2.0.4.14,2.0.4.13,2.0.3.14,2.0.3.11,2.0.2.51,2.0.2.48,2.0.2.47,2.0.2.45,2.0.2.43,2.0.1.11,2.0.1.9,2.0.1.7,2.0.0.10,1.1.9.30,1.1.9.28,1.1.9.27,1.1.9.24,1.1.9.23,1.1.7.28,1.1.7.27,1.1.7.25,1.1.7.24,1.1.7.23,1.1.6.27,1.1.6.26,1.1.6.24,1.1.4.29,1.1.4.28,1.1.4.24,1.1.4.22,1.1.2.16,1.1.2.15,1.1.2.13,1.1.2.10,1.1.1.27,1.1.1.26,1.1.1.24,1.1.0.39,1.1.0.38,1.1.0.37,1.1.0.29,1.1.0.26,1.1.0.23,1.1.0.22,1.1.0.19,1.0.8.21,1.0.8.20,1.0.8.19,1.0.8.18,1.0.7.18,1.0.7.16,1.0.7.14,1.0.7.12,1.0.5.19,1.0.5.16,1.0.5.13,1.0.5.12,1.0.5.11,1.0.4.20,1.0.4.16,1.0.4.12,1.0.4.10,1.0.3.8,1.0.3.7,1.0.3.5,1.0.2.5,1.0.1.12,1.0.1.10,1.0.1.6,1.0.0.5,1.0.0.3,1.0.0.1,0.99.6.8,0.99.6.3,0.99.5.11,0.99.5.8,0.99.5.6' my_recent_sfos_release="${mylist_sfos_releases%%,*}" sailversion_sfos_releases="" sailfishdocs_sfos_list="" @@ -223,7 +223,7 @@ 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.24,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.25,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 @@ -475,7 +475,7 @@ for battery_uevents in $battery_path do # Workaround for Gemini's kernel broken battery information, which contains spaces: Use eval & sed instead of source / ".". # For details, see https://github.com/Olf0/sfos-upgrade/issues/39 - if [ "$battery_uevents" != "$battery_path" ] && [ -s "${battery_uevents}/uevent" ] && eval "$(tr '"' "'" < "${battery_uevents}/uevent" | sed 's/\([]_[:alnum:]]=\)\(.*\)/\1"\2"/')" >/dev/null 2>&1 + if [ "$battery_uevents" != "$battery_path" ] && [ -s "${battery_uevents}/uevent" ] && eval "$(tr '"' "'" <"${battery_uevents}/uevent" | sed 's/\([]_[:alnum:]]=\)\(.*\)/\1"\2"/')" >/dev/null 2>&1 then battery_info=sourced break @@ -740,7 +740,7 @@ then # Unapply all Patchmanager-Patches, if Patchmanager 2.x is installed. if [ -d /var/lib/patchmanager/ausmt/patches/ ] then printf '%s\n' "- Unapplying all Patchmanager-Patches." | tee -a "$logfile" >&2 - if ! patchmanager --unapply-all >> "$logfile" 2>&1 + if ! patchmanager --unapply-all >>"$logfile" 2>&1 then printf '%s\n' "Aborting: Failed to unapply Patchmanager-Patches!" | tee -a "$logfile" >&2 exit 6 diff --git a/bin/tidy_log-dupes b/bin/tidy_log-dupes index f1586b1..ca811a9 100644 --- a/bin/tidy_log-dupes +++ b/bin/tidy_log-dupes @@ -3,7 +3,6 @@ set -u # "-u" (error when using uninitialised variables). # Must not use "-f" (disable pathname expansion) in this script. # Ultimately decided against "-e", because this script better runs through, # despite minor errors; the same applies to "-C" (no-clobber / -overwrite). -set -o pipefail # May not be supported, busybox's ash and bash do. # Using bash (formally) because it is "always there" on SailfishOS: Either the # real bash 3.2.57 (the last GPLv2 version) on SailfishOS less than v4 or via # busybox's bash-symlink (which is deployed by the busybox-symlinks-bash RPM) @@ -58,10 +57,26 @@ fi cd "$logdir" || exit 123 -# Removing stale metadata downloads left over by version --dup -# rm -rf UpdateTestcase-* +# Remove stale metadata downloads left over by `version --dup`? +stale_files='UpdateTestcase-*' +stale_files_expanded="$(printf '%s' $stale_files)" +if [ "$stale_files" != "$stale_files_expanded" ] +then + printf '%s\n' "Notice: Found stale metadata downloads left over by `version --dup`, $stale_files_expanded" + printf '%s' "Delete them? (y/N) " + read yn + case "$yn" in + y|Y) + rm -rf $stale_files + ;; + *) + : + ;; + esac + printf '\n' +fi -if ! set -o pipefail +if ! set -o pipefail # May not be supported, busybox's ash and bash do. then printf '%s\n' "Notice: This shell does not support \"-o pipefail\"." >&2 fi @@ -77,9 +92,9 @@ do printf '%s' "- $logfile" logs_count="$(($logs_count+1))" tidied_log="$(printf '%s' "$logfile" | rev | cut -f 2- -d '-' | rev).txt" - if sed -e 's/\cM//g' -e 's/Installing: [0-9][0-9]*%\x1b\[K//g' -e 's/\x1b\[K/\n/g' -e 's/^\[[0-9][0-9]* %] //g' -e 's/: \[[0-9][0-9]* %]$//g' -e 's/: [0-9][0-9]*%$//g' "$logfile" | uniq 2> /dev/null > "$tidied_log" + if sed -e 's/\cM//g' -e 's/Installing: [0-9][0-9]*%\x1b\[K//g' -e 's/\x1b\[K/\n/g' -e 's/^\[[0-9][0-9]* %] //g' -e 's/: \[[0-9][0-9]* %]$//g' -e 's/: [0-9][0-9]*%$//g' "$logfile" | uniq 2>/dev/null >"$tidied_log" then - if rm "$logfile" 2> /dev/null + if rm "$logfile" 2>/dev/null then logs_success="$(($logs_success+1))" printf '%s\n' ": O.K." @@ -88,7 +103,7 @@ do printf '%s\n' ": Tidied, but failed to remove it!" fi else - rm -f "$tidied_log" 2> /dev/null + rm -f "$tidied_log" 2>/dev/null logs_failed="$(($logs_failed+1))" printf '%s\n' ": Tidying failed!" fi diff --git a/rpm/sfos-upgrade.spec b/rpm/sfos-upgrade.spec index 9737507..a013ed3 100644 --- a/rpm/sfos-upgrade.spec +++ b/rpm/sfos-upgrade.spec @@ -3,7 +3,7 @@ Summary: Scripts for fail-safe upgrading of SailfishOS at the command lin # The Git tag format must adhere to / since 2023-05-18. # The tag must adhere to semantic versioning, for details see # https://semver.org/ -Version: 3.11.2 +Version: 3.11.3 # The tag comprises one of {alpha,beta,rc,release} postfixed with a # natural number greater or equal to 1 (e.g., "beta3") and may additionally be # postfixed with a plus character ("+"), the name of the packager and a release @@ -14,7 +14,7 @@ Version: 3.11.2 # build at GitHub 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 -Release: release2 +Release: release3 # The Group tag should comprise one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Applications/System @@ -89,12 +89,18 @@ Links: %install mkdir -p %{buildroot}%{_bindir} cp bin/* %{buildroot}%{_bindir}/ +mkdir -p %{buildroot}%{_sharedstatedir}/%{name} +touch %{buildroot}%{_sharedstatedir}/%{name}/disabled_user-repos.txt +touch %{buildroot}%{_sharedstatedir}/%{name}/post_no-update-apps %files %defattr(0755,root,root,-) %{_bindir}/%{name} %{_bindir}/post_%{name} %{_bindir}/tidy_log-dupes +%dir %{_sharedstatedir}/%{name} +%ghost %{_sharedstatedir}/%{name}/disabled_user-repos.txt +%ghost %{_sharedstatedir}/%{name}/post_no-update-apps # Changelog format: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/SF4VVE4NBEDQJDJZ4DJ6YW2DTGMWP23E/#6O6DFC6GDOLCU7QC3QJKJ3VCUGAOTD24 %changelog