Hi list!
After yum upgrade of my CentOS 4.0 to 4.2 x86_64 box I now have countless .rpmsave files, about 90% of them I never touched or are config/start scripts.
Does anyone have a neat script that will find all the rpmsave stuff in /etc and then prompts per file whether it can replace the original or not?
Somehow doing this all by hand doesn't seem a very attractive idea :)
Thanks!!
On Sat, 2006-01-14 at 06:55 +0100, Remco Barendse wrote:
Hi list!
After yum upgrade of my CentOS 4.0 to 4.2 x86_64 box I now have countless .rpmsave files, about 90% of them I never touched or are config/start scripts.
Does anyone have a neat script that will find all the rpmsave stuff in /etc and then prompts per file whether it can replace the original or not?
Somehow doing this all by hand doesn't seem a very attractive idea :)
Wouldn't say I'd recommend it without carefully checking differences first, but just for grins came up with the following:
Create /root/bin/rplc as follows:
#!/bin/bash if [ -z "$1" ]; then echo $"usage: `basename $0` filename.rpmsave" exit 1 fi
DIRNAME=`dirname $1` BASENAME=`basename $1 .rpmsave` ORIG=$DIRNAME/$BASENAME
if [ -r "$ORIG" ]; then mv -i $ORIG $1 fi
Then execute:
# chmod +x /root/bin/rplc # find /etc -name "*.rpmsave" -exec /root/bin/rplc {} ;
The script should also check that the input path exists, is a file, and contains ".rpmsave" (and the find command could be in the script and use xargs with a function or something), but the above works and those details are left as an exercise for the student. :-)
Phil
Wouldn't say I'd recommend it without carefully checking differences first, but just for grins came up with the following:
Create /root/bin/rplc as follows:
#!/bin/bash if [ -z "$1" ]; then echo $"usage: `basename $0` filename.rpmsave" exit 1 fi
DIRNAME=`dirname $1` BASENAME=`basename $1 .rpmsave` ORIG=$DIRNAME/$BASENAME
if [ -r "$ORIG" ]; then mv -i $ORIG $1 fi
Then execute:
# chmod +x /root/bin/rplc # find /etc -name "*.rpmsave" -exec /root/bin/rplc {} ;
The script should also check that the input path exists, is a file, and contains ".rpmsave" (and the find command could be in the script and use xargs with a function or something), but the above works and those details are left as an exercise for the student. :-)
Phil
Wow! That looks great, thanks! I'm not a scripter at all but i'll see if I can include a compare between the .rpmsave and the original file, if they are the same use the new file otherwise just skip it.
A second find command at the end could display the leftover .rpmsave files for further checking :)
This should be a standard feature
Thanks for the starting point!
Remco