#!/bin/sh

if [ $# -eq 0 ]; then
    >&2 echo "A public key must be provided."
    return
fi

# Since we don't need the 238 packages required to run wx applications, we
# might as well see if a headless miner can run on just a subset of erlang.
sudo apt -y install wget erlang-tools erlang-dev erlang-eunit erlang-inets

wget -q https://zxq9.com/projects/zomp/get_zx && bash get_zx
export PATH=$PATH:$HOME/bin

zx import realm install_scripts/qpq.zrf
zx import realm install_scripts/uwiger.zrf
zx run uwiger-gmhive_client -gmhc pubkey "$1"
