#!/bin/sh
# Copyright (c) 2008-2020, Pervasync LLC. All rights reserved.

error(){
    echo "Shell script completed with error."
    exit 1
}

if [ ! -f pervasync_client_sqlite_setup.sh ]; then
    echo "Error!! This script can only be executed in its own folder."
    error
else 
    java -classpath "../../classes:$(echo ../../lib/*.jar | tr ' ' ':')"  pervasync.client.SyncClientSetup sqlite setupClient
    if [ $? != 0 ] ; then error; fi
    
    java -classpath "../../classes:$(echo ../../lib/*.jar | tr ' ' ':')"  pervasync.client.SyncClientSetup sqlite createDb
    if [ $? != 0 ] ; then error; fi
    
fi

echo "Shell script completed successfully."
