set -e
PKG_NAMES=$1
COMPONENT=$2
COMPONENT_SRC=$3
DEPS=$4
if [[ -z ${PKG_NAMES} || -z ${COMPONENT} || -z ${COMPONENT_SRC} || -z ${DEPS} ]]; then
echo "Usage: $0 package-names component component-src -deps=true|false"
exit 1;
fi
DEPS_CMD=''
if [ "${DEPS}" == "-deps=true" ]; then
DEPS_CMD="--deps"
fi
if [ -z $5 ]; then
CMD="./copy_debs.py ${DEPS_CMD} ${COMPONENT} ${COMPONENT_SRC} ${PKG_NAMES}"
else
CMD=$5
fi
echo "$CMD"
docker build -t copy-debs \
-f upload-debs.Dockerfile \
--build-arg USER_NAME=${USER} \
--build-arg USER_ID=`id -u` .
docker run \
-i \
-u `id -u` \
--rm \
-v ~/.ssh/id_rsa.repo.evernym.com:/home/${USER}/.ssh/id_rsa.repo.evernym.com \
-v ~/.ssh/id_rsa.repo.sovrin.org:/home/${USER}/.ssh/id_rsa.repo.sovrin.org \
-e COMPONENT=$COMPONENT \
copy-debs $CMD