#!/bin/bash
[ "$2" == "" ] && exec echo "Usage: $0 <XignCode Patch Root 7zip Tarball> <CDN Environment (TEST/LIVE)>"

source $HOME/.gamerc

XIGNCODE_TARBALL=$1
ENVIRONMENT=$2

if [ ! -d "${XIGNCODE_PATCH_ROOT_SOURCE}${ENVIRONMENT}" ]; then mkdir -p ${XIGNCODE_PATCH_ROOT_SOURCE}${ENVIRONMENT}; fi

cd ${XIGNCODE_PATCH_ROOT_SOURCE}${ENVIRONMENT}; rm -rf ${XIGNCODE_PATCH_ROOT_DIRECTORY_NAME}

7za x ${XIGNCODE_PATCH_ROOT_7ZIP_DIRECTORY}${XIGNCODE_TARBALL} -p${XIGNCODE_PASSWORLD} -o${XIGNCODE_PATCH_ROOT_SOURCE}${ENVIRONMENT}

chmod -R 777 ${XIGNCODE_PATCH_ROOT_SOURCE}${ENVIRONMENT}/${XIGNCODE_PATCH_ROOT_DIRECTORY_NAME}
