fedora 23

Matthew Miller mattdm at fedoraproject.org
Tue Sep 29 19:12:42 UTC 2015


On Tue, Sep 29, 2015 at 03:03:51PM -0400, Paul Cartwright wrote:
> so, what about restoring "packages" from this file... dnf install
> <filename ?


  xargs < filename | dnf -y install

except will automatically fail the whole thing if one of the files
listed isn't available in the new distribution (retired or replaced or
whatever). That might be okay - you can then update your list. Or, you
can just do this:

  for pkg in $(<filename); do dnf -y install $pkg; done

which will be somewhat slower and also introduce a number of no-ops
since packages early in the list might pull in the later ones already
by dependencies.


As another refinement, you might want to generate your list from `dnf
leaves` instead of `rpm -qa`. That lists only packages that aren't
required by another installed package. That'll make the above somewhat
faster and the list more manageable. Of course, if a package you
actually want was pulled in as a dependency of something and _that_
leaf is retired in the future, you might miss something, but that
should be rare enough that you can tune the list by hand.

Personally, I actually view a reinstall as a chance to discard cruft I
wasn't using anyway. It's pretty fast to install something that turns
out to be missed on the fly later.


-- 
Matthew Miller
<mattdm at fedoraproject.org>
Fedora Project Leader


More information about the users mailing list