Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify redirection formatting, take 2 #133

Merged
merged 3 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bin/post_sfos-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:"
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions bin/sfos-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bin/tidy_log-dupes
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,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."
Expand All @@ -88,7 +88,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
Expand Down