Getting rid of all the .rpmsave files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



> 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

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux