Re: autoup.sh & considerations on bail-out scripts
On Tue, 17 Feb 1998, Adam Klein wrote:
> On Tue, Feb 17, 1998 at 01:12:03PM -0500, Raul Miller wrote:
> > Craig Sanders <firstname.lastname@example.org> wrote:
> > > could do the same thing for dpkg. dpkg in rex can't do --get-selections
> > > which is needed to remove all the -dev etc packages.
> > Can't you do a passable imitation using dpgk -l?
> The problem with dpkg -l is that it cuts off the end of package names.
I have tried emulating it by extracting the info directly from
/var/lib/dpkg/status but I don't like the result.
cat /var/lib/dpkg/status | \
grep -A2 "^Package: " | \
grep -B2 " install" | \
grep "^Package: " | \
sed -e 's/Package: //'
should give a list of installed packages. I think.
The trouble with it is that it makes a few assumptions about the format of
the status file which I'm not sure will always be true.
Firstly, it assumes that the "Status: " line is always immediately after
the "Package: " line....which seems like a safe bet but i don't know if it
will always be true.
Secondly, it assumes that the presence of the string " install" (the
initial space is important) will match all installed packages without
matching deinstalled ones. Again, this is probably true.
I'm also against the idea of using the status file directly. it's a bad
habit to get into. a habit which could make it very difficult for us to
change the format of the status file in the future for fear of breaking
lots of neat hack type scripts.
So, upgrading dpkg and libc5 early in the script is known to work and
doesn't have any of the drawbacks mentioned above.
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to email@example.com .