#!/bin/sh # postinst script for ocsinventory-agent # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-remove' # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in configure|reconfigure) if [ -f /etc/ocsinventory-client/last_state ]; then echo "Moving autogenerated file to right directory" mv -v /etc/ocsinventory-client/last_state \ /var/cache/ocsinventory-agent/ fi if [ -f /etc/ocsinventory-client/ocsinv.adm ]; then echo "Moving autogenerated file to right directory" mv -v /etc/ocsinventory-client/ocsinv.adm \ /var/lib/ocsinventory-agent/ ucf --purge /etc/ocsinventory-client/ocsinv.adm fi if [ -f /etc/init.d/ocsinventory-client ]; then echo "Deleting old init.d file" rm -fv /etc/init.d/ocsinventory-client update-rc.d ocsinventory-client remove >/dev/null || exit 0 fi # source debconf library . /usr/share/debconf/confmodule SERVER="http" db_get ocsinventory-agent/method || true if [ "$RET" = "http" ]; then db_get ocsinventory-agent/server || true SERVER="$RET" fi db_get ocsinventory-agent/tag || true TAG="LliureX" # Creating local sample config TMPFILE=`mktemp /tmp/ocsinv.XXXXXXXX` if [ -n "$SERVER" ]; then echo "server=$SERVER" >> $TMPFILE fi if [ -n "$TAG" ]; then echo "tag=$TAG" >> $TMPFILE fi # Install the config ucf --debconf-ok $TMPFILE /etc/ocsinventory/ocsinventory-agent.cfg db_stop rm -f $TMPFILE ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0