void-minecraft-usb/kernel.d/pre-install/99-void-usb

18 lines
429 B
Plaintext
Raw Normal View History

2023-06-21 07:07:13 +02:00
#!/usr/bin/env bash
#
# Kernel pre-install hook for Void-USB
# This script removes old kernels to save disk space.
2023-06-21 07:07:13 +02:00
#
# Arguments: $1 package name, $2 kernel version
PKGNAME="$1"
VERSION="$2"
KEEP_OLD_KERNELS=3
2023-06-21 07:07:13 +02:00
while [ "$(vkpurge list | wc -l)" -gt "$KEEP_OLD_KERNELS" ]; do
2023-06-21 07:07:13 +02:00
OLDEST_KERNEL="$(vkpurge list | sort | head -n1)"
echo "Removing old kernel $OLDEST_KERNEL using vkpurge..."
vkpurge rm "$OLDEST_KERNEL"
2023-06-21 07:07:13 +02:00
fi
done