#!/usr/bin/env bash

if [ -z "$HOME" ]
then
  mkdir -p $SNAP_DATA/var/tmp/
  export HOME=$SNAP_DATA/var/tmp/
fi

set -eu

. $SNAP/actions/common/utils.sh

use_snap_env

# This is really the only way I could find to get the args passed in correctly.
declare -a args="($(cat $SNAP_DATA/args/cluster-agent))"

${SNAP}/bin/cluster-agent cluster-agent "${args[@]}"
