mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
* addHealthCheck on Daemons * fix bug that prevents domains without protocols from being deleted * fixes from testing * version bump * add sdk version to UI * fix useEntrypoint * fix dependency health check error display * minor fixes * beta.29 * fixes from testing * beta.30 * set /etc/os-release (#2918) * remove check-monitor from kiosk (#2059) * add units for progress (#2693) * use new progress type * alpha.7 * fix up pwa stuff * fix wormhole-squashfs and prune boot (#2964) * don't exit on expected errors * use bash --------- Co-authored-by: Matt Hill <mattnine@protonmail.com>
36 lines
984 B
Bash
Executable File
36 lines
984 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
if [ "$UID" -ne 0 ]; then
|
|
>&2 echo 'Must be run as root'
|
|
exit 1
|
|
fi
|
|
|
|
# Get the current kernel version
|
|
current_kernel=$(uname -r)
|
|
|
|
echo "Current kernel: $current_kernel"
|
|
echo "Searching for old kernel files in /boot..."
|
|
|
|
# Extract base kernel version (without possible suffixes)
|
|
current_base=$(echo "$current_kernel" | sed 's/-.*//')
|
|
|
|
cd /boot || { echo "/boot directory not found!"; exit 1; }
|
|
|
|
for file in vmlinuz-* initrd.img-* System.map-* config-*; do
|
|
# Extract version from filename
|
|
version=$(echo "$file" | sed -E 's/^[^0-9]*([0-9][^ ]*).*/\1/')
|
|
# Skip if file matches current kernel version
|
|
if [[ "$file" == *"$current_kernel"* ]]; then
|
|
continue
|
|
fi
|
|
# Compare versions, delete if less than current
|
|
if dpkg --compare-versions "$version" lt "$current_kernel"; then
|
|
echo "Deleting $file (version $version is older than $current_kernel)"
|
|
sudo rm -f "$file"
|
|
fi
|
|
done
|
|
|
|
echo "Old kernel files deleted."
|