From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755599AbcBHUWs (ORCPT ); Mon, 8 Feb 2016 15:22:48 -0500 Received: from fieldses.org ([173.255.197.46]:50230 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752699AbcBHUWr (ORCPT ); Mon, 8 Feb 2016 15:22:47 -0500 Date: Mon, 8 Feb 2016 15:22:46 -0500 From: "J. Bruce Fields" To: Linus Torvalds Cc: Linux Kernel Subject: Re: kernel pruning script.. Message-ID: <20160208202246.GB18462@fieldses.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 08, 2016 at 12:14:23PM -0800, Linus Torvalds wrote: > I'm replying to a really old email, because I - once again - installed > this silly script that you wrote several years ago on a new machine. > > So Bruce - how about we add this script to the kernel "tools" > directory, because it's actually very useful for anybody who uses > CONFIG_LOCALVERSION_AUTO like I do (and clearly you at least used to > do too). > > I think CONFIG_LOCALVERSION_AUTO is really nice for various reasons > (not the least of which is just doing thing like > > gitk $(uname -r).. > but also because it makes it easy to go back to previous kernels when > you're working on bisecting stuff etc). Yes, I'm a fan. My test scripts check uname after boot to make sure they're testing the kernel they built. > I'll happily commit it as "tools/prune-kernel" or similar, but would > like to get an ok from you as the original author. Oh, feel free, thanks. --b. > And if somebody has improvements for specific distros, maybe the > script will start getting improvements. And I won't have to copy it > from an old machine every time, because it will just be there with the > kernel source tree (and without a kernel source tree it's not needed). > > Linus > > On Wed, Jul 10, 2013 at 1:54 PM, J. Bruce Fields wrote: > > > > I run this by hand every now and then. I'm probably doing it all wrong. > > > > --b. > > > > #!/bin/bash > > > > # because I use CONFIG_LOCALVERSION_AUTO, not the same version again and > > # again, /boot and /lib/modules/ eventually fill up. > > # Dumb script to purge that stuff: > > > > ssh "root@$1" ' > > > > for f in $(ls /lib/modules); do > > if rpm -qf "/lib/modules/$f" >/dev/null; then > > echo "keeping $f (installed from rpm)" > > elif [ $(uname -r) = "$f" ]; then > > echo "keeping $f (running kernel) " > > else > > echo "removing $f" > > rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f" > > rm -f "/boot/vmlinuz-$f" "/boot/config-$f" > > rm -rf "/lib/modules/$f" > > new-kernel-pkg --remove $f > > fi > > done > > '