Re: RPM database recovery via list of rpm files

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

 



James Olin Oden wrote:

Yes, but won't I need the actual rpm files before I can do that?

Maybe I wasn't very clear on this, but the way I see it, the main
problem is not to find out what rpm commands to use, but to obtain the
files they want as input. I haven't kept copies of everything I've
downloaded, and the packages came from various different sources
(although I generally take add-ons from large repositories like Fedora
Extras or Freshrpms) so finding the correct version of each and every
rpm file looks like lot of work ;-(

Yes you need the actual rpms.  The problem is even if you generated a
header based on the NVRA that is in the file you have you would not
have the list of files, the Epoch, the provides and requires and
various other bits of metadata.  So the only sure way of dealing with
this is to find the actual original rpms.
Yeah, I thought so. I was of hoping that e.g. yum might help me in the process, though - but it seems like it doesn't quite have the functionality needed.

So I guess the answer is to do some shell script hacking... I have now recovered most of the database using the script attached. - Actually, I've ran this several times, whith adjustments to the repository list on the way, and doing 'rpm --initdb' the first time around. The list of distros was mainly taken from my yum setup.

Sorry...james

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

#!/bin/sh

releasever=3
basearch=i386

REPOS="/var/cache/yum/*/packages/ /usr/src/redhat/RPMS/*\
      http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/\
      http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/Fedora/RPMS\
     http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/\
     http://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/freshrpms/RPMS\
     http://gstreamer.freedesktop.org/pkg/fedora/$releasever/$basearch/yum/deps/RPMS\
     http://gstreamer.freedesktop.org/pkg/fedora/$releasever/$basearch/yum/gst/RPMS\
     http://luna.cs.ccsu.edu/dominik/apt/fc$releasever/RPMS.stable\
     http://luna.cs.ccsu.edu/dominik/apt/all/RPMS.stable\
      http://download.fedora.redhat.com/pub/fedora/linux/core/2/$basearch/os/Fedora/RPMS\
     http://download.fedora.redhat.com/pub/fedora/linux/core/updates/2/$basearch/\
     http://download.fedora.redhat.com/pub/fedora/linux/core/1/os/Fedora/RPMS\
     http://download.fedora.redhat.com/pub/fedora/linux/core/updates/1/$basearch/\
     http://ayo.freshrpms.net/redhat/9/$basearch/RPMS.freshrpms/\
     http://ayo.freshrpms.net/redhat/9/$basearch/RPMS.os/\
     http://ayo.freshrpms.net/redhat/9/$basearch/RPMS.updates/
     http://ayo.freshrpms.net/redhat/7.3/$basearch/RPMS.freshrpms/\
     http://ayo.freshrpms.net/redhat/7.3/$basearch/RPMS.os/\
     http://ayo.freshrpms.net/redhat/7.3/$basearch/RPMS.updates";


# rm -f /var/lib/rpm/__db*
# rpm --initdb

cat $1 | while read rpm
do
  pkg=`basename $rpm .rpm` 

  if ! rpm -q $pkg > /dev/null 2>&1
  then 
    echo $rpm
    for repo in $REPOS
    do
      rpm -i --justdb --force --nodeps $repo/$rpm 2> /dev/null && break
    done
    if [ $? != 0 ]
    then
      echo "$rpm not found ;-("
    fi
  fi
done

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux