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