Debian quick reference

Package maintenance helpers

fgrep -B0 -A1 'package' /var/lib/apt/extended_states
fgrep -B1 -A0 'Auto-Installed: 0' /var/lib/apt/extended_states |less
COLUMNS=200 dpkg -l | awk '/openoffice|OpenOffice/ { print $2" hold" }' | dpkg --set-selections
apt-show-versions | egrep -v ' (uptodate|upgradeable) '
apt-show-versions | fgrep -v '/lenny ' | less -S

How to build a chroot of a certain release

debootstrap

How to prepare a kernel package

Or just use the following script from a directory named linux-version+flavor or kernel-source-version+flavor:

#!/bin/sh
# $Id: build-kernel,v 1.4 2004/11/22 20:40:49 flavio Exp $

set -e -x

if (basename $(pwd) | fgrep -q -v '+'); then
  echo "Directory name must end in '+flavour'."
  exit 1
fi

if [ -f "debian/changelog" ]; then
  REVISION=$(dpkg-parsechangelog | grep "^Version:" | cut -d' ' -f2)
else
  REVISION=$(basename $(pwd) | cut -d+ -f1 | sed -e 's/linux-//' -e 's/kernel-source-//')
fi
APPENDIX=$(basename $(pwd) | cut -d+ -f2)

# the test is redundant, pwd *will* contain a flavour
test -z "$APPENDIX" || APPEND_TO_VERSION="--append-to-version=-${APPENDIX}"

test -f "stamp-debian" ||   make-kpkg --revision="$REVISION" $APPEND_TO_VERSION debian

### This test is useful only with Debian kernel sources
# don't try to optimize away an if with an -a in the test;
# this is not C -- you've been warned
#if [ -f "version.Debian" ]; then
#  if [ "$REVISION" != "$(cat version.Debian)" ]; then
#    echo "REVISION and version.Debian don't agree."
#    exit 1
#  fi
#fi

if [ ! -f "stamp-configure" ]; then
  if [ "x$1" = "x-m" ]; then
    echo "Please configure first."
    exit 1
  fi
  make-kpkg --revision="$REVISION" $APPEND_TO_VERSION --config=x configure
fi

if [ "x$1" = "x-c" ]; then
  echo "Configuration done."
  exit 0
fi

test -z "$MODULES" && MODULES=$(echo $(ls -1 /usr/src/modules) | sed 's/ /,/g')
test -z "$MODULES" || ADDED_MODULES="--added-modules=${MODULES}"

if [ "x$1" != "x-m" ]; then
  make-kpkg --revision="$REVISION" $APPEND_TO_VERSION $ADDED_MODULES --rootcmd=fakeroot kernel_image
fi

# modules usually don't like --rootcmd
fakeroot make-kpkg --revision="$REVISION" $APPEND_TO_VERSION $ADDED_MODULES modules_image

### EOF ###
$Id: quickref.gtml,v 1.4 2005/11/10 22:54:17 flavio Exp $