Skip to content

Commit

Permalink
Merge branch 'devel' into cleanse-caches_update-apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Olf0 committed Sep 19, 2023
2 parents 6059e21 + 422d2a4 commit cc700c7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
50 changes: 29 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,38 @@ 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'
if command -v pkcon > /dev/null 2>&1
# 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

1 change: 1 addition & 0 deletions rpm/sfos-upgrade.spec
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ BuildArch: noarch
Requires: ssu
Requires: sailfish-version
Requires: curl
Requires: procps

# This description section includes metadata for SailfishOS:Chum, see
# https://github.com/sailfishos-chum/main/blob/main/Metadata.md
Expand Down

0 comments on commit cc700c7

Please sign in to comment.