Github messages for voidlinux
 help / color / mirror / Atom feed
From: abenson <abenson@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] [RFC] base-files: add kernel hook for /boot freespace
Date: Tue, 04 Jul 2023 04:59:03 +0200	[thread overview]
Message-ID: <20230704025903.CmP58Xqb7np_twfxENdb219NhVMQcgKiGlkuipnTe7Y@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-44137@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 768 bytes --]

There is an updated pull request by abenson against master on the void-packages repository

https://github.com/abenson/void-packages kernel_bootsize_hook
https://github.com/void-linux/void-packages/pull/44137

[RFC] base-files: add kernel hook for /boot freespace
    <leah2> we should make a kernel install hook check that prints a big
            warning if /boot is full after running it...

Thoughts:

1. Change the threshold size? Make it configurable?
2. Change the threshold to a percentage? I think that's less useful.
3. Change what package this is shipped with? I'm not sure if it applies to all configurations we support/consider.
4. Wording of the message?

A patch file from https://github.com/void-linux/void-packages/pull/44137.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-kernel_bootsize_hook-44137.patch --]
[-- Type: text/x-diff, Size: 2805 bytes --]

From 33cb87ebcb78a5fdfe33c0bd041d488d3ffd4c99 Mon Sep 17 00:00:00 2001
From: Andrew Benson <abenson+void@gmail.com>
Date: Mon, 29 May 2023 13:55:46 -0500
Subject: [PATCH] linux-base: post-install hook for /boot freespace

Co-authored-by: classabbyamp <5366828+classabbyamp@users.noreply.github.com>
---
 srcpkgs/linux-base/files/50-bootsize.postinst | 38 +++++++++++++++++++
 srcpkgs/linux-base/template                   |  7 +++-
 2 files changed, 43 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..1fe95c9511bb
--- /dev/null
+++ b/srcpkgs/linux-base/files/50-bootsize.postinst
@@ -0,0 +1,38 @@
+#!/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 * %f' /boot) ))
+
+vmlinuz=$(find /boot -maxdepth 1 -type f -name 'vmlinuz*' -printf '%s\n' | sort -n | tail -n1)
+initramfs=$(find /boot -maxdepth 1 -type f -name 'initramfs*' -printf '%s\n' | sort -n | tail -n1)
+totalneeded=$(( 2 * (initramfs + vmlinuz) ))
+
+# freespace for /boot is <=  2*(largest kernel + largest initrd)
+if [ $freespace -le $totalneeded ]; then
+	color=false
+	if [ -z "$NO_COLOR" ] && [ -t 1 ]; then
+		# Set output to be bold and red, if supported
+		color=true
+		tput setaf 1
+		tput bold
+	fi
+	cat <<-'ENDMSG'
+	 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+	 * WARNING: /boot may not have enough space for the next kernel. 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
+	if $color; then
+		# Reset output back to normal
+		tput sgr0
+	fi
+fi
diff --git a/srcpkgs/linux-base/template b/srcpkgs/linux-base/template
index 249f21fa27f2..d04e7ad12bb6 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=2023.05.29
 revision=1
-build_style=meta
 short_desc="Linux kernel base dependencies"
 maintainer="Érico Nogueira <ericonr@disroot.org>"
 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
+}

  parent reply	other threads:[~2023-07-04  2:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-29 15:44 [PR PATCH] " abenson
2023-05-29 18:47 ` [PR PATCH] [Updated] " abenson
2023-05-29 18:53 ` abenson
2023-05-29 18:56 ` [PR PATCH] [Updated] " abenson
2023-05-29 19:06 ` [PR REVIEW] " abenson
2023-05-29 19:07 ` [PR PATCH] [Updated] " abenson
2023-05-30 14:30 ` mhmdanas
2023-05-30 14:30 ` mhmdanas
2023-05-31 22:04 ` 0x5c
2023-05-31 22:18 ` [PR REVIEW] " 0x5c
2023-06-02 19:32 ` abenson
2023-06-02 19:35 ` [PR PATCH] [Updated] " abenson
2023-06-02 20:59 ` [PR REVIEW] " classabbyamp
2023-06-02 20:59 ` classabbyamp
2023-06-02 22:47 ` [PR PATCH] [Updated] " abenson
2023-06-02 22:47 ` abenson
2023-06-02 22:49 ` abenson
2023-06-27 11:19 ` ahesford
2023-07-03 23:12 ` [PR PATCH] [Updated] " abenson
2023-07-03 23:25 ` abenson
2023-07-04  2:59 ` abenson [this message]
2023-07-30 17:49 ` [PR PATCH] [Merged]: " classabbyamp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230704025903.CmP58Xqb7np_twfxENdb219NhVMQcgKiGlkuipnTe7Y@z \
    --to=abenson@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).