From 5071b08920cbd10f99e6b85d639800f850ab0b14 Mon Sep 17 00:00:00 2001 From: Karanbir Singh Date: Nov 21 2011 02:33:24 +0000 Subject: really try and get the script name right --- diff --git a/utils/cleanup_vm.sh b/utils/cleanup_vm.sh new file mode 100644 index 0000000..e90491a --- /dev/null +++ b/utils/cleanup_vm.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 +cat $1 | sed -e 's/|//g' | sed -e 's/^/install /' >> /tmp/yum-cleanup + +if [ `uname -m` = 'x86_64' ]; then + yum -y erase *.i?86 + yum -y --exclude=*.i?86 shell /tmp/yum-cleanup +else + yum -y shell /tmp/yum-cleanup +fi + +yum -y reinstall \* +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