pmaports/main/postmarketos-mkinitfs/postmarketos-mkinitfs.post-upgrade
Clayton Craft 1bbb98347d
main/postmarketos-mkinitfs: use new mkinitfs (MR 2426)
This replaces the mkinitfs script with a re-write (in Go). The
re-written mkinitfs will atomically replace the initfs in /boot, check
for free space before doing so, and try to do whatever it can to not
leave the system in an unbootable state by botching the initfs
creation/installation.

pmb:cross-native with go cross compiling doesn't work exactly, it makes
the correct binary, but on Alpine go uses -buildmode=pie which creates a
dynamic thing, and the interpreter is wrong (e.g. it it set to use the
host arch's interpreter, like /lib/ld-musl-x86_64 even though
GOARCH=arm64)

The init.sh script is no longer a template, "initramfs-extra" is used.

Fixes https://gitlab.com/postmarketOS/pmaports/-/issues/1019
fixes https://gitlab.com/postmarketOS/pmaports/-/issues/660
2021-09-03 10:08:34 -07:00

12 lines
478 B
Bash

#!/bin/sh
# This attempts to clean up files in /boot left over from when mkinitfs
# appended kernel 'flavors'. Without doing this cleanup, /boot might be more
# full than it needs to be, and things like copying files atomically in the new
# mkinitfs may not have enough space to do the atomic copy
echo "Cleaning up old boot files..."
for f in /boot/boot.img-* /boot/vmlinuz-* /boot/initramfs-*-extra* /boot/initramfs-*[!-extra]; do
[ -f "$f" ] && rm "$f"
done
exit 0