From 128f2b150bdf6ebd1a84ad6fb67d94a22e92404c Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Thu, 7 Dec 2023 01:32:55 +0000 Subject: [PATCH] main/postmarketos-base: enable logbookd on upgrade (MR 4549) Logging is important, we want our users to have logging, so make sure we enable the new logbookd service on existing installation. We check that we're upgrading from a postmarketos-base version that predates logbookd and only enable the service in this case. This way we won't enable it again for folks who disabled it manually. Signed-off-by: Caleb Connolly [ci:skip-vercheck] --- .../postmarketos-base/postmarketos-base.post-upgrade | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main/postmarketos-base/postmarketos-base.post-upgrade b/main/postmarketos-base/postmarketos-base.post-upgrade index a1ae74d45..dae9c7469 100644 --- a/main/postmarketos-base/postmarketos-base.post-upgrade +++ b/main/postmarketos-base/postmarketos-base.post-upgrade @@ -4,6 +4,18 @@ # this to happen during upgrade, especially not automatically enabling the sshd # service! (build.postmarketos.org#85) +# The old version of the package is passed in as the second argument +OLD_VER="$(echo $2 | cut -d "-" -f 1)" + +# postmarketos-base version 30 moves us from openrc-syslog to logbookd +# so enable the logbookd service if we're upgrading from an older version. +# If we're upgrading from a newer version, then we're already using logbookd +# and the user may have disabled the service, so don't re-enable it. +if [ $OLD_VER -lt 30 ]; then + echo "## postmarketos-base migrating to logbookd ##" + rc-update add logbookd boot +fi + # Fixup old pmOS installations that run setup-timezone without "-i" option # and those later installations that run with it, but have missing # https://gitlab.alpinelinux.org/alpine/alpine-conf/-/merge_requests/157