#!/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 exec dzil-cpanm -n Sort::Versions
if cip exec perl -e 'exit ! ($] < 5.020)'; then
  cip exec dzil-cpanm -n List::Util
fi

if echo $CIP_ENV | grep -q system; then
  echo use system libtool
  cip sudo apt-get update
  cip sudo apt-get -y install libtool-bin libtool m4
else
  echo use internet libtool
fi

