+Find .rpmnew files automatically.
authorlace <>
Tue, 30 Jun 2009 07:16:26 +0000 (07:16 +0000)
committerlace <>
Tue, 30 Jun 2009 07:16:26 +0000 (07:16 +0000)
+Backup all the config files to -orig.

bin/rpmmerge

index 87c2297..c6d4d7c 100755 (executable)
@@ -2,7 +2,9 @@
 # $Id$
 
 set -ex
-for base in "$@";do
+l="$*"
+[ -z "$l" ] && l="$(rpm -qla|perl -lne 'chomp;s/$/.rpmnew/;print if -f;')"
+for base in $l;do
        base=`echo $base|sed 's/[.]rpmnew$//'`
        test -f $base
        test -f $base.rpmnew
@@ -29,4 +31,7 @@ for base in "$@";do
        rm -f $base.rej
        exit 1
 done
+
+rpm -qac|perl -ne 'chomp;next if $_ eq "(contains no files)";next if m{^/var/lib/rpm/};next if ! -f $_;$o="$_-orig";next if -e $o;system "cp -i -p '\''$_'\'' '\''$o'\''" and die "$_: $!";'
+
 echo OK