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