#!/usr/bin/env bash

SDB_V="v0.9"
SDB_VERSION="0.9.51"

# Update apt-get repositories
sudo apt-get update

# cd to /tmp
cd /tmp

# Install prerequisites
wget -q -c http://downloads.slashdb.com/${SDB_V}/${SDB_VERSION}/slashdb-prerequisites_${SDB_VERSION}.deb
sudo dpkg -i /tmp/slashdb-prerequisites_${SDB_VERSION}.deb
sudo apt-get -fy install

# Install oracle deb-s
sudo dpkg -i /tmp/oracle_debs/oracle*.deb
sudo apt-get -fy install

# Install SlashDB
wget -q -c http://downloads.slashdb.com/${SDB_V}/${SDB_VERSION}/slashdb_${SDB_VERSION}.deb
sudo dpkg -i /tmp/slashdb_${SDB_VERSION}.deb
sudo apt-get -fy install

# RM garbage
sudo rm -rf /tmp/oracle_debs/ 2> /dev/null
sudo rm -rf /tmp/slashdb_${SDB_VERSION}.deb 2> /dev/null
sudo rm -rf /tmp/slashdb-prerequisites_${SDB_VERSION}.deb 2> /dev/null

echo "SlashDB v${SDB_VERSION} installed successfully."
