Blame utils/c5_cleanup_vm.sh

Karanbir Singh a156df
#!/bin/sh
Karanbir Singh a156df
Karanbir Singh a156df
# you will almost never want to run this script.
Karanbir Singh b3e489
# $1 = file name ( full path ) with rpms to retain
Karanbir Singh a156df
Karanbir Singh d44882
rm /tmp/yum-cleanup
Karanbir Singh d44882
Karanbir Singh a156df
for f in `rpm -qa`; do 
Karanbir Singh d44882
  pn=$(rpm --qf "%{name}" -q $f)
Karanbir Singh b3e489
  if [ `grep $pn $1 | wc -l ` -lt 1 ] ; then 
Karanbir Singh d44882
    echo 'erase ' $f  >> /tmp/yum-cleanup 
Karanbir Singh a156df
  fi
Karanbir Singh a156df
done
Karanbir Singh a156df
echo >> /tmp/yum-cleanup
Karanbir Singh a156df
echo 'install ' >> /tmp/cleanp
Karanbir Singh d44882
cat req_list | sed -e 's/^/install /' >> /tmp/yum-cleanup
Karanbir Singh a156df
Karanbir Singh a156df
yum -y shell /tmp/yum-cleanup
Karanbir Singh a156df
yum -y reinstall \*
Karanbir Singh a156df
if [ `uname -m` = 'x86_64' ]; then
Karanbir Singh a156df
  yum -y erase *.i?86
Karanbir Singh a156df
fi
Karanbir Singh a156df
Karanbir Singh a156df
cd /etc
Karanbir Singh a156df
for x in `find . -maxdepth=2 -type f -name \*.rpmnew`; do
Karanbir Singh a156df
  a=$( echo $x | sed -e 's/.rpmnew//' )
Karanbir Singh a156df
  rm -f $a
Karanbir Singh a156df
  mv $x $a
Karanbir Singh a156df
done