[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /var/lib/dpkg/status deleted! can i rebuild it?



> - Is there any way to rebuild the 'status' file which contains =
> information about all packages installed?
> 
well ... you have a status-old and many more backups - if you did not
delete them, too.

otherwise you could use a trick somebody on the list mentioned a few weeks
ago: nearly every package installs something in /usr/share/doc. so try:

ls /usr/share/doc|awk '{print $0 " install"}'|dpkg --get-selections

then run dselect, possibly edit the list, and run the install.
you'll probably miss some packages, but it should work in general.

even simpler would be:
apt-get install `ls /usr/share/doc`
but this gives you absolutely no control (does this matter? no ...).

ok ... now the really clean and really complicated method:

sel=""
for i in /var/lib/dpkg/info/*.list; do
  if test -r `tail -1 $i`; then
    n=${i##*/}
    sel="$sel ${n%.list}"
  fi
done
apt-get install $sel

as all the packages are already installed, it would be much nicer to get
the install info from "available" and merge it with the status information
"by hand", so it would not be necessary to actually install all the files
again, but this requires a bit more programming. also, the
conffiles section (and possibly more) would have to be rebuilt - would
setting the state to "half-installed" and running dpkg afterwards help?

so far ... now a *real* dpkg-guru has the chance to say, how the recovery 
can be done with one command. :)

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
If Windows is the answer, I want the problems back!




Reply to: