#!/bin/bash
set -e
echo "JC Remote macOS Support Installer"
echo
echo "This will install RustDesk, enroll this Mac in JC Remote, and set up heartbeat check-ins."
echo "An administrator password may be required."
echo
script="/tmp/Install-RustDeskClient-macOS.sh"
curl -fsSL 'https://35.212.183.172.sslip.io/rust/deploy/Install-RustDeskClient-macOS.sh' -o "$script"
chmod +x "$script"
if [ "$(id -u)" -eq 0 ]; then
  bash "$script" --fleet-token '2c5debbe717e9750d2f5aaa8e616ac0e214b74fd7e1cf6b7' --portal-url 'https://35.212.183.172.sslip.io/rust' --rustdesk-id-server '35.212.183.172:21116' --rustdesk-relay-server '35.212.183.172:21117' --rustdesk-key 'v0Vs5dP44RT2slD+jCPa9fcTJCEieYBKyJlwOAwZZ+Q=' --unattended-password 'GoWild00!'
else
  sudo bash "$script" --fleet-token '2c5debbe717e9750d2f5aaa8e616ac0e214b74fd7e1cf6b7' --portal-url 'https://35.212.183.172.sslip.io/rust' --rustdesk-id-server '35.212.183.172:21116' --rustdesk-relay-server '35.212.183.172:21117' --rustdesk-key 'v0Vs5dP44RT2slD+jCPa9fcTJCEieYBKyJlwOAwZZ+Q=' --unattended-password 'GoWild00!'
fi
echo
echo "Done. If System Settings opened, allow RustDesk under Accessibility and Screen Recording."
read -r -p "Press Return to close this window..." _
