#!/bin/bash

set -ex

if [ "x$CIP_ENV" == "x" ]; then
  echo "please set CIP_ENV to one of:"
  echo " export CIP_ENV=ALIEN_INSTALL_TYPE=share"
  echo " export CIP_ENV=ALIEN_INSTALL_TYPE=system"
  false
fi

cip sudo apt-get update

if echo $CIP_ENV | grep -q system; then
  echo use system xz
  cip sudo apt-get -y install liblzma-dev xz-utils
else
  echo use internet xz
  cip exec cpanm -n Alien::Build::Plugin::Download::GitHub
  cip sudo apt-get -y install autopoint
fi

cip exec dzil-cpanm -n Alien::Build::Plugin::Download::GitHub
