From 8758f6464a380124b8e2d1e8dbd59930c1ae1be7 Mon Sep 17 00:00:00 2001
From: David Beniamine <david.beniamine@tetras-libre.fr>
Date: Wed, 4 Dec 2024 15:22:29 +0100
Subject: [PATCH] Install glpi_agent

---
 install_glpi_agent.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100755 install_glpi_agent.sh

diff --git a/install_glpi_agent.sh b/install_glpi_agent.sh
new file mode 100755
index 0000000..85550b2
--- /dev/null
+++ b/install_glpi_agent.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+VERSION=1.11
+glpiver=$(dpkg -l | awk '/\sglpi-agent\s/{print $3}' | cut -d : -f 2 | cut -d - -f 1)
+refip=$(ip a | awk '/inet 10\./{print $2}' | sed  's@/[0-9][0-9]$@@')
+if [ "$glpiver" != "$VERSION" ]; then
+        cd /tmp
+                wget -O glpi-agent.pl https://github.com/glpi-project/glpi-agent/releases/download/$VERSION/glpi-agent-$VERSION-linux-installer.pl
+        perl /tmp/glpi-agent.pl --server=https://glpi.grenoble.fr/plugins/glpiinventory/ --tag=$refip --install --service --tasks=inventoy,deploy,inventory,NetDiscovery,NetInventory --type=all --runnow
+        rm glpi-agent.pl
+        glpi-agent
+fi
-- 
GitLab