ispravke u postrm
[ocsinventory-agent-cn.git] / debian / postinst
1 #!/bin/sh
2
3 set -e
4
5 [ "$1" = "configure" ] || exit 0
6 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
7
8 # Load CARNet Tools
9 . /usr/share/carnet-tools/functions.sh
10 # Load Debconf
11 . /usr/share/debconf/confmodule
12
13 ocsmethod="http"
14 ocsserver="https://inventory.CARNet.hr/ocsinventory"
15
16 db_get ocsinventory-agent/method || true
17 method="$RET"
18
19 if [ "$method" != "$ocsmethod" ]; then
20   db_set ocsinventory-agent/method "$ocsmethod" || true
21 fi
22
23 db_get ocsinventory-agent/server
24 server="$RET"
25
26 if [ "$server" != "$ocsserver" ]; then
27   db_set ocsinventory-agent/server "$ocsserver"
28   set_ocsserver="yes"
29 fi
30
31 cp_check_and_sed "^server" \
32                  "s#^server.*#server=$ocsserver#g" \
33                  /etc/ocsinventory/ocsinventory-agent.cfg \
34                  && set_ocsserver="yes" || true
35
36 if [ "$set_ocsserver" = "yes" ]; then
37   echo "CN: OCS Inventory server: $ocsserver"
38 fi
39
40 if ! grep -q ^server= /etc/ocsinventory/ocsinventory-agent.cfg; then
41   echo "server=$ocsserver" >> /etc/ocsinventory/ocsinventory-agent.cfg
42 fi
43
44 #DEBHELPER#