mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-26 18:29:35 +02:00
Compare commits
1 Commits
patch_kern
...
fix/netdat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbf9bbf3c6 |
@@ -47,7 +47,7 @@ function msg_ok() {
|
|||||||
function msg_error() { echo -e "${RD}✗ $1${CL}"; }
|
function msg_error() { echo -e "${RD}✗ $1${CL}"; }
|
||||||
|
|
||||||
# This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported.
|
# This function checks the version of Proxmox Virtual Environment (PVE) and exits if the version is not supported.
|
||||||
# Supported: Proxmox VE 8.0.x – 8.9.x and 9.0–9.1.x
|
# Supported: Proxmox VE 8.0.x – 8.9.x and 9.0–9.x
|
||||||
pve_check() {
|
pve_check() {
|
||||||
local PVE_VER
|
local PVE_VER
|
||||||
PVE_VER="$(pveversion | awk -F'/' '{print $2}' | awk -F'-' '{print $1}')"
|
PVE_VER="$(pveversion | awk -F'/' '{print $2}' | awk -F'-' '{print $1}')"
|
||||||
@@ -63,20 +63,14 @@ pve_check() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for Proxmox VE 9.x: allow 9.0–9.1.x
|
# Check for Proxmox VE 9.x: allow 9.0–9.x
|
||||||
if [[ "$PVE_VER" =~ ^9\.([0-9]+) ]]; then
|
if [[ "$PVE_VER" =~ ^9\.([0-9]+) ]]; then
|
||||||
local MINOR="${BASH_REMATCH[1]}"
|
|
||||||
if ((MINOR < 0 || MINOR > 1)); then
|
|
||||||
msg_error "This version of Proxmox VE is not yet supported."
|
|
||||||
msg_error "Supported: Proxmox VE version 9.0–9.1.x"
|
|
||||||
exit 105
|
|
||||||
fi
|
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# All other unsupported versions
|
# All other unsupported versions
|
||||||
msg_error "This version of Proxmox VE is not supported."
|
msg_error "This version of Proxmox VE is not supported."
|
||||||
msg_error "Supported versions: Proxmox VE 8.0 – 8.9 or 9.0–9.1.x"
|
msg_error "Supported versions: Proxmox VE 8.0 – 8.9 or 9.0–9.x"
|
||||||
exit 105
|
exit 105
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,14 +28,7 @@ declare -f init_tool_telemetry &>/dev/null && init_tool_telemetry "kernel-clean"
|
|||||||
|
|
||||||
# Detect current kernel
|
# Detect current kernel
|
||||||
current_kernel=$(uname -r)
|
current_kernel=$(uname -r)
|
||||||
# Only list fully-installed (ii) versioned kernel packages; the pattern
|
available_kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | grep -v "$current_kernel" | sort -V)
|
||||||
# proxmox-kernel-X.Y.Z matches versioned kernels while excluding the
|
|
||||||
# two-segment meta-packages (proxmox-kernel-X.Y) and proxmox-kernel-helper.
|
|
||||||
available_kernels=$(dpkg --list |
|
|
||||||
awk '/^ii/ {print $2}' |
|
|
||||||
grep -E '^proxmox-kernel-[0-9]+\.[0-9]+\.[0-9]' |
|
|
||||||
grep -v "$current_kernel" |
|
|
||||||
sort -V)
|
|
||||||
|
|
||||||
header_info
|
header_info
|
||||||
|
|
||||||
@@ -89,28 +82,10 @@ fi
|
|||||||
# Remove kernels
|
# Remove kernels
|
||||||
for kernel in "${kernels_to_remove[@]}"; do
|
for kernel in "${kernels_to_remove[@]}"; do
|
||||||
echo -e "${YW}Removing $kernel...${CL}"
|
echo -e "${YW}Removing $kernel...${CL}"
|
||||||
# Derive the major.minor meta-package name (e.g. proxmox-kernel-6.14)
|
if apt-get purge -y "$kernel" >/dev/null 2>&1; then
|
||||||
# from a versioned name like proxmox-kernel-6.14.11-9-pve-signed.
|
echo -e "${GN}Successfully removed: $kernel${CL}"
|
||||||
minor_version=$(echo "$kernel" | sed -E 's/^proxmox-kernel-([0-9]+\.[0-9]+)\..*/\1/')
|
|
||||||
meta="proxmox-kernel-${minor_version}"
|
|
||||||
pkgs_to_remove=("$kernel")
|
|
||||||
# Include the meta-package in the purge when it is installed and when
|
|
||||||
# no other versioned kernel of the same minor version will remain
|
|
||||||
# (the running kernel keeps it alive if it shares the same minor).
|
|
||||||
if dpkg -l "$meta" 2>/dev/null | grep -q '^ii'; then
|
|
||||||
remaining=$(dpkg --list |
|
|
||||||
awk '/^ii/ {print $2}' |
|
|
||||||
grep -E "^proxmox-kernel-${minor_version}\." |
|
|
||||||
grep -v "^${kernel}$" |
|
|
||||||
wc -l)
|
|
||||||
if [ "$remaining" -eq 0 ]; then
|
|
||||||
pkgs_to_remove+=("$meta")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if apt-get purge -y "${pkgs_to_remove[@]}" >/dev/null 2>&1; then
|
|
||||||
echo -e "${GN}Successfully removed: ${pkgs_to_remove[*]}${CL}"
|
|
||||||
else
|
else
|
||||||
echo -e "${RD}Failed to remove: ${pkgs_to_remove[*]}. Check dependencies.${CL}"
|
echo -e "${RD}Failed to remove: $kernel. Check dependencies.${CL}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user