128f2b150b
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]
41 lines
1.7 KiB
Bash
41 lines
1.7 KiB
Bash
#!/bin/sh
|
|
# WARNING: do not symlink this file to postmarketos-base.post-install!
|
|
# Otherwise it will enable services, as listed in that file. And we don't want
|
|
# 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
|
|
# See https://gitlab.com/postmarketOS/pmaports/-/issues/2168 for context
|
|
# This is probably safe to remove after a couple of releases of the alpine-conf
|
|
# fix having been merged
|
|
[ -L /etc/localtime ] || exit 0
|
|
localtime="$(readlink /etc/localtime)"
|
|
restart="yes"
|
|
case "$localtime" in
|
|
//usr/share/zoneinfo/*) localtime=${localtime#/*} ;;
|
|
//etc/zoneinfo*) localtime="/usr/share/zoneinfo/${localtime#//etc/zoneinfo/*}" ;;
|
|
/etc/zoneinfo/*) localtime="/usr/share/zoneinfo/${localtime#/etc/zoneinfo/*}" ;;
|
|
*) restart="no" ;;
|
|
esac
|
|
ln -sf "$localtime" /etc/localtime
|
|
rm -rf /etc/zoneinfo
|
|
[ "$restart" = "yes" ] && service -qq openrc-settingsd restart
|
|
|
|
# To turn zram-init into a no-op, set: deviceinfo_zram_swap_pct="0"
|
|
rc-update -q add zram-init default
|
|
|
|
exit 0
|