From aa0b95f91e24ce31bc946f00a1ccf1f6c45c72c4 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 02:53:34 +0100 Subject: [PATCH 01/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index dc2c25a..83b3f13 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -388,18 +388,15 @@ then fi fi -if expr "$installed_release" '<' "1.0.4.0" > /dev/null && openrepos_repos="$(ssu lr | sed -n '/Enabled/,/Disabled/p' | fgrep 'openrepo')" && true +# Simplified since v2.3, because ssu dr seems to *always* return "O.K.": +if expr "$installed_release" '<' "1.0.4.0" > /dev/null && openrepos_repos="$(ssu lr | fgrep 'openrepo')" && true then # Reference: https://jolla.zendesk.com/hc/en-us/articles/201836347#5 echo "- Disabling OpenRepos\' repositories:" | tee -a "$logfile" for i in $(echo "$openrepos_repos" | cut -f 3 -d ' ') do echo "$i" | tee -a "$logfile" - if ! ssu dr "$i" 2>&1 | tee -a "$logfile" - then - echo "Disabling OpenRepos\' repository $i failed: aborting!" | tee -a "$logfile" - exit 6 - fi + ssu dr "$i" 2>&1 | tee -a "$logfile" done echo | tee -a "$logfile" fi From 6a4afa7dae86ea7eb97e1f8cbbd296b7b5f67cbe Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 03:11:29 +0100 Subject: [PATCH 02/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index 83b3f13..6c00dfe 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -357,11 +357,11 @@ do if systemctl status "$i" > /dev/null 2>&1 then echo "- Stopping $i" | tee -a "$logfile" - if systemctl stop "$i" 2>&1 | tee -a "$logfile" - then echo | tee -a "$logfile" - else + if ! systemctl stop "$i" 2>&1 | tee -a "$logfile" + then echo -n "Warning: Failed to stop $i! Continue?" | tee -a "$logfile" askyes + else echo | tee -a "$logfile" fi fi done @@ -369,23 +369,23 @@ done if [ -x /usr/share/harbour-themepacksupport/ocr.sh ] then echo "- Disabling Theme Pack Support." | tee -a "$logfile" - if /usr/share/harbour-themepacksupport/ocr.sh 2>&1 | tee -a "$logfile" - then echo | tee -a "$logfile" - else + if ! /usr/share/harbour-themepacksupport/ocr.sh 2>&1 | tee -a "$logfile" + then echo "Disabling Theme Pack Support failed: aborting!" | tee -a "$logfile" exit 6 fi + echo | tee -a "$logfile" fi if which patchmanager > /dev/null 2>&1 then echo "- Unapplying all Patchmanager-Patches." | tee -a "$logfile" - if patchmanager --unapply-all >> "$logfile" 2>&1 - then echo | tee -a "$logfile" - else + if ! patchmanager --unapply-all >> "$logfile" 2>&1 + then echo "Unapplying Patchmanager-Patches failed: aborting!" | tee -a "$logfile" exit 6 fi + echo | tee -a "$logfile" fi # Simplified since v2.3, because ssu dr seems to *always* return "O.K.": @@ -404,12 +404,12 @@ fi if [ -n "$set_ssu" ] then echo "- Setting SSU to SailfishOS release:" | tee -a "$logfile" - if ssu re "$upgrade_release" 2>&1 | tee -a "$logfile" - then echo | tee -a "$logfile" - else + if ! ssu re "$upgrade_release" 2>&1 | tee -a "$logfile" + then echo "Setting SSU to release $upgrade_release failed: aborting!" | tee -a "$logfile" exit 6 fi + echo | tee -a "$logfile" fi echo "- Fetching and installing the SailfishOS upgrade from $installed_release to $upgrade_release (this may take a while):" | tee -a "$logfile" From e316535cb71e058e4bc81180e88aeaf761550a97 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 03:25:18 +0100 Subject: [PATCH 03/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index 6c00dfe..9298aa4 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -361,6 +361,7 @@ do then echo -n "Warning: Failed to stop $i! Continue?" | tee -a "$logfile" askyes + echo >> "$logfile" else echo | tee -a "$logfile" fi fi From bb762404b9266faad584b4401d1756b1b6be9395 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 04:34:56 +0100 Subject: [PATCH 04/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index 9298aa4..0692966 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -348,21 +348,20 @@ then echo | tee -a "$logfile" fi -for i in cron.service \ - btrfs-balancer.timer btrfs-balance.service - # How to query the status of and stop these units as root, which are started as user nemo? - #btrfsstatuschecker.service btrfschecker.timer btrfschecker.service beforebtrfscheckertimer.service \ - #batterynotifierstatuschecker.service batterynotifier.timer batterynotifier.service +for i in 'cron.service' \ + '--user btrfsstatuschecker.service' '--user btrfschecker.timer' '--user btrfschecker.service' '--user beforebtrfscheckertimer.service' \ + '--user batterynotifierstatuschecker.service' '--user batterynotifier.timer' '--user batterynotifier.service' \ + 'btrfs-balancer.timer' 'btrfs-balance.service' do - if systemctl status "$i" > /dev/null 2>&1 + if systemctl status $i > /dev/null 2>&1 then - echo "- Stopping $i" | tee -a "$logfile" - if ! systemctl stop "$i" 2>&1 | tee -a "$logfile" - then - echo -n "Warning: Failed to stop $i! Continue?" | tee -a "$logfile" + echo "- Stopping "$i | tee -a "$logfile" + if systemctl stop $i 2>&1 | tee -a "$logfile" + then echo | tee -a "$logfile" + else + echo -n "Warning: Failed to stop $(echo $i | rev | cut -f 1 -d ' ' | rev)! Continue?" | tee -a "$logfile" askyes echo >> "$logfile" - else echo | tee -a "$logfile" fi fi done From f17a233723fedb7f05be3d203c95344957ef561c Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 04:45:30 +0100 Subject: [PATCH 05/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index 0692966..a31e5b1 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -360,8 +360,7 @@ do then echo | tee -a "$logfile" else echo -n "Warning: Failed to stop $(echo $i | rev | cut -f 1 -d ' ' | rev)! Continue?" | tee -a "$logfile" - askyes - echo >> "$logfile" + askyes | tee -a "$logfile" fi fi done From 59994baabcf3a6acb1bdfef9de40b75d423f6fdb Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 05:12:57 +0100 Subject: [PATCH 06/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index a31e5b1..24296d8 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -355,11 +355,12 @@ for i in 'cron.service' \ do if systemctl status $i > /dev/null 2>&1 then - echo "- Stopping "$i | tee -a "$logfile" + thisservice="$(echo $i | rev | cut -f 1 -d ' ' | rev)" + echo "- Stopping $thisservice" | tee -a "$logfile" if systemctl stop $i 2>&1 | tee -a "$logfile" then echo | tee -a "$logfile" else - echo -n "Warning: Failed to stop $(echo $i | rev | cut -f 1 -d ' ' | rev)! Continue?" | tee -a "$logfile" + echo -n "Warning: Failed to stop ${thisservice}! Continue?" | tee -a "$logfile" askyes | tee -a "$logfile" fi fi From ae5aedda2d92ebd506b8122a1a13c80a452be1dc Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 16:10:11 +0100 Subject: [PATCH 07/14] Update sfos-upgrade.spec --- rpm/sfos-upgrade.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpm/sfos-upgrade.spec b/rpm/sfos-upgrade.spec index c97a79a..db77cc5 100644 --- a/rpm/sfos-upgrade.spec +++ b/rpm/sfos-upgrade.spec @@ -1,6 +1,6 @@ Name: sfos-upgrade Summary: Scripts for safe and automated upgrading of SailfishOS with logging -Version: 2.2 +Version: 2.3 Release: 1 Group: System/Base Distribution: SailfishOS From 94f27bf810bc50e97a5eb862acee9d5baf5d0dbe Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 16:13:14 +0100 Subject: [PATCH 08/14] Update post_sfos-upgrade --- usr/bin/post_sfos-upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/bin/post_sfos-upgrade b/usr/bin/post_sfos-upgrade index 688f4a3..725a136 100644 --- a/usr/bin/post_sfos-upgrade +++ b/usr/bin/post_sfos-upgrade @@ -25,7 +25,7 @@ then do if pgrep store-client > /dev/null then - pkill $i store-client + pkill $(echo $i) store-client sleep 1 else break fi From f3d58b68b1ba8cd443ffe579fb2b4ff255752a9c Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 16:24:02 +0100 Subject: [PATCH 09/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index 24296d8..afc211d 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -353,11 +353,11 @@ for i in 'cron.service' \ '--user batterynotifierstatuschecker.service' '--user batterynotifier.timer' '--user batterynotifier.service' \ 'btrfs-balancer.timer' 'btrfs-balance.service' do - if systemctl status $i > /dev/null 2>&1 + if systemctl status $(echo $i) > /dev/null 2>&1 then thisservice="$(echo $i | rev | cut -f 1 -d ' ' | rev)" echo "- Stopping $thisservice" | tee -a "$logfile" - if systemctl stop $i 2>&1 | tee -a "$logfile" + if systemctl stop $(echo $i) 2>&1 | tee -a "$logfile" then echo | tee -a "$logfile" else echo -n "Warning: Failed to stop ${thisservice}! Continue?" | tee -a "$logfile" From 2764250e26d28c48717758a752a556dea8ff9db1 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 16:46:37 +0100 Subject: [PATCH 10/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index afc211d..f120815 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -355,12 +355,12 @@ for i in 'cron.service' \ do if systemctl status $(echo $i) > /dev/null 2>&1 then - thisservice="$(echo $i | rev | cut -f 1 -d ' ' | rev)" - echo "- Stopping $thisservice" | tee -a "$logfile" + this_service="$(echo $i | rev | cut -f 1 -d ' ' | rev)" + echo "- Stopping $this_service" | tee -a "$logfile" if systemctl stop $(echo $i) 2>&1 | tee -a "$logfile" then echo | tee -a "$logfile" else - echo -n "Warning: Failed to stop ${thisservice}! Continue?" | tee -a "$logfile" + echo -n "Warning: Failed to stop ${this_service}! Continue?" | tee -a "$logfile" askyes | tee -a "$logfile" fi fi From 76f62bcd3135ec3802f3f8ea2bb7a25aad58b043 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 16:54:55 +0100 Subject: [PATCH 11/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index f120815..69d9cb3 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -348,6 +348,7 @@ then echo | tee -a "$logfile" fi +emit_newline="" for i in 'cron.service' \ '--user btrfsstatuschecker.service' '--user btrfschecker.timer' '--user btrfschecker.service' '--user beforebtrfscheckertimer.service' \ '--user batterynotifierstatuschecker.service' '--user batterynotifier.timer' '--user batterynotifier.service' \ @@ -358,13 +359,17 @@ do this_service="$(echo $i | rev | cut -f 1 -d ' ' | rev)" echo "- Stopping $this_service" | tee -a "$logfile" if systemctl stop $(echo $i) 2>&1 | tee -a "$logfile" - then echo | tee -a "$logfile" + then emit_newline="y" else echo -n "Warning: Failed to stop ${this_service}! Continue?" | tee -a "$logfile" askyes | tee -a "$logfile" + emit_newline="y" fi fi done +if [ -n "$emit_newline" ] +then echo | tee -a "$logfile" +fi if [ -x /usr/share/harbour-themepacksupport/ocr.sh ] then From 96a6bafa9a4095d9cf6d74bf1c32e71edaf29c3f Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 17:02:02 +0100 Subject: [PATCH 12/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index 69d9cb3..10aba3e 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -30,7 +30,7 @@ askyes () read yn case "$yn" in y|Y) - echo + true ;; *) echo "Aborted by user." @@ -110,6 +110,7 @@ then echo "$upgrade_release does not seem to be a publicly released SailfishOS version!" echo -n "Do you really want to continue?" askyes + echo fi if mount -t btrfs | cut -f 3 -d ' ' | grep -q '^/$' @@ -308,6 +309,7 @@ ask) echo "When a power loss occurs during the upgrade process, it will fail." echo -n "Do you really want to continue?" askyes + echo ;; ok) true @@ -331,6 +333,7 @@ else echo -n "Do you want to upgrade SailfishOS from $installed_release to $upgrade_release?" fi askyes +echo logfile="/var/log/systemupdate_${upgrade_release}-from-${installed_release}_$(date +'%F_%H-%M-%S').log-dupes.txt" if ! touch "$logfile" From fb1806dedc4b06320c0dc4d26be36672d83ddf1c Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 17:23:09 +0100 Subject: [PATCH 13/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index 10aba3e..46ecffc 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -361,13 +361,12 @@ do then this_service="$(echo $i | rev | cut -f 1 -d ' ' | rev)" echo "- Stopping $this_service" | tee -a "$logfile" - if systemctl stop $(echo $i) 2>&1 | tee -a "$logfile" - then emit_newline="y" - else + if ! systemctl stop $(echo $i) 2>&1 | tee -a "$logfile" + then echo -n "Warning: Failed to stop ${this_service}! Continue?" | tee -a "$logfile" askyes | tee -a "$logfile" - emit_newline="y" fi + emit_newline="y" fi done if [ -n "$emit_newline" ] From 097eef8ffb340bd8f39d46f8d24a4bbabc68b8c6 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 3 Mar 2019 17:59:10 +0100 Subject: [PATCH 14/14] Update sfos-upgrade --- usr/bin/sfos-upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/bin/sfos-upgrade b/usr/bin/sfos-upgrade index 46ecffc..4b34536 100644 --- a/usr/bin/sfos-upgrade +++ b/usr/bin/sfos-upgrade @@ -399,7 +399,7 @@ fi if expr "$installed_release" '<' "1.0.4.0" > /dev/null && openrepos_repos="$(ssu lr | fgrep 'openrepo')" && true then # Reference: https://jolla.zendesk.com/hc/en-us/articles/201836347#5 - echo "- Disabling OpenRepos\' repositories:" | tee -a "$logfile" + echo "- Disabling OpenRepos' repositories:" | tee -a "$logfile" for i in $(echo "$openrepos_repos" | cut -f 3 -d ' ') do echo "$i" | tee -a "$logfile"