#!/bin/ksh

#
# set up internal parameters
#

SHOPSITE_DIRECTORY=$1
SHOPSITE_STORE_ID=$2
SHOPSITE_SELLER_PASSWORD=$3
DEBUG_LOG_DIRECTORY=$4
DEBUG_LOG_FILE=$5
LOG_DEBUG=$6

FATAL_ERROR=1000

#
# Functions
#


#
# print debug string to appropriate location
#
# $1=debug string to be printed
#
print_debug()
{
  ./debug_handler.ksh "$0" "$SHOPSITE_STORE_ID" "$1" "$DEBUG_LOG_DIRECTORY" "$DEBUG_LOG_FILE" "$LOG_DEBUG"
}

##  Create the .htaccess file and the .htpasswd file (if needed).
##  Add user id and password to the .htpasswd file.
if ! (./wwwinstall.cgi "-shopSiteDirectory" "$SHOPSITE_DIRECTORY" "-userId" "$SHOPSITE_STORE_ID" "-password" "$SHOPSITE_SELLER_PASSWORD" "-action" "setPassword")
then
    ERROR=`./error_handler.ksh $FATAL_ERROR`
    printf "ERROR: $ERROR\n"
    exit 1
fi

exit 0
