#!/bin/sh

set -e

BASE="$PWD"
PARENT="$(dirname $BASE)"
VERSION="${BASE##*-}"
TARBALL="build/ocaml-$VERSION.tar.zst"

if ! [ -L usr ]; then
    echo "usr is not a symbolic link!"
    exit 1
fi

if [ "$BASE" != "$PARENT/ocaml-$VERSION" ]; then
    echo "$BASE is not $PARENT/ocaml-$VERSION"
    exit 1
fi

rm -f "$TARBALL"
$(readlink usr)/bin/create-transition.sh "$VERSION" "$PARENT"
