Support des anciennes distributions Debian (ex. : Lenny)
[auf-inventaire.git] / auf-inventaire-config
CommitLineData
f62a9240
P
1#!/bin/sh
2# script de mise à jour de la config' de FusionInventory
3# syntaxe : auf-inventaire-config [<tag>]
4
5update_file() {
6 file="$1" ; line="$2"
7 grep -q -x "${line}" "${file}" && return
8 left_part="`echo "${line}" | cut -d'=' -f1`="
9 sed -i "/^${left_part}/s/^/#/" "${file}"
10 echo "${line}" >> "${file}"
11}
12
13while read line
14do
15 update_file "/etc/fusioninventory/agent.cfg" "${line}"
16done << __EOF__
17server = https://glpi.auf.org/glpi/plugins/fusioninventory/
18no-task = deploy
19#ca-cert-file = /etc/ssl/certs/AUF-RACINE+BA.pem
20no-ssl-check = 1
21no-httpd = 1
293d39a1 22logger = Syslog
f62a9240
P
23__EOF__
24
25if [ -n "$1" ]
26then
27 update_file "/etc/fusioninventory/agent.cfg" "tag = $1"
28fi
29
30while read line
31do
32 update_file "/etc/default/fusioninventory-agent" "${line}"
33done << __EOF__
34MODE=daemon
35__EOF__
36
2da1bcae
P
37if test -x /usr/sbin/service
38then
39 service fusioninventory-agent stop
40 sleep 2
41 service fusioninventory-agent start
42else # support des anciennes distributions Debian (ex. : Lenny)
43 invoke-rc.d fusioninventory-agent stop
44 sleep 2
45 invoke-rc.d fusioninventory-agent start
46fi
47
48echo "Envoi immédiat des informations d'inventaire..."
49exec fusioninventory-agent --no-fork --logger=Stderr