diff --git a/debian/changelog b/debian/changelog index f24d6a7d..fad59902 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,10 @@ byobu (5.103) unreleased; urgency=medium * usr/bin/Makefile.am, usr/bin/manifest, usr/bin/tmpfsffs, usr/share/man/man1/Makefile.am, usr/share/man/man1/manifest.1: - added the manifest command + * debian/control, usr/bin/Makefile.am, usr/bin/purge-old-kernels, + usr/share/man/man1/Makefile.am, usr/share/man/man1/purge-old- + kernels.1: + - move purge-old-kernels over from bikeshed into byobu -- Dustin Kirkland Thu, 04 Feb 2016 16:30:00 -0600 diff --git a/debian/control b/debian/control index 32c9e9e0..869cdb7e 100644 --- a/debian/control +++ b/debian/control @@ -42,12 +42,12 @@ Replaces: screen-profiles (<< 2.0), screen-profiles-extras (<< 2.0), byobu-extras (<< 2.17), - bikeshed (<< 1.55) + bikeshed (<< 1.64) Breaks: screen-profiles (<< 2.0), screen-profiles-extras (<< 2.0), byobu-extras (<< 2.17), - bikeshed (<< 1.47) + bikeshed (<< 1.64) Enhances: screen Description: text window manager, shell multiplexer, integrated DevOps environment Byobu is Ubuntu's powerful text-based window manager, shell multiplexer, and diff --git a/usr/bin/Makefile.am b/usr/bin/Makefile.am index 2a2bd01f..fa33a26a 100644 --- a/usr/bin/Makefile.am +++ b/usr/bin/Makefile.am @@ -1,4 +1,4 @@ -bin_SCRIPTS = byobu byobu-config byobu-ctrl-a byobu-disable byobu-disable-prompt byobu-enable byobu-enable-prompt byobu-export byobu-janitor byobu-keybindings byobu-launch byobu-launcher byobu-launcher-install byobu-launcher-uninstall byobu-layout byobu-prompt byobu-quiet byobu-reconnect-sockets byobu-select-backend byobu-select-profile byobu-select-session byobu-silent byobu-status byobu-status-detail byobu-shell byobu-ugraph byobu-ulevel col1 ctail wifi-status vigpg manifest +bin_SCRIPTS = byobu byobu-config byobu-ctrl-a byobu-disable byobu-disable-prompt byobu-enable byobu-enable-prompt byobu-export byobu-janitor byobu-keybindings byobu-launch byobu-launcher byobu-launcher-install byobu-launcher-uninstall byobu-layout byobu-prompt byobu-quiet byobu-reconnect-sockets byobu-select-backend byobu-select-profile byobu-select-session byobu-silent byobu-status byobu-status-detail byobu-shell byobu-ugraph byobu-ulevel col1 ctail wifi-status vigpg manifest purge-old-kernels install-exec-hook: cd $(DESTDIR)$(bindir) && rm -f byobu-screen && $(LN_S) byobu byobu-screen diff --git a/usr/bin/purge-old-kernels b/usr/bin/purge-old-kernels new file mode 100755 index 00000000..b2d1e28e --- /dev/null +++ b/usr/bin/purge-old-kernels @@ -0,0 +1,58 @@ +#!/bin/sh +# +# purge-old-kernels - remove old kernel packages +# Copyright (C) 2012 Dustin Kirkland +# +# Authors: Dustin Kirkland +# Kees Cook +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Ensure we're running as root +if [ "$(id -u)" != 0 ]; then + echo "ERROR: This script must run as root. Hint..." 1>&2 + echo " sudo $0 $@" 1>&2 + exit 1 +fi + +# NOTE: This script will ALWAYS keep the currently running kernel +# NOTE: Default is to keep 2 more, user overrides with --keep N +KEEP=2 +# NOTE: Any unrecognized option will be passed straight through to apt +APT_OPTS= +while [ ! -z "$1" ]; do + case "$1" in + --keep) + # User specified the number of kernels to keep + KEEP="$2" + shift 2 + ;; + *) + APT_OPTS="$APT_OPTS $1" + shift 1 + ;; + esac +done + +# Build our list of kernel packages to purge +CANDIDATES=$(ls -tr /boot/vmlinuz-* | head -n -${KEEP} | grep -v "$(uname -r)$" | cut -d- -f2- | awk '{print "linux-image-" $0 " linux-headers-" $0}' ) +for c in $CANDIDATES; do + dpkg-query -s "$c" >/dev/null 2>&1 && PURGE="$PURGE $c" +done + +if [ -z "$PURGE" ]; then + echo "No kernels are eligible for removal" + exit 0 +fi + +apt $APT_OPTS remove --purge $PURGE diff --git a/usr/share/man/man1/Makefile.am b/usr/share/man/man1/Makefile.am index 4d2cbf48..698be048 100644 --- a/usr/share/man/man1/Makefile.am +++ b/usr/share/man/man1/Makefile.am @@ -1 +1 @@ -man_MANS = byobu.1 byobu-config.1 byobu-ctrl-a.1 byobu-disable.1 byobu-disable-prompt.1 byobu-enable.1 byobu-enable-prompt.1 byobu-export.1 byobu-janitor.1 byobu-keybindings.1 byobu-launch.1 byobu-launcher.1 byobu-launcher-install.1 byobu-launcher-uninstall.1 byobu-layout.1 byobu-prompt.1 byobu-quiet.1 byobu-reconnect-sockets.1 byobu-screen.1 byobu-select-backend.1 byobu-select-profile.1 byobu-select-session.1 byobu-shell.1 byobu-silent.1 byobu-status.1 byobu-status-detail.1 byobu-tmux.1 byobu-ugraph.1 byobu-ulevel.1 col1.1 ctail.1 wifi-status.1 vigpg.1 manifest.1 +man_MANS = byobu.1 byobu-config.1 byobu-ctrl-a.1 byobu-disable.1 byobu-disable-prompt.1 byobu-enable.1 byobu-enable-prompt.1 byobu-export.1 byobu-janitor.1 byobu-keybindings.1 byobu-launch.1 byobu-launcher.1 byobu-launcher-install.1 byobu-launcher-uninstall.1 byobu-layout.1 byobu-prompt.1 byobu-quiet.1 byobu-reconnect-sockets.1 byobu-screen.1 byobu-select-backend.1 byobu-select-profile.1 byobu-select-session.1 byobu-shell.1 byobu-silent.1 byobu-status.1 byobu-status-detail.1 byobu-tmux.1 byobu-ugraph.1 byobu-ulevel.1 col1.1 ctail.1 wifi-status.1 vigpg.1 manifest.1 purge-old-kernels.1 diff --git a/usr/share/man/man1/purge-old-kernels.1 b/usr/share/man/man1/purge-old-kernels.1 new file mode 100644 index 00000000..08fbc216 --- /dev/null +++ b/usr/share/man/man1/purge-old-kernels.1 @@ -0,0 +1,23 @@ +.TH purge-old-kernels 1 "30 Apr 2012" byobu "byobu" +.SH NAME +purge-old-kernels - remove old kernel and header packages from the system + +.SH SYNOPSIS +\fBpurge-old-kernels\fP [--keep N] [*] + +.SH DESCRIPTION +This program will remove old kernel and header packages from the system, freeing disk space. It will never remove the currently running kernel. By default, it will keep at least the latest 2 kernels, but the user can override that value using the --keep parameter. Any additional parameters will be passed directly to \fBapt-get\fP(8). + +This program requires administrative access. + +.SH EXAMPLE + +sudo purge-old-kernels --keep 3 -qy + +.SH SEE ALSO +\fBapt-get\fP(8) + +.SH AUTHOR +This manpage and the utility was written by Dustin Kirkland for Ubuntu systems (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 published by the Free Software Foundation. + +On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL, or on the web at \fIhttp://www.gnu.org/licenses/gpl.txt\fP.