#!/bin/sh
set -e
rm -f /var/lib/dpkg/base.*
cd /var/lib/dpkg
if grep -q "^Package: base$" status; then
cp status status.bak
awk '
$0 == "Package: base" { state=1 }
state != 1 { print $0 }
state == 1 && $0 == "" { state=2 }
' status.bak > status
echo "Done."
echo
echo "The /var/lib/dpkg/status file has been modified to remove references to"
echo "the \`base' package, and all the /var/lib/dpkg/base.* files have been"
echo "removed. The file \`status.bak' contains a backup of the old \`status'"
echo "file, in case something went wrong."
else
echo "Not changing \`status' file since it does not seem to list base."
fi
