set -xe

mkdir -p $PREFIX/bin
mkdir -p $PREFIX/imager

cp ds9 $PREFIX/imager
cp $RECIPE_DIR/ds9.wrapper $PREFIX/bin/ds9

if [ "`uname -s`" == "Linux" ] ; then
  mkdir -p $PREFIX/lib/ciao-ds9
  cp /usr/lib64/libssl.so.10 $PREFIX/lib/ciao-ds9
  cp /usr/lib64/libcrypto.so.10 $PREFIX/lib/ciao-ds9
else
  cp ds9.zip $PREFIX/imager
fi

# Copy the [de]activate scripts to $PREFIX/etc/conda/[de]activate.d.
# This will allow them to be run on environment activation.
for CHANGE in "activate" "deactivate"
do
    mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d"
    cp "${RECIPE_DIR}/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.sh"
    cp "${RECIPE_DIR}/${CHANGE}.csh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.csh"
done
