#!/bin/bash

curl -O https://ftp-glpi.oca.eu/macOS/GLPI-Agent/GLPI-Agent_arm64.pkg
wait
installer -pkg GLPI-Agent_arm64.pkg -target /
wait
mkdir -p /Applications/GLPI-Agent/etc/conf.d/
wait
echo -e "httpd-trust = '127.0.0.1/32,192.54.174.76/32'\nserver = 'https://glpi.oca.eu/plugins/glpiinventory/'\ntasks = 'inventory,deploy'" > /Applications/GLPI-Agent/etc/conf.d/local.cfg
wait
/Applications/GLPI-Agent/bin/glpi-agent --daemon
wait
curl http://localhost:62354/now