2021-02-17 15:46:03 +00:00
|
|
|
#!/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)
|
2023-08-05 21:33:35 +00:00
|
|
|
|
2023-12-07 01:32:55 +00:00
|
|
|
# The old version of the package is passed in as the second argument
|
2023-12-10 18:00:13 +00:00
|
|
|
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" ]
|
|
|
|
}
|
2023-12-07 01:32:55 +00:00
|
|
|
|
2023-12-10 18:00:13 +00:00
|
|
|
# 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
|
2023-12-07 01:32:55 +00:00
|
|
|
echo "## postmarketos-base migrating to logbookd ##"
|
2023-12-10 18:00:13 +00:00
|
|
|
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
|
2023-12-07 01:32:55 +00:00
|
|
|
rc-update add logbookd boot
|
2023-12-10 18:00:13 +00:00
|
|
|
rc-update del syslog boot
|
|
|
|
set +x
|
2023-12-07 01:32:55 +00:00
|
|
|
fi
|
|
|
|
|
2023-08-05 21:33:35 +00:00
|
|
|
# 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
|
|
|
|
|
2024-05-01 16:32:06 +00:00
|
|
|
# Fixup old pmOS /etc/fstab installations that had too little options,
|
|
|
|
# had a wrong type for fat32 and fat16, and missed some options for vfat when
|
|
|
|
# kernels did not use default configs. See pmb!2304
|
|
|
|
# This should be safe to remove after some releases, probably v25.06
|
|
|
|
sed -i -e "s% /boot \(fat32\|fat16\) defaults 0 0$% /boot vfat umask=0077,nodev,nosuid,noexec,nosymfollow,codepage=437,iocharset=ascii 0 0%g" /etc/fstab
|
|
|
|
sed -i -e "s% /boot ext2 defaults 0 0$% /boot ext2 nodev,nosuid,noexec 0 0%g" /etc/fstab
|
|
|
|
|
2023-12-05 17:40:32 +00:00
|
|
|
# To turn zram-init into a no-op, set: deviceinfo_zram_swap_pct="0"
|
|
|
|
rc-update -q add zram-init default
|
2023-12-25 13:45:45 +00:00
|
|
|
# We once enabled tmpfs in default, when it needs bootmisc: pma#2473
|
|
|
|
rc-update -qq del tmpfs default || true
|
2023-12-02 14:09:58 +00:00
|
|
|
# To disable mounting /tmp as tmpfs deviceinfo_tmp_as_tmpfs_size="0"
|
2023-12-25 13:45:45 +00:00
|
|
|
rc-update -q add tmpfs boot
|
2023-12-05 17:40:32 +00:00
|
|
|
|
2023-08-05 21:33:35 +00:00
|
|
|
exit 0
|