pmaports/main/postmarketos-base/postmarketos-base.post-upgrade
Pablo Correa Gómez b8cdb84ba7
main/postmarketos-base: enable tmpfs on boot instead of default runlevel (MR 4655)
This was enabled in the "default" runlevel during upgrades, which is an
error, since it depends on bootmisc, which is in "boot" runlevel

Fixes #2473

[ci:skip-build]: Already built successfully in CI.
2023-12-25 08:53:58 -05:00

53 lines
2.2 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="$2"
NEW_VER="$1"
old_ver_less() {
[ "$OLD_VER" != "$1" -a "$(echo -e "$1\n$OLD_VER" | sort -V | head -n1)" = "$OLD_VER" ]
}
# postmarketos-base version 30 moved us to logbookd but we forgot to disable
# syslog... The easiest way to solve this is to just do the upgrade again, sorry
# to anyone who manually disabled logbookd again...
if old_ver_less "31-r1"; then
echo "## postmarketos-base migrating to logbookd ##"
echo "## The initial upgrade didn't disable syslog, we're doing that now ##"
echo "## If you want to keep using syslog, undo the following changes ##"
set -x
rc-update add logbookd boot
rc-update del syslog boot
set +x
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
# We once enabled tmpfs in default, when it needs bootmisc: pma#2473
rc-update -qq del tmpfs default || true
# To disable mounting /tmp as tmpfs deviceinfo_tmp_as_tmpfs_size="0"
rc-update -q add tmpfs boot
exit 0