From f3edece20c3dbab27c7be1d82e90978651c6ec72 Mon Sep 17 00:00:00 2001 From: Karanbir Singh Date: Nov 20 2011 14:59:23 +0000 Subject: the cleanup_vm script need not be distro specific --- diff --git a/utils/cleanp_cm.sh b/utils/cleanp_cm.sh new file mode 100644 index 0000000..1e59544 --- /dev/null +++ b/utils/cleanp_cm.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# you will almost never want to run this script. +# $1 = file name ( full path ) with rpms to retain + +rm /tmp/yum-cleanup + +for f in `rpm -qa`; do + pn=$(rpm --qf "%{name}" -q $f) + if [ `grep $pn $1 | wc -l ` -lt 1 ] ; then + echo 'erase ' $f >> /tmp/yum-cleanup + fi +done +echo >> /tmp/yum-cleanup +echo 'install ' >> /tmp/cleanp +cat req_list | sed -e 's/^/install /' >> /tmp/yum-cleanup + +yum -y shell /tmp/yum-cleanup +yum -y reinstall \* +if [ `uname -m` = 'x86_64' ]; then + yum -y erase *.i?86 +fi + +cd /etc +for x in `find . -maxdepth=2 -type f -name \*.rpmnew`; do + a=$( echo $x | sed -e 's/.rpmnew//' ) + rm -f $a + mv $x $a +done