Wednesday, May 11, 2011

Updating RedHat Linux and avoiding issues

Updating Redhat systems while using third-party repositories can result in dependency issues. I created this little script that will scan the installed packages and only update the packages installed from that specific repository. For example, I require VLC from RPMFORGE. With this script. the RPMFORGE version of VLC will be upgraded. Before using this script, you should have a system installed just the way you want with no dependency issues.


#!/bin/bash
yum --enablerepo=* makecache
yum list installed | grep -i atrpms | cut -c1-25 | xargs perl -e 'foreach (@ARGV) { s/.x86_64//; print "\n$_";}' | xargs yum --disablerepo=* --enablerepo=a* install

yum list installed | grep -i epel | cut -c1-25 | xargs perl -e 'foreach (@ARGV) { s/.x86_64//; print "\n$_";}' | xargs yum --disablerepo=* --enablerepo=e* install -y

yum list installed | grep -i rpmforge | cut -c1-25 | xargs perl -e 'foreach (@ARGV) { s/.x86_64//; s/.noarch//;print "\n$_";}' | xargs yum --disablerepo=* --enablerepo=rpm* install -y

yum update -y

No comments:

Post a Comment