#!/bin/sh

PKGBASE=/var/sadm/pkg/rcouch
RELOC=$PKGBASE/save/pspool/rcouch/reloc

while read dest
do
    orig=$RELOC/`echo $dest | cut -d / -f 3-`

    dsum=`sum $dest | cut -d ' ' -f 1`
    osum=`sum $orig | cut -d ' ' -f 1`

    if [ "$dsum" = "$osum" ] ; then
        # The file is the same as the original, just remove it
        rm -f $dest
    else
        echo "Not removing changed file $dest"
    fi
done
