commit 39fde5634d7ad4a0b813312b44a61f92dd5aad81
parent e333d67610d9e3bf6af99d71e0e0d8da67e7bb61
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Fri, 29 Jun 2018 00:45:01 +0000
Implement .in-files with m4-preprocessor
Diffstat:
5 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/Makefile b/Makefile
@@ -17,15 +17,19 @@ src/laundryclustery: src/laundryclustery.d
src/laundrysorcery: src/laundrysorcery.c
$(CC) $(CFLAGS) -lwiringPi -o $@ $^ -lm -lrrd
+%:%.in
+ m4 -D DESTDIR=$(DESTDIR) -D WWWDIR=$(WWWDIR) $^ > $@
+
%.rrd:
rrdtool create $@ --step 1s $(foreach ds,$(DATASOURCES),DS:$(ds):GAUGE:10:U:U) RRA:AVERAGE:0.5:900:96 RRA:AVERAGE:0.5:60:60 RRA:AVERAGE:0.5:1:300
plot.png:
rrdtool graph -s -300s $@ DEF:mylight=database.rrd:light:AVERAGE:step=1 LINE2:mylight#ff0000
-install: src/laundrysorcery $(WWWDIR)/database.rrd
+install: src/laundrysorcery src/laundryclustery dist/systemd/LaundrySorcery.service dist/cron_daily/laundrysorcery_cluster.sh
install -s -m 755 src/laundrysorcery $(DESTDIR)/bin/laundrysorcery
install -s -m 755 src/clustering $(DESTDIR)/bin/laundryclustery
install -m 600 dist/systemd/LaundrySorcery.service /usr/lib/systemd/system/LaundrySorcery.service
+ install -m 700 dist/cron_daily/laundrysorcery_cluster.sh /etc/cron.daily/laundrysorcery_cluster.sh
install -m 755 $(wildcard www/index.sh www/light_*.sh www/print_delta_t.sh) -t $(WWWDIR)
install -m 644 www/generate_image.sh www/delta_t.sh -t $(WWWDIR)
diff --git a/dist/cron.daily/laundrysorcery_cluster.sh b/dist/cron.daily/laundrysorcery_cluster.sh
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-LOG_FILE="/var/log/laundrysorcery.log"
-CLUSTER_FILE="/var/www/clusters"
-
-sed '1d;$!b;/ /!d' "${LOG_FILE}" | /usr/local/bin/laundryclustery - > "${CLUSTER_FILE}"
diff --git a/dist/cron_daily/laundrysorcery_cluster.sh.in b/dist/cron_daily/laundrysorcery_cluster.sh.in
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+LOG_FILE="/var/log/laundrysorcery.log"
+CLUSTER_FILE="WWWDIR/clusters"
+
+sed '1d;$!b;/ /!d' "${LOG_FILE}" | /usr/local/bin/laundryclustery - > "${CLUSTER_FILE}"
diff --git a/dist/systemd/LaundrySorcery.service b/dist/systemd/LaundrySorcery.service
@@ -1,10 +0,0 @@
-[Unit]
-Description=Light sensory application for the laundry machine
-
-[Service]
-ExecStart=/usr/local/bin/laundrysorcery on_file
-WorkingDirectory=/var/www
-Restart=always
-
-[Install]
-WantedBy=multi-user.target
diff --git a/dist/systemd/LaundrySorcery.service.in b/dist/systemd/LaundrySorcery.service.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=Light sensory application for the laundry machine
+
+[Service]
+ExecStart=DESTDIR/bin/laundrysorcery on_file
+WorkingDirectory=WWWDIR
+Restart=always
+
+[Install]
+WantedBy=multi-user.target