#!/bin/bash

set -e

if [ $# -ne 1 ] ; then
    echo "usage; <prog> version"
    echo "e.g., ./rondb-installer-update.sh 21.04"
    echo ""
    exit 1
fi

mkdir -p $1
cd $1

rm -f hopsworks*sh
rm -f rondb-installer.sh
wget https://raw.githubusercontent.com/logicalclocks/karamel-chef/rondb_v2/hopsworks-installer.sh
chmod +x hopsworks-installer.sh
mv hopsworks-installer.sh rondb-installer.sh
rm -f rondb-cloud-installer.sh
wget https://raw.githubusercontent.com/logicalclocks/karamel-chef/rondb_v2/cloud/hopsworks-cloud-installer.sh
chmod +x hopsworks-cloud-installer.sh
mv hopsworks-cloud-installer.sh rondb-cloud-installer.sh


cd ..

rm -f rondb
ln -s $1 rondb

echo "Done."

exit 0
