summaryrefslogtreecommitdiffstats
path: root/debian/bin
diff options
context:
space:
mode:
Diffstat (limited to 'debian/bin')
-rw-r--r--debian/bin/gen_plugin_deps.pl106
-rwxr-xr-xdebian/bin/repack.sh39
2 files changed, 145 insertions, 0 deletions
diff --git a/debian/bin/gen_plugin_deps.pl b/debian/bin/gen_plugin_deps.pl
new file mode 100644
index 0000000..1280074
--- /dev/null
+++ b/debian/bin/gen_plugin_deps.pl
@@ -0,0 +1,106 @@
+#! /usr/bin/perl
+#
+# collectd - gen_plugin_deps.pl
+# Copyright (C) 2007 Sebastian Harl
+#
+# 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; only version 2 of the License is applicable.
+#
+# 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.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Author:
+# Sebastian Harl <sh at tokkee.org>
+
+use strict;
+use warnings;
+
+# actual not needed
+my $extra_deps = {
+# sensors => [ 'lm-sensors' ],
+};
+
+my $infile = "debian/README.Debian.plugins.in";
+my $outfile = "debian/README.Debian.plugins";
+
+my ($ifile, $ofile);
+
+if (! open($ifile, "<", $infile)) {
+ print STDERR "Could not open file '$infile': $!\n";
+ exit 1;
+}
+
+if (! open($ofile, ">", $outfile)) {
+ print STDERR "Could not open file '$outfile': $!\n";
+ exit 1;
+}
+
+while (my $line = <$ifile>) {
+ if ($line !~ m/^\@PLUGIN_DEPS\@\n$/) {
+ print $ofile $line;
+ }
+ else {
+ print_plugin_deps($ofile);
+ }
+}
+
+close($ofile);
+close($ifile);
+
+sub print_plugin_deps
+{
+ my $fh = shift;
+ my $pdir = undef;
+ my $i = 0;
+
+ my $plugindir = "debian/monitoring-plugins-standard/usr/lib/nagios/plugins/";
+
+ if (! opendir($pdir, $plugindir)) {
+ print STDERR "Could not open directory '$plugindir': $!\n";
+ exit 1;
+ }
+
+ foreach my $dirent (sort readdir($pdir)) {
+# if ($dirent !~ m/^(\w+).so$/) {
+ if ($dirent !~ m/^check_(\w+)$/) {
+ next;
+ }
+
+ my $name = $1;
+ my $deps = `dpkg-shlibdeps -O $plugindir/$dirent`;
+
+ chomp $deps;
+
+ $deps =~ s/^shlibs:Depends=//;
+
+ my @deps = grep !m/^libc6\b/, split m/, /, $deps;
+
+ if (scalar @deps) {
+ if (0 < $i) {
+ print $fh "\n";
+ }
+
+ ++$i;
+
+ print $fh "check_$name:\n";
+
+ if (defined $extra_deps->{$name}) {
+ unshift @deps, @{$extra_deps->{$name}};
+ }
+
+ foreach my $dep (@deps) {
+ print $fh " * $dep\n";
+ }
+ }
+ }
+}
+
+# vim: set tw=78 sw=4 ts=4 noexpandtab :
+
diff --git a/debian/bin/repack.sh b/debian/bin/repack.sh
new file mode 100755
index 0000000..cc3b78f
--- /dev/null
+++ b/debian/bin/repack.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# Borrowed from Raphael Geissert's Debian PHP repack script.
+
+set -e
+
+if [ ! -f "$3" ] && [ ! -f "$1" ]; then
+ echo "This script must be run via uscan or by manually specifying the tarball" >&2
+ exit 1
+fi
+
+tarball=
+
+[ -f "$3" ] && tarball="$3"
+[ -z "$tarball" -a -f "$1" ] && tarball="$1"
+
+tarball="$(readlink -f "$tarball")"
+
+tdir="$(mktemp -d)"
+trap '[ ! -d "$tdir" ] || rm -r "$tdir"' EXIT
+
+tar -xzf $tarball -C $tdir
+cp -a "$tarball" "$tarball.orig"
+distdir="$(basename $(ls -d $tdir/*))"
+srcdir="$tdir/$distdir"
+
+#echo "Adjusting $srcdir/configure"
+sed -i 's/perlmods\/Makefile\ //' $srcdir/configure
+sed -i '/perlmods\/Makefile/d' $srcdir/configure
+#echo "Adjusting $srcdir/configure.in"
+[ -f $srcdir/configure.in ] && sed -i '/perlmods\/Makefile/d' $srcdir/configure.in
+#echo "Adjusting $srcdir/configure.am"
+[ -f $srcdir/configure.ac ] && sed -i '/perlmods\/Makefile/d' $srcdir/configure.ac
+#echo "Adjusting $srcdir/Makefile*"
+sed -i 's/perlmods\ //' $srcdir/Makefile*
+#echo "Removing $srcdir/perlmods/
+rm -rf $srcdir/perlmods/
+
+tar -cof "${tarball%.*}" -C $tdir/ $distdir
+gzip -f9 "${tarball%.*}"