On 06/30/2014 07:34 PM, Nico Kadel-Garcia wrote:
> Given that "there can be only one" Fedora, I wouldn't expect the same
> kind of effort to build migration tools. But it's *amazing* what you
> can do by simply doing"
>
> rm -rf /tmp/failed /tmp/success
> mkdir /tmp/failed /tmp/success
> RPMLIST=`rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}'`
> for name in $RPMLIST; do
> yum reinstall $name -y 2>/tmp/failed/$name >/tmp/success/$name
> done
>
> It's amazing how 3 or four years of sophisticated python development
> can be replaced by a few lines of shell script, and get better error
> reporting.
>
It's even more amazing what you can get with a single line:
rpm -qa --qf '%{NAME}.%{ARCH}'|xargs -n 1 yum -y reinstall
(the currently installed version and release may not be in the new repo
you're going to; if those are critical, add them back to the
--queryformat line). In looking back at my 'switchover' from SLC 5.4
IA64 to my CentOS 5.5 rebuild on same, this is the command line I used
(and since I embedded some strings in the release, and since I was doing
an update at the same time, I specifically left out %{VERSION} and
%{RELEASE}).
However, both of our approaches have at least two flaws.
1.) If we're wanting to switch from CentOS to SL, but have a lot of
third-party repos enabled, we probably don't want to reinstall all of
those packages;
2.) If we have locally installed non-repo packages those will not
reinstall (Oracle's JRE, for instance, or GoogleEarth).
It takes a bit more thought to deal with those cases; you can start with
'yum list installed' and parse from there. The 'yum list extras'
command will give you a list of packages that aren't in any current repo
(on my system I have GoogleEarth, the Oracle JRE, the rebuilt from
ELrepo kmod-wl nosrc.rpm, and a couple of other hand built or
sidechannel installed packages (I have nbtscan, for instance, from
repoforge but I don't have repoforge as a whole installed; I also have
normalize from Fedora 11 installed (works fine, too)).
|