#!/bin/sh
set -e
set -o pipefail

# this script assumes tool and server dists are in same dir with the specific filenames below 

rm -Rf jboss-server-migration
rm -Rf jboss-eap-7.1
rm -Rf jboss-eap-6.4

unzip jboss-server-migration-1.2.0.CR1-SNAPSHOT.zip
# unzip -q jboss-server-migration-1.1.0.Final.zip
unzip -q jboss-eap-7.1.0.zip
unzip -q jboss-eap-6.4.0.zip

standaloneSrcDir=eap-6.4-standalone
domainSrcDir=eap-6.4-domain
standaloneTgtDir=eap-7.1-standalone
domainTgtDir=eap-7.1-domain

rm -Rf $standaloneSrcDir
rm -Rf $domainSrcDir
rm -Rf $standaloneTgtDir
rm -Rf $domainTgtDir
mv jboss-eap-6.4/standalone $standaloneSrcDir
mv jboss-eap-6.4/domain $domainSrcDir

root=$PWD

./jboss-server-migration/jboss-server-migration.sh -n -Djboss.server.migration.server.source.standalone.serverDir=$root/$standaloneSrcDir -Djboss.server.migration.server.target.standalone.serverDir=$root/$standaloneTgtDir -Djboss.server.migration.server.source.domain.domainDir=$root/$domainSrcDir -Djboss.server.migration.server.target.domain.domainDir=$root/$domainTgtDir -s $root/jboss-eap-6.4/ -t $root/jboss-eap-7.1/
