pre-install kernel hook: only keep 3 old kernels instead of waiting until we run out of disk space
parent
1967fe3c85
commit
234432cf74
|
@ -1,24 +1,17 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Kernel pre-install hook for Void-USB
|
# Kernel pre-install hook for Void-USB
|
||||||
# This script removes old kernels when disk space is low.
|
# This script removes old kernels to save disk space.
|
||||||
#
|
#
|
||||||
# Arguments: $1 package name, $2 kernel version
|
# Arguments: $1 package name, $2 kernel version
|
||||||
PKGNAME="$1"
|
PKGNAME="$1"
|
||||||
VERSION="$2"
|
VERSION="$2"
|
||||||
|
|
||||||
MB_LOW=250
|
KEEP_OLD_KERNELS=3
|
||||||
MB_FREE="$(df --block-size=1M --output=avail /boot | tail -n1)"
|
|
||||||
|
|
||||||
if [ "$MB_FREE" -lt "$MB_LOW" ]; then
|
while [ "$(vkpurge list | wc -l)" -gt "$KEEP_OLD_KERNELS" ]; do
|
||||||
echo
|
|
||||||
OLDEST_KERNEL="$(vkpurge list | sort | head -n1)"
|
OLDEST_KERNEL="$(vkpurge list | sort | head -n1)"
|
||||||
if [ -z "$OLDEST_KERNEL" ]; then
|
|
||||||
echo -e "\033[31m================================================\n\033[33mWARNING:\033[0m Failed to find an old kernel to remove.\nThe /boot partition is running out of space.\nThis will become an issue if left unaddressed.\n\033[31m================================================\033[0m"
|
|
||||||
else
|
|
||||||
echo "Removing old kernel $OLDEST_KERNEL using vkpurge..."
|
echo "Removing old kernel $OLDEST_KERNEL using vkpurge..."
|
||||||
vkpurge rm "$OLDEST_KERNEL"
|
vkpurge rm "$OLDEST_KERNEL"
|
||||||
fi
|
fi
|
||||||
else
|
done
|
||||||
echo "Not doing anything, /boot has plenty of space."
|
|
||||||
fi
|
|
||||||
|
|
|
@ -11,8 +11,6 @@ make our own or extract (if feasible) kb selection and time zone selection to hi
|
||||||
- potentially interesting packages
|
- potentially interesting packages
|
||||||
- ckbcomp
|
- ckbcomp
|
||||||
- kbd-data
|
- kbd-data
|
||||||
vkpurge old stuff - only keep 2 vkpurgeable kernels
|
|
||||||
- change kernel pre-install hook
|
|
||||||
overview of the installation process at the start
|
overview of the installation process at the start
|
||||||
overall progress indication (step x out of y)
|
overall progress indication (step x out of y)
|
||||||
exclude optical drives
|
exclude optical drives
|
||||||
|
|
Loading…
Reference in New Issue