#!/bin/sh
lastversion=$(curl https://downloads.preyproject.com/prey-client-releases/node-client/latest.txt)
sudo /usr/local/lib/prey/current/bin/prey config hooks pre_uninstall && sudo rm -rf /usr/local/lib/prey /var/log/prey.log /etc/prey
curl -o prey-mac-${lastversion}-x64.pkg https://downloads.preyproject.com/prey-client-releases/node-client/${lastversion}/prey-mac-${lastversion}-x64.pkg && API_KEY=$1 sudo -E installer -pkg prey-mac-${lastversion}-x64.pkg -target /