From 3fa8a86fa80b0b689b7be16cba311c8283c19175 Mon Sep 17 00:00:00 2001 From: Andrew Benson Date: Mon, 29 May 2023 13:55:46 -0500 Subject: [PATCH] linux-base: kernel post-install hook for /boot freepsace --- srcpkgs/linux-base/files/50-bootsize.postinst | 22 +++++++++++++++++++ srcpkgs/linux-base/template | 7 ++++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/linux-base/files/50-bootsize.postinst diff --git a/srcpkgs/linux-base/files/50-bootsize.postinst b/srcpkgs/linux-base/files/50-bootsize.postinst new file mode 100644 index 000000000000..6a0b89e211ea --- /dev/null +++ b/srcpkgs/linux-base/files/50-bootsize.postinst @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Kernel hook to check for filled /boot partitions +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="$1" +VERSION="$2" + +# freespace = blocksize * freeblocks +freespace=$(( $(stat -f -c %S /boot) * $(stat -f -c %f /boot) )) + +# freespace for /boot is <= 100MB +if [ $freespace -le 104857600 ]; then + cat <<-'ENDMSG' + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * WARNING: /boot has less than 100MB available. Use `vkpurge` to ensure * + * there will be sufficient space to write the next kernel and generate * + * its initrd. Your system may otherwise become unbootable. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + ENDMSG +fi diff --git a/srcpkgs/linux-base/template b/srcpkgs/linux-base/template index 249f21fa27f2..0cce02c9e988 100644 --- a/srcpkgs/linux-base/template +++ b/srcpkgs/linux-base/template @@ -1,8 +1,7 @@ # Template file for 'linux-base' pkgname=linux-base -version=2021.07.21 +version=2022.05.29 revision=1 -build_style=meta short_desc="Linux kernel base dependencies" maintainer="Érico Nogueira " license="Public Domain" @@ -16,3 +15,7 @@ case "$XBPS_TARGET_MACHINE" in depends="linux-firmware-amd linux-firmware-nvidia linux-firmware-network dracut" ;; esac + +do_install() { + vinstall ${FILESDIR}/50-bootsize.postinst 0755 etc/kernel.d/post-install 50-bootsize +}