18c2ecf20Sopenharmony_ci#!/bin/bash
28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci# because I use CONFIG_LOCALVERSION_AUTO, not the same version again and
58c2ecf20Sopenharmony_ci# again, /boot and /lib/modules/ eventually fill up.
68c2ecf20Sopenharmony_ci# Dumb script to purge that stuff:
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cifor f in "$@"
98c2ecf20Sopenharmony_cido
108c2ecf20Sopenharmony_ci        if rpm -qf "/lib/modules/$f" >/dev/null; then
118c2ecf20Sopenharmony_ci                echo "keeping $f (installed from rpm)"
128c2ecf20Sopenharmony_ci        elif [ $(uname -r) = "$f" ]; then
138c2ecf20Sopenharmony_ci                echo "keeping $f (running kernel) "
148c2ecf20Sopenharmony_ci        else
158c2ecf20Sopenharmony_ci                echo "removing $f"
168c2ecf20Sopenharmony_ci                rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f"
178c2ecf20Sopenharmony_ci                rm -f "/boot/vmlinuz-$f"   "/boot/config-$f"
188c2ecf20Sopenharmony_ci                rm -rf "/lib/modules/$f"
198c2ecf20Sopenharmony_ci                new-kernel-pkg --remove $f
208c2ecf20Sopenharmony_ci        fi
218c2ecf20Sopenharmony_cidone
22