1
0
mirror of https://github.com/librenms/librenms-agent.git synced 2024-05-09 09:54:52 +00:00

Merge pull request #5 from tuxis-ie/master

Add files to create a Debian-package
This commit is contained in:
Daniel Preussker
2015-08-20 17:14:11 +00:00
8 changed files with 154 additions and 1 deletions

17
Makefile Normal file
View File

@@ -0,0 +1,17 @@
PREFIX=${CURDIR}/debian/librenms-agent
install:
mkdir -p $(PREFIX)/usr/lib/check_mk_agent/plugins
mkdir -p $(PREFIX)/usr/lib/check_mk_agent/repo
mkdir -p $(PREFIX)/usr/lib/check_mk_agent/local
cp -r agent-local/* $(PREFIX)/usr/lib/check_mk_agent/repo/
rm $(PREFIX)/usr/lib/check_mk_agent/repo/README
mkdir -p $(PREFIX)/usr/bin
install -m 0750 check_mk_agent $(PREFIX)/usr/bin/check_mk_agent
install -m 0750 mk_enplug $(PREFIX)/usr/bin/mk_enplug
install -m 0750 snmp/distro $(PREFIX)/usr/bin/distro
mkdir -p $(PREFIX)/etc/xinetd.d
install -m 0644 check_mk_xinetd $(PREFIX)/etc/xinetd.d/check_mk
clean:
rm -rf $(CURDIR)/build

View File

@@ -5,5 +5,5 @@ echo '<<<dmi>>>'
# requires dmidecode
for FIELD in bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency
do
echo $FIELD=$(dmidecode -s $FIELD)
echo $FIELD=$(dmidecode -s $FIELD | grep -v '^#')
done

11
debian/changelog vendored Normal file
View File

@@ -0,0 +1,11 @@
librenms-agent (1.0.1) stable; urgency=low
- Do not include the README in the repodir
-- Mark Schouten <mark@tuxis.nl> Thu, 20 Aug 2015 14:15:00 +0200
librenms-agent (1.0) stable; urgency=low
- Initial package release
-- Mark Schouten <mark@tuxis.nl> Mon, 17 Aug 2015 15:00:00 +0200

1
debian/compat vendored Normal file
View File

@@ -0,0 +1 @@
7

15
debian/control vendored Normal file
View File

@@ -0,0 +1,15 @@
Source: librenms-agent
Section: misc
Priority: extra
Maintainer: Mark Schouten <mark@tuxis.nl>
Build-Depends: debhelper (>= 5)
Standards-Version: 3.9.1
Package: librenms-agent
Architecture: all
Pre-Depends: xinetd
Conflicts: check-mk-agent
Provides: check-mk-agent
Suggests: php-cli, php-mysql, libwww-perl, curl, dmidecode, netcat, ipmitool, lm-sensors, python-memcache, python-urllib3, rrdtool, libdbd-pg-perl
Description: Install the LibreNMS Unix Agent
Install the LibreNMS Unix Agent. Please note that the suggested packages are required for some of the plugins

40
debian/postinst vendored Normal file
View File

@@ -0,0 +1,40 @@
#!/bin/sh
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#
case "$1" in
configure)
[ -x /usr/sbin/service ] && service xinetd restart
echo "Enable some default services"
/usr/bin/mk_enplug dpkg
/usr/bin/mk_enplug dmi
;;
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

7
debian/rules vendored Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/make -f
#export DH_VERBOSE=1
%:
dh $@

62
mk_enplug Executable file
View File

@@ -0,0 +1,62 @@
#!/bin/bash
# Copyright (C) 2015 Mark Schouten <mark@tuxis.nl>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June,
# 1991.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See http://www.gnu.org/licenses/gpl.txt for the full license
plugdir=/usr/lib/check_mk_agent/plugins
repodir=/usr/lib/check_mk_agent/repo
findscripts() {
find ${repodir} -type f | sed -e "s#$repodir/##g"
}
script_enabled() {
s=$1
if [ -L ${plugdir}/${s} ]; then
echo "yes"
else
echo "no"
fi
}
enable_script() {
s=$1
ln -s ${repodir}/${s} ${plugdir}/${s}
echo "Enabled $s"
}
scripts=$(findscripts)
if [ ! -z "$1" ]; then
s=$1
else
echo "Which plugin do you want to enable?"
echo ${scripts}
read s
fi
echo "Enabling $s"
if [ ! -z "$s" ]; then
if [ ! -r ${repodir}/${s} ]; then
echo "Plugin $s does not exist!"
exit 1
fi
if [ `script_enabled $s` != "yes" ]; then
enable_script $s
fi
fi