summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/collectd/Makefile13
-rwxr-xr-xsrc/collectd/include_config.sh9
2 files changed, 14 insertions, 8 deletions
diff --git a/src/collectd/Makefile b/src/collectd/Makefile
index a17d1571..6fdd4638 100644
--- a/src/collectd/Makefile
+++ b/src/collectd/Makefile
@@ -24,7 +24,6 @@ include ../mk/master.mk
include ../package-list.mk
WORK_DIR = collectd
-SAMPLE_CONFIG = $(CURDIR)/collectd_sample_configs
TAG_DONE_FLAG = $(WORK_DIR)/.$(COLLECTD_TAG).done
BUILD_CMD = ./build.sh
CONFIG_CMD =
@@ -50,14 +49,12 @@ CONFIG_CMD += --enable-threshold
#force_install: force_make
all: force_make
- @echo "Finished making $(WORK_DIR) "
+ @echo "Finished making $(WORK_DIR)"
config $(WORK_DIR)/Makefile: $(WORK_DIR)/configure
$(AT)cd $(WORK_DIR); $(CONFIG_CMD)
@echo "Configure done"
-INSTALL_TARGET = force_install force_make
-
force_make: $(WORK_DIR)/Makefile
$(AT)cd $(WORK_DIR) && git pull $(COLLECTD_URL) $(COLLECTD_TAG)
@echo "git pull done"
@@ -72,11 +69,11 @@ force_install:
$(AT)sed -i -e 's/ExecStart=\/usr\/sbin\/collectd/ExecStart=\/opt\/collectd\/sbin\/collectd/g' /etc/systemd/system/collectd.service
$(AT)sed -i -e 's/CapabilityBoundingSet=/CapabilityBoundingSet=CAP_SETUID CAP_SETGID/g' /etc/systemd/system/collectd.service
$(AT)systemctl daemon-reload
- $(AT)sudo mkdir -p /opt/collectd/etc/collectd.conf.d
- $(AT)sudo cp $(SAMPLE_CONFIG)/* /opt/collectd/etc/collectd.conf.d
$(AT)sudo ./include_config.sh
+ @echo "Make install done"
+
+install: force_install
-install: $(INSTALL_TARGET)
# hard way to clean and clobber
clean:
@@ -108,7 +105,7 @@ $(WORK_DIR):
$(AT)git clone $(COLLECTD_URL)
$(TAG_DONE_FLAG): $(WORK_DIR)
- $(AT)cd $(WORK_DIR); git checkout $(COLLECTD_TAG)
+ $(AT)cd collectd; git checkout $(COLLECTD_TAG)
ifneq ($(PATCH_FILE),)
$(AT)cd $(WORK_DIR); patch -p1 < ../$(PATCH_FILE)
endif
diff --git a/src/collectd/include_config.sh b/src/collectd/include_config.sh
index 95b052f3..1996e96b 100755
--- a/src/collectd/include_config.sh
+++ b/src/collectd/include_config.sh
@@ -1,6 +1,9 @@
#!/bin/bash
COLLECTD_CONF_FILE=/opt/collectd/etc/collectd.conf
+COLLECTD_CONF_DIR=/opt/collectd/etc/collectd.conf.d
INCLUDE_CONF="<Include \"/opt/collectd/etc/collectd.conf.d\">"
+CURR_DIR=`pwd`
+SAMPLE_CONF_DIR=$CURR_DIR/collectd_sample_configs/*
function write_include {
echo $INCLUDE_CONF | sudo tee -a $COLLECTD_CONF_FILE;
@@ -10,3 +13,9 @@ function write_include {
grep -qe '<Include "/opt/collectd/etc/collectd.conf.d">' $COLLECTD_CONF_FILE; [ $? -ne 0 ] && write_include
+`mkdir -p $COLLECTD_CONF_DIR`
+
+for F in $SAMPLE_CONF_DIR; do
+ FILE=$(basename $F)
+ [ -f $COLLECTD_CONF_DIR/$FILE ] && echo "File $COLLECTD_CONF_DIR/$FILE exists" || cp $F $COLLECTD_CONF_DIR
+done