mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v3 1/3] radvd: Initial commit
@ 2014-06-20 10:49 Markus Pargmann
  2014-06-20 10:49 ` [ptxdist] [PATCH v3 2/3] alfred: " Markus Pargmann
  2014-06-20 10:49 ` [ptxdist] [PATCH v3 3/3] collectd: " Markus Pargmann
  0 siblings, 2 replies; 3+ messages in thread
From: Markus Pargmann @ 2014-06-20 10:49 UTC (permalink / raw)
  To: ptxdist; +Cc: Markus Pargmann

Add radvd as package to ptxdist. Version 1.12 is used. A necessary patch
for not continous time is added which is not mainline yet.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 generic/etc/radvd.conf                             |  11 +
 generic/lib/systemd/system/radvd.service           |   8 +
 ...ime-Use-clock_gettime-and-monotonic-clock.patch | 256 +++++++++++++++++++++
 patches/radvd-1.12/series                          |   4 +
 rules/radvd.in                                     |  22 ++
 rules/radvd.make                                   |  60 +++++
 6 files changed, 361 insertions(+)
 create mode 100644 generic/etc/radvd.conf
 create mode 100644 generic/lib/systemd/system/radvd.service
 create mode 100644 patches/radvd-1.12/0001-time-Use-clock_gettime-and-monotonic-clock.patch
 create mode 100644 patches/radvd-1.12/series
 create mode 100644 rules/radvd.in
 create mode 100644 rules/radvd.make

