--- /dev/null
+package Ocsinventory::Agent::Backend::OS::Generic::Hostname;
+
+sub check {
+ eval { require (Sys::Hostname) };
+ return 1 unless $@;
+ `which hostname 2>&1`;
+ return if ($? >> 8)!=0;
+ `hostname 2>&1`;
+ return if ($? >> 8)!=0;
+ 1;
+}
+
+# Initialise the distro entry
+sub run {
+ my $params = shift;
+ my $inventory = $params->{inventory};
+
+ my $hostname;
+
+ # ico, Tue, 26 May 2009 17:58:27 +0200
+ chomp ( my $hostname = `hostname --fqdn` );
+ #eval { require (Sys::Hostname) };
+ #if (!$@) {
+ # $hostname = Sys::Hostname::hostname();
+ #} else {
+ # chomp ( $hostname = `hostname` ); # TODO: This is not generic.
+ #}
+ #$hostname =~ s/\..*//; # keep just the hostname
+
+
+ $inventory->setHardware ({NAME => $hostname});
+}
+
+1;
--- /dev/null
+ocsinventory-agent-cn
++-------------------+
+
+Paket zamjenjuje Hostname.pm zbog slanja dugog oblika imena (FQDN).
+
+ -- Ivan Rako <Ivan.Rako@CARNet.hr> Fri, 26 Jun 2009 15:00:05 +0200
--- /dev/null
+changelog.Debian
\ No newline at end of file
--- /dev/null
+ocsinventory-agent-cn (1:0.0.9.2repack1-4) stable; urgency=low
+
+ * inicijalna verzija paketa
+
+ -- Ivan Rako <Ivan.Rako@CARNet.hr> Fri, 26 Jun 2009 15:01:18 +0200
--- /dev/null
+Source: ocsinventory-agent-cn
+Section: net
+Priority: optional
+Maintainer: Ivan Rako <Ivan.Rako@CARNet.hr>
+Build-Depends: debhelper (>= 4.0.0)
+Standards-Version: 3.6.1
+
+Package: ocsinventory-agent-cn
+Architecture: all
+Depends: carnet-tools-cn (>= 2.7), ocsinventory-agent (>= 1:0.0.9.2repack1-4)
+Description: Hardware and software inventory tool (client)
+ Open Computer and Software Inventory Next Generation is an
+ application designed to help a network or system administrator to
+ keep track of the hardware and software configurations of computers
+ that are installed on the network. It also allows deploying
+ software, scripts and files on client computers.
--- /dev/null
+README.CARNet
+changelog.CARNet
--- /dev/null
+Hostname.pm usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic
--- /dev/null
+#!/bin/sh
+
+set -e
+
+[ "$1" = "configure" ] || exit 0
+[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
+
+# Load CARNet Tools
+. /usr/share/carnet-tools/functions.sh
+# Load Debconf
+. /usr/share/debconf/confmodule
+
+ocsmethod="http"
+ocsserver="inventory.CARNet.hr"
+
+db_get ocsinventory-agent/method || true
+method="$RET"
+
+if [ "$method" != "$ocsmethod" ]; then
+ db_set ocsinventory-agent/method "$ocsmethod" || true
+fi
+
+db_get ocsinventory-agent/server
+server="$RET"
+
+if [ "$server" != "$ocsserver" ]; then
+ db_set ocsinventory-agent/server "$ocsserver"
+fi
+
+cp_check_and_sed "^server" \
+ "s/^server.*/server=$ocsserver/g" \
+ /etc/ocsinventory/ocsinventory-agent.cfg || true
+
+if ! grep -q ^server= /etc/ocsinventory/ocsinventory-agent.cfg; then
+ echo "server=$ocsserver" >> /etc/ocsinventory/ocsinventory-agent.cfg
+fi
--- /dev/null
+#!/bin/sh
+
+set -e
+
+if [ "$1" = remove ]; then
+ rm -f /etc/init.d/amavis
+ dpkg-divert --quiet --package ocsinventory-agent-cn --remove --rename \
+ --divert /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Hostname.pm.divert
+ /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Hostname.pm || true
+fi
--- /dev/null
+#!/bin/sh
+
+set -e
+
+if [ "$1" = install -o "$1" = upgrade ]; then
+ dpkg-divert --quiet --package ocsinventory-agent-cn --rename \
+ --divert /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Hostname.pm.divert \
+ /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Generic/Hostname.pm
+fi
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+
+ touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ # $(MAKE)
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ # -$(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/ocsinventory-agent-cn.
+ # $(MAKE) install DESTDIR=$(CURDIR)/debian/ocsinventory-agent-cn
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs -k
+ dh_installdocs
+# dh_installexamples
+ dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+# dh_link
+# dh_strip
+# dh_compress
+ dh_fixperms
+# dh_perl
+# dh_python
+# dh_makeshlibs
+ dh_installdeb
+# dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure