diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2013-04-22 16:28:16 +0000 |
|---|---|---|
| committer | Martin Jansa <Martin.Jansa@gmail.com> | 2013-04-26 10:00:32 +0200 |
| commit | 2fc71a181eeea1ef393ad1ca7bde0a5f5de5c5ad (patch) | |
| tree | 18eec77a319ca57d26ed75dfbe1afc7429edae8a | |
| parent | 9e7327e446d16a8bd70f93d5d68cdf267e3d2106 (diff) | |
| download | meta-openembedded-2fc71a181eeea1ef393ad1ca7bde0a5f5de5c5ad.tar.gz | |
collectd: add recipe for 5.2.2
Based on initial version by Koen Kooi <koen@beagleboard.org>. Initscript
borrowed from Debian with some tweaks.
Note that since collectd uses libltdl, building this successfully
required OE-Core commit db84eaf851b22b262d9dc48eb55bd5224a00fdd2 or else
you get an error about "config/compile" being missing.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
4 files changed, 307 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/collectd/collectd/collectd-version.patch b/meta-oe/recipes-extended/collectd/collectd/collectd-version.patch new file mode 100644 index 0000000000..1e2b7c159c --- /dev/null +++ b/meta-oe/recipes-extended/collectd/collectd/collectd-version.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | Don't pick up version string from parent git repository | ||
| 2 | |||
| 3 | If the collectd source is extracted from a tarball underneath a | ||
| 4 | directory structure that includes another git repository, that | ||
| 5 | repository will be picked up by "git describe" which is not | ||
| 6 | desirable. Check whether collectd itself is a git repository and just | ||
| 7 | use the default version if not. | ||
| 8 | |||
| 9 | Upstream-Status: Pending | ||
| 10 | |||
| 11 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
| 12 | |||
| 13 | diff --git a/version-gen.sh b/version-gen.sh | ||
| 14 | index e344541..d1c0929 100755 | ||
| 15 | --- a/version-gen.sh | ||
| 16 | +++ b/version-gen.sh | ||
| 17 | @@ -2,7 +2,10 @@ | ||
| 18 | |||
| 19 | DEFAULT_VERSION="5.2.2.git" | ||
| 20 | |||
| 21 | -VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`" | ||
| 22 | +VERSION="" | ||
| 23 | +if test -d .git ; then | ||
| 24 | + VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`" | ||
| 25 | +fi | ||
| 26 | |||
| 27 | if test -z "$VERSION"; then | ||
| 28 | VERSION="$DEFAULT_VERSION" | ||
| 29 | -- | ||
| 30 | 1.7.10.4 | ||
| 31 | |||
diff --git a/meta-oe/recipes-extended/collectd/collectd/collectd.init b/meta-oe/recipes-extended/collectd/collectd/collectd.init new file mode 100644 index 0000000000..abdb194a35 --- /dev/null +++ b/meta-oe/recipes-extended/collectd/collectd/collectd.init | |||
| @@ -0,0 +1,201 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # collectd - start and stop the statistics collection daemon | ||
| 4 | # http://collectd.org/ | ||
| 5 | # | ||
| 6 | # Copyright (C) 2005-2006 Florian Forster <octo@verplant.org> | ||
| 7 | # Copyright (C) 2006-2009 Sebastian Harl <tokkee@debian.org> | ||
| 8 | # | ||
| 9 | |||
| 10 | ### BEGIN INIT INFO | ||
| 11 | # Provides: collectd | ||
| 12 | # Required-Start: $local_fs $remote_fs | ||
| 13 | # Required-Stop: $local_fs $remote_fs | ||
| 14 | # Should-Start: $network $named $syslog $time cpufrequtils | ||
| 15 | # Should-Stop: $network $named $syslog | ||
| 16 | # Default-Start: 2 3 4 5 | ||
| 17 | # Default-Stop: 0 1 6 | ||
| 18 | # Short-Description: manage the statistics collection daemon | ||
| 19 | # Description: collectd is the statistics collection daemon. | ||
| 20 | # It is a small daemon which collects system information | ||
| 21 | # periodically and provides mechanisms to monitor and store | ||
| 22 | # the values in a variety of ways. | ||
| 23 | ### END INIT INFO | ||
| 24 | |||
| 25 | . /etc/init.d/functions | ||
| 26 | |||
| 27 | export PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
| 28 | |||
| 29 | DISABLE=0 | ||
| 30 | |||
| 31 | NAME=collectd | ||
| 32 | DAEMON=/usr/sbin/collectd | ||
| 33 | |||
| 34 | CONFIGFILE=/etc/collectd.conf | ||
| 35 | PIDFILE=/var/run/collectd.pid | ||
| 36 | |||
| 37 | USE_COLLECTDMON=1 | ||
| 38 | COLLECTDMON_DAEMON=/usr/sbin/collectdmon | ||
| 39 | COLLECTDMON_PIDFILE=/var/run/collectdmon.pid | ||
| 40 | |||
| 41 | MAXWAIT=30 | ||
| 42 | |||
| 43 | # Gracefully exit if the package has been removed. | ||
| 44 | test -x $DAEMON || exit 0 | ||
| 45 | |||
| 46 | if [ -r /etc/default/$NAME ]; then | ||
| 47 | . /etc/default/$NAME | ||
| 48 | fi | ||
| 49 | |||
| 50 | if test "$ENABLE_COREFILES" == 1; then | ||
| 51 | ulimit -c unlimited | ||
| 52 | fi | ||
| 53 | |||
| 54 | if test "$USE_COLLECTDMON" == 1; then | ||
| 55 | _PIDFILE="$COLLECTDMON_PIDFILE" | ||
| 56 | else | ||
| 57 | _PIDFILE="$PIDFILE" | ||
| 58 | fi | ||
| 59 | |||
| 60 | # return: | ||
| 61 | # 0 if config is fine | ||
| 62 | # 1 if there is a syntax error | ||
| 63 | # 2 if there is no configuration | ||
| 64 | check_config() { | ||
| 65 | if test ! -e "$CONFIGFILE"; then | ||
| 66 | return 2 | ||
| 67 | fi | ||
| 68 | if ! $DAEMON -t -C "$CONFIGFILE"; then | ||
| 69 | return 1 | ||
| 70 | fi | ||
| 71 | return 0 | ||
| 72 | } | ||
| 73 | |||
| 74 | # return: | ||
| 75 | # 0 if the daemon has been started | ||
| 76 | # 1 if the daemon was already running | ||
| 77 | # 2 if the daemon could not be started | ||
| 78 | # 3 if the daemon was not supposed to be started | ||
| 79 | d_start() { | ||
| 80 | if test "$DISABLE" != 0; then | ||
| 81 | # we get here during restart | ||
| 82 | echo "disabled by /etc/default/$NAME" | ||
| 83 | return 3 | ||
| 84 | fi | ||
| 85 | |||
| 86 | if test ! -e "$CONFIGFILE"; then | ||
| 87 | # we get here during restart | ||
| 88 | echo "disabled, no configuration ($CONFIGFILE) found" | ||
| 89 | return 3 | ||
| 90 | fi | ||
| 91 | |||
| 92 | check_config | ||
| 93 | rc="$?" | ||
| 94 | if test "$rc" -ne 0; then | ||
| 95 | echo "not starting, configuration error" | ||
| 96 | return 2 | ||
| 97 | fi | ||
| 98 | |||
| 99 | if test "$USE_COLLECTDMON" == 1; then | ||
| 100 | start-stop-daemon --start --quiet --oknodo --pidfile "$_PIDFILE" \ | ||
| 101 | --exec $COLLECTDMON_DAEMON -- -P "$_PIDFILE" -- -C "$CONFIGFILE" \ | ||
| 102 | || return 2 | ||
| 103 | else | ||
| 104 | start-stop-daemon --start --quiet --oknodo --pidfile "$_PIDFILE" \ | ||
| 105 | --exec $DAEMON -- -C "$CONFIGFILE" -P "$_PIDFILE" \ | ||
| 106 | || return 2 | ||
| 107 | fi | ||
| 108 | return 0 | ||
| 109 | } | ||
| 110 | |||
| 111 | still_running_warning=" | ||
| 112 | WARNING: $NAME might still be running. | ||
| 113 | In large setups it might take some time to write all pending data to | ||
| 114 | the disk. You can adjust the waiting time in /etc/default/collectd." | ||
| 115 | |||
| 116 | # return: | ||
| 117 | # 0 if the daemon has been stopped | ||
| 118 | # 1 if the daemon was already stopped | ||
| 119 | # 2 if daemon could not be stopped | ||
| 120 | d_stop() { | ||
| 121 | PID=$( cat "$_PIDFILE" 2> /dev/null ) || true | ||
| 122 | |||
| 123 | start-stop-daemon --stop --quiet --oknodo --pidfile "$_PIDFILE" | ||
| 124 | rc="$?" | ||
| 125 | |||
| 126 | if test "$rc" -eq 2; then | ||
| 127 | return 2 | ||
| 128 | fi | ||
| 129 | |||
| 130 | sleep 1 | ||
| 131 | if test -n "$PID" && kill -0 $PID 2> /dev/null; then | ||
| 132 | i=0 | ||
| 133 | while kill -0 $PID 2> /dev/null; do | ||
| 134 | i=$(( $i + 2 )) | ||
| 135 | echo -n " ." | ||
| 136 | |||
| 137 | if test $i -gt $MAXWAIT; then | ||
| 138 | echo "$still_running_warning" | ||
| 139 | return 2 | ||
| 140 | fi | ||
| 141 | |||
| 142 | sleep 2 | ||
| 143 | done | ||
| 144 | return "$rc" | ||
| 145 | fi | ||
| 146 | return "$rc" | ||
| 147 | } | ||
| 148 | |||
| 149 | case "$1" in | ||
| 150 | start) | ||
| 151 | echo -n "Starting $NAME" | ||
| 152 | d_start | ||
| 153 | case "$?" in | ||
| 154 | 0|1) echo "." ;; | ||
| 155 | *) exit 1 ;; | ||
| 156 | esac | ||
| 157 | ;; | ||
| 158 | stop) | ||
| 159 | echo -n "Stopping $NAME" | ||
| 160 | d_stop | ||
| 161 | case "$?" in | ||
| 162 | 0|1) echo "." ;; | ||
| 163 | *) exit 1 ;; | ||
| 164 | esac | ||
| 165 | ;; | ||
| 166 | status) | ||
| 167 | status_of_proc -p "$_PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $? | ||
| 168 | ;; | ||
| 169 | restart|force-reload) | ||
| 170 | echo -n "Restarting $NAME" | ||
| 171 | check_config | ||
| 172 | rc="$?" | ||
| 173 | if test "$rc" -eq 1; then | ||
| 174 | echo "not restarting, configuration error" | ||
| 175 | exit 1 | ||
| 176 | fi | ||
| 177 | d_stop | ||
| 178 | rc="$?" | ||
| 179 | case "$rc" in | ||
| 180 | 0|1) | ||
| 181 | sleep 1 | ||
| 182 | d_start | ||
| 183 | rc2="$?" | ||
| 184 | case "$rc2" in | ||
| 185 | 0|1) echo "." ;; | ||
| 186 | *) exit 1 ;; | ||
| 187 | esac | ||
| 188 | ;; | ||
| 189 | *) | ||
| 190 | exit 1 | ||
| 191 | ;; | ||
| 192 | esac | ||
| 193 | ;; | ||
| 194 | *) | ||
| 195 | echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 | ||
| 196 | exit 3 | ||
| 197 | ;; | ||
| 198 | esac | ||
| 199 | |||
| 200 | # vim: syntax=sh noexpandtab sw=4 ts=4 : | ||
| 201 | |||
diff --git a/meta-oe/recipes-extended/collectd/collectd/no-gcrypt-badpath.patch b/meta-oe/recipes-extended/collectd/collectd/no-gcrypt-badpath.patch new file mode 100644 index 0000000000..02b160109e --- /dev/null +++ b/meta-oe/recipes-extended/collectd/collectd/no-gcrypt-badpath.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | Disable defaulting of GCRYPT_LDFLAGS to -L/usr/lib | ||
| 2 | |||
| 3 | Prevents "unsafe for cross compilation" warnings that cause | ||
| 4 | do_qa_configure to fail. | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [configuration] | ||
| 7 | |||
| 8 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
| 9 | |||
| 10 | diff --git a/configure.in b/configure.in | ||
| 11 | index 98395ed..81c3a2c 100644 | ||
| 12 | --- a/configure.in | ||
| 13 | +++ b/configure.in | ||
| 14 | @@ -1777,11 +1777,11 @@ then | ||
| 15 | GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null` | ||
| 16 | fi | ||
| 17 | |||
| 18 | - if test "x$GCRYPT_LDFLAGS" = "x" | ||
| 19 | - then | ||
| 20 | - gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null` | ||
| 21 | - GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib" | ||
| 22 | - fi | ||
| 23 | +# if test "x$GCRYPT_LDFLAGS" = "x" | ||
| 24 | +# then | ||
| 25 | +# gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null` | ||
| 26 | +# GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib" | ||
| 27 | +# fi | ||
| 28 | |||
| 29 | if test "x$GCRYPT_LIBS" = "x" | ||
| 30 | then | ||
diff --git a/meta-oe/recipes-extended/collectd/collectd_5.2.2.bb b/meta-oe/recipes-extended/collectd/collectd_5.2.2.bb new file mode 100644 index 0000000000..a508840eff --- /dev/null +++ b/meta-oe/recipes-extended/collectd/collectd_5.2.2.bb | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | SUMMARY = "Collects and summarises system performance statistics" | ||
| 2 | DESCRIPTION = "collectd is a daemon which collects system performance statistics periodically and provides mechanisms to store the values in a variety of ways, for example in RRD files." | ||
| 3 | LICENSE = "GPLv2" | ||
| 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" | ||
| 5 | |||
| 6 | DEPENDS = "rrdtool curl mysql5 libpcap libxml2 yajl libgcrypt libtool" | ||
| 7 | |||
| 8 | SRC_URI = "http://collectd.org/files/collectd-${PV}.tar.bz2 \ | ||
| 9 | file://no-gcrypt-badpath.patch \ | ||
| 10 | file://collectd-version.patch \ | ||
| 11 | file://collectd.init" | ||
| 12 | |||
| 13 | SRC_URI[md5sum] = "29e61411e51845d5ae71ab676078867e" | ||
| 14 | SRC_URI[sha256sum] = "7b8906d1c8866155b31820ef108be92abcee7fcd278d386bf0d449e704ba4696" | ||
| 15 | |||
| 16 | inherit autotools pythonnative update-rc.d | ||
| 17 | |||
| 18 | # Floatingpoint layout, architecture dependent | ||
| 19 | # 'nothing', 'endianflip' or 'intswap' | ||
| 20 | FPLAYOUT ?= "--with-fp-layout=nothing" | ||
| 21 | |||
| 22 | PACKAGECONFIG ??= "" | ||
| 23 | PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp --with-libnetsnmp=no,net-snmp" | ||
| 24 | |||
| 25 | EXTRA_OECONF = " \ | ||
| 26 | ${FPLAYOUT} \ | ||
| 27 | --disable-perl --with-libperl=no --with-perl-bindings=no \ | ||
| 28 | --with-libgcrypt=${STAGING_BINDIR_CROSS}/libgcrypt-config \ | ||
| 29 | " | ||
| 30 | |||
| 31 | do_install_append() { | ||
| 32 | install -d ${D}${sysconfdir}/init.d | ||
| 33 | install -m 0755 ${WORKDIR}/collectd.init ${D}${sysconfdir}/init.d/collectd | ||
| 34 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/collectd | ||
| 35 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/collectd | ||
| 36 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/collectd | ||
| 37 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/collectd | ||
| 38 | |||
| 39 | # Fix configuration file to allow collectd to start up | ||
| 40 | sed -i 's!^#FQDNLookup[ \t]*true!FQDNLookup false!g' ${D}${sysconfdir}/collectd.conf | ||
| 41 | } | ||
| 42 | |||
| 43 | INITSCRIPT_NAME = "collectd" | ||
| 44 | INITSCRIPT_PARAMS = "defaults" | ||
| 45 | |||
