#!/bin/sh

DESTHOST="compassion.opengroupware.org"
DESTHOSTLOGIN=helge

DSTVHOSTROOT=/vserver_from_honesty/www/var/virtual_hosts
DESTVHOST="sope"
DESTVHOSTSUFFIX=

SRCFILE="$1"

if ! test -f "$SRCFILE"; then
  echo "source does not exist: $SRCFILE"
  exit 1
fi

DSTFILE="`basename ${SRCFILE}`"

DESTARCHDIR="/home/helge/exports"

# copy to 'exports' directory
scp "$SRCFILE" ${DESTHOSTLOGIN}@${DESTHOST}:${DESTARCHDIR}/${DSTFILE}

# extract
ssh root@${DESTHOST} \
 "tar zx --file=${DESTARCHDIR}/${DSTFILE} -C ${DSTVHOSTROOT}/${DESTVHOST}${DESTVHOSTSUFFIX}"