diff --git a/generic/etc/radvd.conf b/generic/etc/radvd.conf
new file mode 100644
index 000000000000..5e1babe0ba7d
--- /dev/null
+++ b/generic/etc/radvd.conf
@@ -0,0 +1,11 @@
+
+interface RADVD_INTERFACE
+{
+	AdvSendAdvert on;
+
+	prefix RADVD_GATEWAY_SUBNET
+	{
+		AdvOnLink on;
+		AdvAutonomous on;
+	};
+};
diff --git a/generic/lib/systemd/system/radvd.service b/generic/lib/systemd/system/radvd.service
new file mode 100644
index 000000000000..c7be4f611321
--- /dev/null
+++ b/generic/lib/systemd/system/radvd.service
@@ -0,0 +1,8 @@
+[Unit]
+Description = IPv6 router advertisement daemon
+Requires = network.target
+After = network.target
+
+[Service]
+ExecStart = /usr/sbin/radvd -C /etc/radvd.conf -p /run/radvd.pid -d 1
+
diff --git a/patches/radvd-1.12/0001-time-Use-clock_gettime-and-monotonic-clock.patch b/patches/radvd-1.12/0001-time-Use-clock_gettime-and-monotonic-clock.patch
new file mode 100644
index 000000000000..a14250c58c75
--- /dev/null
+++ b/patches/radvd-1.12/0001-time-Use-clock_gettime-and-monotonic-clock.patch
@@ -0,0 +1,256 @@
+From: Markus Pargmann <mpa@pengutronix.de>
+Date: Fri, 13 Jun 2014 16:11:32 +0200
+Subject: [PATCH] time: Use clock_gettime and monotonic clock
+
+Currently the system time is used to calculate the timeout in
+milliseconds for the poll function. This can lead to bugs as soon as the
+time of the system changes through NTP. For example starting radvd
+before NTP can lead to a 44 year jump, resulting in a poll timeout of
+10^6 seconds.
+
+This patch replaces all gettimeofday() usage by the better clock_gettime
+call using a monotonic clock which avoids those situations.
+
+Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
+---
+ includes.h |  1 +
+ process.c  | 12 ++++++------
+ radvd.c    |  8 ++++----
+ radvd.h    | 12 ++++++------
+ send.c     | 24 ++++++------------------
+ timer.c    | 35 +++++++++++++++++++----------------
+ 6 files changed, 42 insertions(+), 50 deletions(-)
+
+diff --git a/includes.h b/includes.h
+index 2111e6651d31..d621b5ee585e 100644
+--- a/includes.h
++++ b/includes.h
+@@ -21,6 +21,7 @@
+ #include <stdio.h>
+ #include <stdarg.h>
+ #include <stdlib.h>
++#include <stdint.h>
+ #include <time.h>
+ #include <syslog.h>
+ #include <unistd.h>
+diff --git a/process.c b/process.c
+index 53a1150c2091..91011d036528 100644
+--- a/process.c
++++ b/process.c
+@@ -119,7 +119,7 @@ static void process_rs(struct Interface *iface, unsigned char *msg, int len, str
+ {
+ 	double delay;
+ 	double next;
+-	struct timeval tv;
++	struct timespec ts;
+ 	uint8_t *opt_str;
+ 
+ 	/* validation */
+@@ -154,22 +154,22 @@ static void process_rs(struct Interface *iface, unsigned char *msg, int len, str
+ 		opt_str += optlen;
+ 	}
+ 
+-	gettimeofday(&tv, NULL);
++	clock_gettime(CLOCK_MONOTONIC, &ts);
+ 
+ 	delay = MAX_RA_DELAY_TIME * rand() / (RAND_MAX + 1.0);
+ 
+ 	if (iface->UnicastOnly) {
+ 		send_ra_forall(iface, &addr->sin6_addr);
+-	} else if (timevaldiff(&tv, &iface->last_multicast) / 1000.0 < iface->MinDelayBetweenRAs) {
++	} else if (timespecdiff(&ts, &iface->last_multicast) / 1000.0 < iface->MinDelayBetweenRAs) {
+ 		/* last RA was sent only a few moments ago, don't send another immediately. */
+ 		next =
+-		    iface->MinDelayBetweenRAs - (tv.tv_sec + tv.tv_usec / 1000000.0) + (iface->last_multicast.tv_sec + iface->last_multicast.tv_usec / 1000000.0) + delay / 1000.0;
+-		iface->next_multicast = next_timeval(next);
++		    iface->MinDelayBetweenRAs - (ts.tv_sec + ts.tv_nsec / 1000000000.0) + (iface->last_multicast.tv_sec + iface->last_multicast.tv_nsec / 1000000000.0) + delay / 1000.0;
++		iface->next_multicast = next_timespec(next);
+ 	} else {
+ 		/* no RA sent in a while, send a multicast reply */
+ 		send_ra_forall(iface, NULL);
+ 		next = rand_between(iface->MinRtrAdvInterval, iface->MaxRtrAdvInterval);
+-		iface->next_multicast = next_timeval(next);
++		iface->next_multicast = next_timespec(next);
+ 	}
+ }
+ 
+diff --git a/radvd.c b/radvd.c
+index ab275efee40f..fcea72a2eea0 100644
+--- a/radvd.c
++++ b/radvd.c
+@@ -470,7 +470,7 @@ void timer_handler(void *data)
+ 		next = min(MAX_INITIAL_RTR_ADVERT_INTERVAL, next);
+ 	}
+ 
+-	iface->next_multicast = next_timeval(next);
++	iface->next_multicast = next_timespec(next);
+ }
+ 
+ void config_interface(void)
+@@ -499,12 +499,12 @@ void kickoff_adverts(void)
+ 	for (iface = IfaceList; iface; iface = iface->next) {
+ 		double next;
+ 
+-		gettimeofday(&iface->last_ra_time, NULL);
++		clock_gettime(CLOCK_MONOTONIC, &iface->last_ra_time);
+ 
+ 		if (iface->UnicastOnly)
+ 			continue;
+ 
+-		gettimeofday(&iface->last_multicast, NULL);
++		clock_gettime(CLOCK_MONOTONIC, &iface->last_multicast);
+ 
+ 		/* TODO: AdvSendAdvert is being checked in send_ra now so it can be removed here. */
+ 		if (!iface->AdvSendAdvert)
+@@ -516,7 +516,7 @@ void kickoff_adverts(void)
+ 			iface->init_racount++;
+ 
+ 			next = min(MAX_INITIAL_RTR_ADVERT_INTERVAL, iface->MaxRtrAdvInterval);
+-			iface->next_multicast = next_timeval(next);
++			iface->next_multicast = next_timespec(next);
+ 		}
+ 	}
+ }
+diff --git a/radvd.h b/radvd.h
+index d3b6957cff24..8db4b9dbe1c6 100644
+--- a/radvd.h
++++ b/radvd.h
+@@ -50,7 +50,7 @@ struct Interface {
+ 
+ 	int cease_adv;
+ 
+-	struct timeval last_ra_time;
++	struct timespec last_ra_time;
+ 
+ 	int IgnoreIfMissing;
+ 	int AdvSendAdvert;
+@@ -87,8 +87,8 @@ struct Interface {
+ 	struct AdvRDNSS *AdvRDNSSList;
+ 	struct AdvDNSSL *AdvDNSSLList;
+ 	struct Clients *ClientList;
+-	struct timeval last_multicast;
+-	struct timeval next_multicast;
++	struct timespec last_multicast;
++	struct timespec next_multicast;
+ 
+ 	/* Info whether this interface has failed in the past (and may need to be reinitialized) */
+ 	int HasFailed;
+@@ -212,9 +212,9 @@ void reload_config(void);
+ void reset_prefix_lifetimes(void);
+ 
+ /* timer.c */
+-struct timeval next_timeval(double next);
+-int timevaldiff(struct timeval const *a, struct timeval const *b);
+-int next_time_msec(struct Interface const *iface);
++struct timespec next_timespec(double next);
++int64_t timespecdiff(struct timespec const *a, struct timespec const *b);
++uint64_t next_time_msec(struct Interface const *iface);
+ int expired(struct Interface const *iface);
+ 
+ /* device.c */
+diff --git a/send.c b/send.c
+index fb14184d9d84..eaa9506bf6a0 100644
+--- a/send.c
++++ b/send.c
+@@ -76,18 +76,6 @@ static void send_ra_inc_len(size_t * len, int add)
+ 	}
+ }
+ 
+-static time_t time_diff_secs(const struct timeval *time_x, const struct timeval *time_y)
+-{
+-	time_t secs_diff;
+-
+-	secs_diff = time_x->tv_sec - time_y->tv_sec;
+-	if ((time_x->tv_usec - time_y->tv_usec) >= 500000)
+-		secs_diff++;
+-
+-	return secs_diff;
+-
+-}
+-
+ static void decrement_lifetime(const time_t secs, uint32_t * lifetime)
+ {
+ 
+@@ -118,8 +106,8 @@ int send_ra(struct Interface *iface, struct in6_addr *dest)
+ 	struct AdvDNSSL *dnssl;
+ 	struct AdvLowpanCo *lowpanco;
+ 	struct AdvAbro *abroo;
+-	struct timeval time_now;
+-	time_t secs_since_last_ra;
++	struct timespec time_now;
++	int64_t secs_since_last_ra;
+ 	char addr_str[INET6_ADDRSTRLEN];
+ 
+ 	unsigned char buff[MSG_SIZE_SEND];
+@@ -167,14 +155,14 @@ int send_ra(struct Interface *iface, struct in6_addr *dest)
+ 
+ 	if (dest == NULL) {
+ 		dest = (struct in6_addr *)all_hosts_addr;
+-		gettimeofday(&iface->last_multicast, NULL);
++		clock_gettime(CLOCK_MONOTONIC, &iface->last_multicast);
+ 	}
+ 
+-	gettimeofday(&time_now, NULL);
+-	secs_since_last_ra = time_diff_secs(&time_now, &iface->last_ra_time);
++	clock_gettime(CLOCK_MONOTONIC, &time_now);
++	secs_since_last_ra = timespecdiff(&time_now, &iface->last_ra_time) / 1000;
+ 	if (secs_since_last_ra < 0) {
+ 		secs_since_last_ra = 0;
+-		flog(LOG_WARNING, "gettimeofday() went backwards!");
++		flog(LOG_WARNING, "clock_gettime(CLOCK_MONOTONIC) went backwards!");
+ 	}
+ 	iface->last_ra_time = time_now;
+ 
+diff --git a/timer.c b/timer.c
+index ede0c36de499..622034290601 100644
+--- a/timer.c
++++ b/timer.c
+@@ -16,29 +16,32 @@
+ #include "config.h"
+ #include "radvd.h"
+ 
+-struct timeval next_timeval(double next)
++struct timespec next_timespec(double next)
+ {
+-	struct timeval tv;
+-	gettimeofday(&tv, NULL);
+-	tv.tv_sec += (int)next;
+-	tv.tv_usec += 1000000 * (next - (int)next);
+-	return tv;
++	struct timespec ts;
++
++	clock_gettime(CLOCK_MONOTONIC, &ts);
++	ts.tv_sec += (int)next;
++	ts.tv_nsec += 1000000000ULL * (next - (int)next);
++	return ts;
+ }
+ 
+-int timevaldiff(struct timeval const *a, struct timeval const *b)
++int64_t timespecdiff(struct timespec const *a, struct timespec const *b)
+ {
+-	int msec;
+-	msec = (a->tv_sec - b->tv_sec) * 1000;
+-	msec += (a->tv_usec - b->tv_usec) / 1000;
++	int64_t msec;
++	msec = ((int64_t)a->tv_sec - b->tv_sec) * 1000;
++	msec += ((int64_t)a->tv_nsec - b->tv_nsec) / (1000 * 1000);
+ 	return msec;
+ }
+ 
+ /* Returns when the next time should expire in milliseconds. */
+-int next_time_msec(struct Interface const *iface)
++uint64_t next_time_msec(struct Interface const *iface)
+ {
+-	struct timeval tv;
+-	int retval;
+-	gettimeofday(&tv, NULL);
+-	retval = timevaldiff(&iface->next_multicast, &tv);
+-	return retval >= 1 ? retval : 1;
++	struct timespec ts;
++	int64_t diff_ms;
++	clock_gettime(CLOCK_MONOTONIC, &ts);
++	diff_ms = timespecdiff(&iface->next_multicast, &ts);
++	if (diff_ms <= 0)
++		return 0;
++	return (uint64_t)diff_ms;
+ }
diff --git a/patches/radvd-1.12/series b/patches/radvd-1.12/series
new file mode 100644
index 000000000000..06b25c75bb01
--- /dev/null
+++ b/patches/radvd-1.12/series
@@ -0,0 +1,4 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-time-Use-clock_gettime-and-monotonic-clock.patch
+# 7520c46047013d8255e352f310f0e087  - git-ptx-patches magic
diff --git a/rules/radvd.in b/rules/radvd.in
new file mode 100644
index 000000000000..0150cae6ea53
--- /dev/null
+++ b/rules/radvd.in
@@ -0,0 +1,22 @@
+## SECTION=networking
+
+menuconfig RADVD
+	bool
+	prompt "radvd                         "
+	select LIBDAEMON
+	help
+	  Router Advertisement Daemon
+
+if RADVD
+
+config RADVD_SYSTEMD_SERVICE
+	bool "install systemd service file for radvd"
+	default y
+
+config RADVD_SYSTEMD_SERVICE_ENABLE
+	bool "enable radvd systemd service"
+	depends on RADVD_SYSTEMD_SERVICE
+	default n
+
+endif
+
diff --git a/rules/radvd.make b/rules/radvd.make
new file mode 100644
index 000000000000..6d2459cc8a1d
--- /dev/null
+++ b/rules/radvd.make
@@ -0,0 +1,60 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Markus Pargmann <mpa@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_RADVD) += radvd
+
+#
+# Paths and names
+#
+RADVD_VERSION	:= 1.12
+RADVD		:= radvd-$(RADVD_VERSION)
+RADVD_SUFFIX	:= tar.xz
+RADVD_MD5	:= baddc38a5f26ca46a9ce7e778b59c1ae
+RADVD_URL	:= http://www.litech.org/radvd/dist/$(RADVD).$(RADVD_SUFFIX)
+RADVD_DIR	:= $(BUILDDIR)/$(RADVD)
+RADVD_SOURCE	:= $(SRCDIR)/$(RADVD).$(RADVD_SUFFIX)
+RADVD_LICENSE	:= BSD
+
+#
+# autoconf
+#
+RADVD_CONF_TOOL	:= autoconf
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/radvd.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, radvd)
+	@$(call install_fixup, radvd, PRIORITY, optional)
+	@$(call install_fixup, radvd, SECTION, base)
+	@$(call install_fixup, radvd, AUTHOR, "Markus Pargmann <mpa@pengutronix.de>")
+	@$(call install_fixup, radvd, DESCRIPTION, missing)
+
+	@$(call install_copy, radvd, 0, 0, 0755, -, /usr/sbin/radvd)
+	@$(call install_alternative, radvd, 0, 0, 0644, /etc/radvd.conf)
+
+ifdef PTXCONF_RADVD_SYSTEMD_SERVICE
+	@$(call install_alternative, radvd, 0, 0, 0644, /lib/systemd/system/radvd.service)
+ifdef PTXCONF_RADVD_SYSTEMD_SERVICE_ENABLE
+	@$(call install_link, radvd, ../radvd.service, /lib/systemd/system/network.target.wants/radvd.service)
+endif
+endif
+
+	@$(call install_finish, radvd)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.0.0


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ptxdist] [PATCH v3 2/3] alfred: Initial commit
  2014-06-20 10:49 [ptxdist] [PATCH v3 1/3] radvd: Initial commit Markus Pargmann
