#!/bin/sh

if [ "$#" -eq 0 ]
then
  echo "Must supply path for merged files"
  exit 1
fi

target="$1"

target=${target%/}

find "$target" -name "*.mrg.gz" -delete

osname=`uname -s | sed -e 's/_NT-.*$/_NT/; s/^MINGW[0-9]*/CYGWIN/'`
if [ "$osname" = "CYGWIN_NT" -a -x /bin/cygpath ]
then
  target=`cygpath -w "$target"`
fi

target=${target%/}

rchive -gzip -merge "$target" *.inv.gz
