Skip to content

Commit

Permalink
develmaster: Commmits for v3.11.2-release1 (#131)
Browse files Browse the repository at this point in the history
* [sfos-upgrade] Suppress `ssu`'s warning when started as non-root user

* [sfos-upgrade] Nitpicking: Align test to message's wording

* [sfos-upgrade] Rectify sloppy quoting

* [sfos-upgrade] Unify file-sysytem comparisons

* [sfos-upgrade] Unify redirection style

* [sfos-upgrade.spec] Post release version increase

* [sfos-upgrade] Add `curl` option `-f` / `--fail`

* [sfos-upgrade] Add 4.5.0.24 as newest release and stop release

* [sfos-upgrade] Add ", or simply re-flash" to user output

* [post_sfos-upgrade] Use `pgrep` / `pkill` option `-x`

* [post_sfos-upgrade] Simplify killing `store-client`

* [sfos-upgrade.spec] Add `Requires:  procps`

* [post_sfos-upgrade] Add cleansing `ssu(d)`'s caches (#129)

* [post_sfos-upgrade] if `pkcon` is installed

* [post_sfos-upgrade] No need to `eval`

* [post_sfos-upgrade] Beautify

* [post_sfos-upgrade] Fix & comment

* [post_sfos-upgrade] Omit incorrect quoting
  • Loading branch information
Olf0 authored Sep 20, 2023
2 parents 35588a7 + cf669c8 commit e78f703
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 63 deletions.
51 changes: 30 additions & 21 deletions bin/post_sfos-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ then
exit 1
fi

if ! [ "$(uptime | cut -f 1 -d ',' | rev | grep '^nim ' | cut -f 2 -d ' ' | rev)" -lt 4 ] 2> /dev/null
if ! [ "$(uptime | cut -f 1 -d ',' | rev | grep '^nim ' | cut -f 2 -d ' ' | rev)" -lt 4 ] 2>/dev/null
then
printf '%s\n\n' "Notice: Mind that $called is best run on a freshly rebooted device."
fi
Expand All @@ -36,11 +36,11 @@ printf '\n'

if command -v store-client > /dev/null 2>&1
then
printf '%s\n' "- Removing outdated Store version info."
for i in '-TERM' '-INT' '-TERM' '-HUP' '-KILL' '-Failed_to_kill_store-client'
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 store-client > /dev/null
then eval pkill "$i" store-client # Or using the classic: `pkill "$(echo $i)" store-client`
if pgrep -x store-client > /dev/null
then pkill $i -x store-client
else break
fi
sleep 1
Expand All @@ -54,30 +54,39 @@ primuser="$(loginctl list-sessions | fgrep seat0 | tr -s ' ' | cut -d ' ' -f 4)"
# Paths for SailfishOS ≥ 2.2.1 rsp. SailfishOS < 2.2.1, see chapter "Final clean up" at https://docs.sailfishos.org/Support/Help_Articles/Updating_Sailfish_OS/#final-clean-up
rm -f "/home/${primuser}/.cache/sailfish-osupdateservice/os-info" "/home/${primuser}/.cache/store-client/os-info"

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
then pkill $i -x ssud
else break
fi
sleep 1
done
printf '\n'
rm -rf /var/cache/ssu/*
ssu ur

if command -v zypper > /dev/null 2>&1
then
# No need to be "brutal":
# printf '%s\n' "- Cleaning zypper's caches:"
# printf '%s\n' "- Cleansing zypper's caches:"
# zypper clean -m || exit $?
printf '%s\n' "- Refreshing zypper's caches:"
zypper refresh || exit $?
printf '\n'
# Syncing, as I could not determine if zypper already does that:
sync
printf '%s\n' "- Checking for updates by zypper:"
printf '\n%s\n' "- Checking for updates by zypper:"
# As of SailfishOS 4.1.0, `version --dup` does not seem to always update all packages, any more:
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.
# This may have become superfluous with SFOS 3.2.0, see
# https://together.jolla.com/question/214572/changelog-320-torronsuo/#214572-packagekit
# Would need to investigate, but refreshing twice will do no harm, anyway.
printf '%s\n' "- Refreshing pkcon's caches:"
pkcon refresh || exit $?
printf '%s\n' "- Checking for updates by pkcon:"
# As of SailfishOS 4.1.0, `version --dup` does not seem to always update all packages, any more:
pkcon -y update
fi

# This may have become superfluous with SFOS 3.2.0, see
# https://together.jolla.com/question/214572/changelog-320-torronsuo/#214572-packagekit
# Would need to investigate, but refreshing twice will do no harm, anyway.
printf '%s\n' "- Refreshing pkcon's caches:"
pkcon refresh || exit $?
# Syncing, as I could not determine if pkcon already does that:
sync
printf '%s\n' "- Checking for updates by pkcon:"
# As of SailfishOS 4.1.0, `version --dup` does not seem to always update all packages, any more:
pkcon -y update

Loading

0 comments on commit e78f703

Please sign in to comment.