@ 2014-06-20 10:49 ` Markus Pargmann
  2014-06-20 10:49 ` [ptxdist] [PATCH v3 3/3] collectd: " Markus Pargmann
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Pargmann @ 2014-06-20 10:49 UTC (permalink / raw)
  To: ptxdist; +Cc: Markus Pargmann

Add A.L.F.R.E.D. daemon to ptxdist. It is used to distribute data
between nodes of batman mesh networks.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 generic/lib/systemd/system/alfred@.service     |  8 +++
 generic/lib/systemd/system/batadv-vis@.service |  9 ++++
 rules/alfred.in                                | 24 +++++++++
 rules/alfred.make                              | 68 ++++++++++++++++++++++++++
 4 files changed, 109 insertions(+)
 create mode 100644 generic/lib/systemd/system/alfred@.service
 create mode 100644 generic/lib/systemd/system/batadv-vis@.service
 create mode 100644 rules/alfred.in
 create mode 100644 rules/alfred.make

diff --git a/generic/lib/systemd/system/alfred@.service b/generic/lib/systemd/system/alfred@.service
new file mode 100644
index 000000000000..08e014c417a2
--- /dev/null
+++ b/generic/lib/systemd/system/alfred@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description = A.L.F.R.E.D. server on interface %i
+BindsTo = sys-subsystem-net-devices-%i.device
+After = sys-subsystem-net-devices-%i.device
+
+[Service]
+ExecStart=/usr/bin/alfred -i %i
+
diff --git a/generic/lib/systemd/system/batadv-vis@.service b/generic/lib/systemd/system/batadv-vis@.service
new file mode 100644
index 000000000000..39b4b6f34710
--- /dev/null
+++ b/generic/lib/systemd/system/batadv-vis@.service
@@ -0,0 +1,9 @@
+[Unit]
+Description = batman-adv visualisation service on interface %i
+BindsTo = sys-subsystem-net-devices-%i.device
+After = sys-subsystem-net-devices-%i.device alfred@.service
+Requires = alfred@.service
+
+[Service]
+ExecStart=/usr/bin/batadv-vis -s -i %i
+
diff --git a/rules/alfred.in b/rules/alfred.in
new file mode 100644
index 000000000000..d75af49d43df
--- /dev/null
+++ b/rules/alfred.in
@@ -0,0 +1,24 @@
+## SECTION=networking
+
+menuconfig ALFRED
+	tristate
+	prompt "A.L.F.R.E.D.                  "
+	help
+	  Alfred is a distributed data distribution service which is used for
+	  batman mesh networks.
+
+if ALFRED
+
+config ALFRED_SYSTEMD_SERVICE
+	bool "install alfred and batadv-vis systemd service files"
+	default y
+
+config ALFRED_SYSTEMD_SERVICE_ALFRED_INTF
+	string "Enable alfred systemd service file for this interface"
+	depends on ALFRED_SYSTEMD_SERVICE
+
+config ALFRED_SYSTEMD_SERVICE_BATADVVIS_INTF
+	string "Enable batadv-vis systemd service file for this interface"
+	depends on ALFRED_SYSTEMD_SERVICE
+
+endif
diff --git a/rules/alfred.make b/rules/alfred.make
new file mode 100644
index 000000000000..9b74dfcd27de
--- /dev/null
+++ b/rules/alfred.make
@@ -0,0 +1,68 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Markus Pargmann <mpa@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_ALFRED) += alfred
+
+#
+# Paths and names
+#
+ALFRED_VERSION	:= 2014.1.0
+ALFRED_MD5	:= aaee0fbbc3aa011ba9c0a1d3f3b2801e
+ALFRED		:= alfred-$(ALFRED_VERSION)
+ALFRED_SUFFIX	:= tar.gz
+ALFRED_URL	:= http://downloads.open-mesh.org/batman/stable/sources/alfred/$(ALFRED).$(ALFRED_SUFFIX)
+ALFRED_SOURCE	:= $(SRCDIR)/$(ALFRED).$(ALFRED_SUFFIX)
+ALFRED_DIR	:= $(BUILDDIR)/$(ALFRED)
+ALFRED_LICENSE	:= unknown
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+ALFRED_CONF_TOOL	:= NO
+ALFRED_MAKE_ENV	:= $(CROSS_ENV) CONFIG_ALFRED_GPSD=n
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/alfred.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, alfred)
+	@$(call install_fixup, alfred,PRIORITY,optional)
+	@$(call install_fixup, alfred,SECTION,base)
+	@$(call install_fixup, alfred,AUTHOR,"Markus Pargmann <mpa@pengutronix.de>")
+	@$(call install_fixup, alfred,DESCRIPTION,missing)
+
+	@$(call install_copy, alfred, 0, 0, 0755, $(ALFRED_DIR)/alfred, /usr/bin/alfred)
+	@$(call install_copy, alfred, 0, 0, 0755, $(ALFRED_DIR)/vis/batadv-vis, /usr/bin/batadv-vis)
+
+ifdef PTXCONF_ALFRED_SYSTEMD_SERVICE
+	@$(call install_alternative, alfred, 0, 0, 0644, /lib/systemd/system/alfred@.service)
+	@$(call install_alternative, alfred, 0, 0, 0644, /lib/systemd/system/batadv-vis@.service)
+ifneq ($(PTXCONF_ALFRED_SYSTEMD_SERVICE_ALFRED_INTF),"")
+	@$(call install_link, alfred, ../alfred@.service, \
+	/lib/systemd/system/multi-user.target.wants/alfred@$(PTXCONF_ALFRED_SYSTEMD_SERVICE_ALFRED_INTF).service)
+endif
+ifneq ($(PTXCONF_ALFRED_SYSTEMD_SERVICE_BATADVVIS_INTF),"")
+	@$(call install_link, alfred, ../batadv-vis@.service, \
+	/lib/systemd/system/multi-user.target.wants/batadv-vis@$(PTXCONF_ALFRED_SYSTEMD_SERVICE_BATADVVIS_INTF).service)
+endif
+endif
+
+	@$(call install_finish, alfred)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.0.0


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ptxdist] [PATCH v3 3/3] collectd: Initial commit
  2014-06-20 10:49 [ptxdist] [PATCH v3 1/3] radvd: Initial commit Markus Pargmann
  2014-06-20 10:49 ` [ptxdist] [PATCH v3 2/3] alfred: " Markus Pargmann
@ 2014-06-20 10:49 ` Markus Pargmann
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Pargmann @ 2014-06-20 10:49 UTC (permalink / raw)
  To: ptxdist; +Cc: Markus Pargmann

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 generic/lib/systemd/system/collectd.service |  10 +++
 rules/collectd.in                           |  24 +++++++
 rules/collectd.make                         | 107 ++++++++++++++++++++++++++++
 3 files changed, 141 insertions(+)
 create mode 100644 generic/lib/systemd/system/collectd.service
 create mode 100644 rules/collectd.in
 create mode 100644 rules/collectd.make

