#!/usr/bin/env bash

set -e

if [ "$#" -ne 2 ]; then
    echo "Usage: psemek-package <platform> <project-dir>"
    echo "Supported platforms:"
    echo "    linux"
    echo "    windows"
    echo "    android"
    echo "    web"
    exit 0
fi

case ${1} in
    linux) ;;
    windows) ;;
    android) ;;
    web) ;;
    *)
        echo "Unknown platform: ${1}"
	exit -1
esac

PROJECT_DIR=`realpath "${2}"`

docker run -u 1000 -v "${PROJECT_DIR}":/home/source -e PSEMEK_KEYSTORE_PASSWORD=${PSEMEK_KEYSTORE_PASSWORD} lisyarus/psemek:package-${1} /home/package.sh

echo Packaging finished
