#!/usr/bin/env bash
# Copyright (c) 2017-2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail

version=1.12.0

function install {
    if ! link ; then
        curl -sSL https://get.daml.com/ | sh
        link
    fi
    daml install "${version}"
}

function link {
    mkdir -p "$HOME/bin"
    [ -f "$HOME/.daml/bin/daml" ] && \
        ln -s "$HOME/.daml/bin/daml" "$HOME/bin/"
}

install