diff --git a/generic/lib/systemd/system/collectd.service b/generic/lib/systemd/system/collectd.service
new file mode 100644
index 000000000000..e8100dff37f1
--- /dev/null
+++ b/generic/lib/systemd/system/collectd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=statistics collection daemon
+Documentation=man:collectd(1)
+After=local-fs.target network.target
+Requires=local-fs.target network.target
+
+[Service]
+ExecStart=/usr/sbin/collectd -C /etc/collectd.conf -f
+StandardOutput=syslog
+StandardError=syslog
diff --git a/rules/collectd.in b/rules/collectd.in
new file mode 100644
index 000000000000..a2fec6fcd45a
--- /dev/null
+++ b/rules/collectd.in
@@ -0,0 +1,24 @@
+## SECTION=test_suites
+
+menuconfig COLLECTD
+	tristate
+	select LIBMNL
+	select RRDTOOL
+	select RRDTOOL_RRDCACHED
+	select LIBOPING
+	prompt "collectd                      "
+	help
+	  collectd is a system monitor that records different system statistics
+	  and writes it to rrdtool.
+
+if COLLECTD
+
+config COLLECTD_SYSTEMD_SERVICE
+	bool "install systemd service file for collectd"
+	default y
+
+config COLLECTD_SYSTEMD_SERVICE_ENABLE
+	bool "enable collectd systemd service"
+	default n
+
+endif
diff --git a/rules/collectd.make b/rules/collectd.make
new file mode 100644
index 000000000000..351044747a71
--- /dev/null
+++ b/rules/collectd.make
@@ -0,0 +1,107 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2014 by Markus Pargmann <mpa@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_COLLECTD) += collectd
+
+#
+# Paths and names
+#
+COLLECTD_VERSION	:= 5.4.1
+COLLECTD		:= collectd-$(COLLECTD_VERSION)
+COLLECTD_SUFFIX		:= tar.bz2
+COLLECTD_URL		:= http://collectd.org/files/${COLLECTD}.${COLLECTD_SUFFIX}
+COLLECTD_MD5		:= 6f56c71c96573a7f4f7fb3bfab185974
+COLLECTD_DIR		:= $(BUILDDIR)/$(COLLECTD)
+COLLECTD_SOURCE		:= $(SRCDIR)/$(COLLECTD).$(COLLECTD_SUFFIX)
+COLLECTD_LICENSE	:= GPL2
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+#COLLECTD_CONF_ENV	:= $(CROSS_ENV)
+
+#
+# autoconf
+#
+COLLECTD_CONF_TOOL	:= autoconf
+COLLECTD_CONF_OPT	:= $(CROSS_AUTOCONF_USR) \
+	--with-nan-emulation \
+	--with-fp-layout=nothing \
+	--without-java \
+	--disable-all-plugins \
+	--enable-contextswitch \
+	--enable-cpu \
+	--enable-cpufreq \
+	--enable-disk \
+	--enable-ethstat \
+	--enable-exec \
+	--enable-interface \
+	--enable-irq \
+	--enable-load \
+	--enable-logfile \
+	--enable-netlink \
+	--enable-network \
+	--enable-processes \
+	--enable-protocols \
+	--enable-rrdtool \
+	--enable-table \
+	--enable-uptime \
+	--enable-wireless \
+	--enable-ping
+
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/collectd.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, collectd)
+	@$(call install_fixup, collectd, PRIORITY, optional)
+	@$(call install_fixup, collectd, SECTION, base)
+	@$(call install_fixup, collectd, AUTHOR, "Markus Pargmann <mpa@pengutronix.de>")
+	@$(call install_fixup, collectd, DESCRIPTION, missing)
+
+
+	@for i in $(shell cd $(COLLECTD_PKGDIR) && find bin sbin usr/bin usr/sbin -type f); do \
+		$(call install_copy, collectd, 0, 0, 0755, -, /$$i); \
+	done
+	@for i in $(shell cd $(COLLECTD_PKGDIR) && find lib usr/lib -name "*.so*"); do \
+		$(call install_copy, collectd, 0, 0, 0644, -, /$$i); \
+	done
+	@links="$(shell cd $(COLLECTD_PKGDIR) && find lib usr/lib -type l)"; \
+	if [ -n "$$links" ]; then \
+		for i in $$links; do \
+			from="`readlink $(COLLECTD_PKGDIR)/$$i`"; \
+			to="/$$i"; \
+			$(call install_link, collectd, $$from, $$to); \
+		done; \
+	fi
+
+	@$(call install_alternative, collectd, 0, 0, 0644, /etc/collectd.conf)
+
+	@$(call install_alternative, collectd, 0, 0, 0644, /usr/share/collectd/types.db)
+ifdef PTXCONF_COLLECTD_SYSTEMD_SERVICE
+	@$(call install_alternative, collectd, 0, 0, 0644, /lib/systemd/system/collectd.service)
+ifdef PTXCONF_COLLECTD_SYSTEMD_SERVICE_ENABLE
+	@$(call install_link, collectd, ../collectd.service, /lib/systemd/system/multi-user.target.wants/collectd.service)
+endif
+endif
+
+	@$(call install_finish, collectd)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.0.0


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-20 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-20 10:49 [ptxdist] [PATCH v3 1/3] radvd: Initial commit Markus Pargmann
2014-06-20 10:49 ` [ptxdist] [PATCH v3 2/3] alfred: " Markus Pargmann
2014-06-20 10:49 ` [ptxdist] [PATCH v3 3/3] collectd: " Markus Pargmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox