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 <caleb@connolly.tech>

[ci:skip-vercheck]
This commit is contained in:
Caleb Connolly 2023-12-07 01:32:55 +00:00 committed by Clayton Craft
parent 3460ae18d4
commit 128f2b150b
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A

View file

@ -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