#!/usr/bin/env bash
set -euo pipefail
set -x

# install classic notebook extensions
jupyter nbextension enable --py widgetsnbextension --sys-prefix

# if DEFAULT_ENV is unset ${DEFAULT_ENV+x} expands to nothing otherwise
# it substitutes the string x. This allows us to check if the variable
# is set without triggering an unbound variable error
if [[ -z "${DEFAULT_ENV+x}" ]]; then
    fix-permissions /opt/conda/bin
else
    fix-permissions "/opt/conda/envs/${DEFAULT_ENV}"
fi
