#!/usr/bin/bash
INSTALL=$(find ~/Downloads/mdtohtml*.gz)
INSTALL_TO="$HOME/bin"
set -e
if [ ! -n "$INSTALL" ]; then
  echo "~/Downloads is missing install file mdtohtml*.gz"
  echo "Get it from https://github.com/sgaunet/mdtohtml/releases"
  exit 1
fi

echo "Installing from $INSTALL..."
cd /tmp
tar xf $INSTALL

mkdir -p "$INSTALL_TO"
mv mdtohtml $INSTALL_TO

