Subject: Emergency dpkg database maintenance

From: [email-masked]
Date: 2 Jul 1996 15:34:08 -0000

Here's a script to create a new custom package in dpkg's database.  This
works with older versions of dpkg, I expect it will work with newer
versions as well.

#!/bin/sh
list=/var/lib/dpkg/info/$1.list
if [ -f $list ]; then
        echo "$1 already exists in dpkg's database"
        exit 1
fi
 
ME=${USER-`whoami`}
status=/var/lib/dpkg/status
(   
        awk "BEGIN{e=1} /^Package: $1$/{e=0} e{print} /^$/{e=1}" <$status
        cat <<NEW
Package: $1
Status: hold ok installed
Priority: bogus
Section: custom
Maintainer: <$ME>
Version: ${2-0}
Description: custom by $ME on `date`

NEW
) >$status.tmp

cp $status $status.bak  
touch $list && mv $status.tmp $status

-- 
Raul

---

From: Ian Jackson <[email-masked]>
Date: Wed, 10 Jul 96 00:12 BST

> works with older versions of dpkg, I expect it will work with newer

The `hold' value for `want' wasn't introduced until 1.2.0.  Before
then it was a flag in the same bit of `Status' as you have `ok'.  So,
any dpkg before 1.2.0 won't work with the script below - the script
will cause dpkg to refuse to start because of a syntax error in the
status database.

And, I might change it again some time ...

Ian.