File tree Expand file tree Collapse file tree
genesis/images/genesis_base Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- # Copyright 2025 Genesis Corporation
3+ # Copyright 2025-2026 Genesis Corporation
44#
55# All Rights Reserved.
66#
@@ -90,6 +90,17 @@ sudo chpasswd < /tmp/__passwd
9090rm -f /tmp/__passwd
9191
9292# Cleanup
93+ # remove old kernels, headers and modules, keep only the latest one
94+ LATEST_KERNEL=$( dpkg --list | grep ' linux-image-[0-9]' \
95+ | awk ' {print $2}' | sort -V | tail -1 \
96+ | sed ' s/linux-image-//' | sed ' s/-generic$//' )
97+ OLD_PKGS=$( dpkg --list \
98+ | grep -E " linux-(image|headers|modules|modules-extra)-[0-9]" \
99+ | awk ' {print $2}' | grep -v " $LATEST_KERNEL " )
100+ if [ -n " $OLD_PKGS " ]; then
101+ sudo DEBIAN_FRONTEND=noninteractive apt-get autopurge -y $OLD_PKGS
102+ fi
103+ sudo apt autopurge -y snapd libllvm19
93104sudo rm -fr /opt/gci_base
94105sudo apt-get clean
95106sudo rm -rf /var/lib/apt/lists/*
You can’t perform that action at this time.
0 commit comments