#!/bin/sh

set -e

BASE="$HOME/.pwn/hashpump"

if [[ ! -d "$BASE/bin" ]]; then
	if [[ ! -d "$BASE/src" ]]; then
		git clone --depth 1 --recursive \
			https://github.com/bwall/HashPump.git \
			"$BASE/src"
	fi
	if ! ldconfig -p | grep libssl > /dev/null; then
		echo "Please install openssl-devel"
		exit 1
	fi
	make --directory "$BASE/src" INSTALLLOCATION="$BASE/bin/"
	mkdir "$BASE/bin"
	make --directory "$BASE/src" INSTALLLOCATION="$BASE/bin/" install
fi

"$BASE/bin/hashpump" "$@"
