From d6231e568bf27b00617951ad20d1748ff816c3de Mon Sep 17 00:00:00 2001 From: Damian Wrobel Date: Mar 24 2020 18:51:10 +0000 Subject: Initial import (rhbz#1809263) --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2143a2b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/wmbusmeters-0.9.27.tar.gz diff --git a/sources b/sources new file mode 100644 index 0000000..8a70424 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (wmbusmeters-0.9.27.tar.gz) = 4c5845805c0ba3fefdc65c8aec8ca2433a9722c6e9d82b7bfad5e717309d4066a77402b3ada4242ec774edd25f11f348843c56c05737dac0bcea6d125c067eee diff --git a/wmbusmeters-Fix-accessing-empty-string.patch b/wmbusmeters-Fix-accessing-empty-string.patch new file mode 100644 index 0000000..fa6caf6 --- /dev/null +++ b/wmbusmeters-Fix-accessing-empty-string.patch @@ -0,0 +1,45 @@ +From d840804b31a632cf1e984d949897836a5395b031 Mon Sep 17 00:00:00 2001 +From: Damian Wrobel +Date: Mon, 2 Mar 2020 10:07:04 +0100 +Subject: [PATCH] Fix accessing empty string + +Fixes the following crash: + (gdb) bt + #0 0x00005555555738d0 in abort@plt () + #1 0x0000555555589888 in std::__replacement_assert (__file=, __line=, __function=, __condition=) at /usr/include/c++/9/x86_64-redhat-linux/bits/c++config.h:2533 + #2 0x00005555555d1e37 in std::__cxx11::basic_string, std::allocator >::front (this=0x7ffff7a226d0) at /usr/include/c++/9/bits/basic_string.h:1123 + #3 0x00005555555ce8c5 in doesIdMatchExpression (id=..., match=...) at src/util.cc:513 + #4 0x00005555555cea92 in doesIdMatchExpressions (id=..., mes=...) at src/util.cc:560 + #5 0x000055555558aa56 in MeterCommonImplementation::isTelegramForMe (this=0x555555661c28, t=0x7ffff7a227b0) at src/meters.cc:188 + #6 0x000055555558c0e0 in MeterCommonImplementation::handleTelegram (this=0x555555661c28, input_frame=...) at src/meters.cc:289 + #7 0x000055555558c87a in MeterCommonImplementation:: >)>::operator() (__closure=, input_frame=...) at /usr/include/c++/9/bits/stl_algobase.h:465 + #8 std::_Function_handler >), MeterCommonImplementation::MeterCommonImplementation(WMBus*, MeterInfo&, MeterType, int):: >)> >::_M_invoke(const std::_Any_data &, std::vector > &&) (__functor=..., __args#0=...) at /usr/include/c++/9/bits/std_function.h:285 + #9 0x00005555555da01f in std::function >)>::operator()(std::vector >) const (__args#0=..., this=0x7ffff7a22c70) at /usr/include/c++/9/bits/std_function.h:685 + #10 WMBusCommonImplementation::handleTelegram (this=this@entry=0x555555661b40, frame=...) at src/wmbus.cc:3328 + #11 0x00005555555fbf7b in WMBusRTLWMBUS::processSerialData (this=0x555555661ad0) at /usr/include/c++/9/bits/stl_algobase.h:465 + #12 0x00005555555cb001 in std::function::operator()() const (this=) at /usr/include/c++/9/bits/std_function.h:685 + #13 SerialCommunicationManagerImp::eventLoop (this=0x5555556617c0) at src/serial.cc:795 + #14 0x00007ffff7f554e2 in ?? () + #15 0x0000000000000000 in ?? () + +Signed-off-by: Damian Wrobel +--- + src/util.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/util.cc b/src/util.cc +index bcacb16..22f7b31 100644 +--- a/src/util.cc ++++ b/src/util.cc +@@ -510,7 +510,7 @@ bool doesIdMatchExpression(string id, string match) + } + + bool wildcard_used = false; +- if (match.front() == '*') ++ if (match.length() && match.front() == '*') + { + wildcard_used = true; + match.erase(0,1); +-- +2.24.1 + diff --git a/wmbusmeters-Fix-compilation-error-on-gcc-10.x.patch b/wmbusmeters-Fix-compilation-error-on-gcc-10.x.patch new file mode 100644 index 0000000..a9bd2a2 --- /dev/null +++ b/wmbusmeters-Fix-compilation-error-on-gcc-10.x.patch @@ -0,0 +1,66 @@ +From a8562de6c0a5d80332a83b92f88b48688beabd39 Mon Sep 17 00:00:00 2001 +From: Damian Wrobel +Date: Fri, 28 Feb 2020 18:20:22 +0100 +Subject: [PATCH] Fix compilation error on gcc 10.x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fixes the following compilation error: + + In file included from src/config.h:21, + from src/cmdline.h:21, + from src/cmdline.cc:18: + src/units.h:42:11: error: extended character ° is not valid in an identifier + 42 | X(C,c,°C,Temperature,"celsius") \ + | ^ + src/units.h:43:11: error: extended character ° is not valid in an identifier + 43 | X(F,f,°F,Temperature,"fahrenheit") \ + | ^ + make: *** [Makefile:93: build/cmdline.o] Error 1 + +Signed-off-by: Damian Wrobel +--- + src/units.h | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +diff --git a/src/units.h b/src/units.h +index a1c0384..ac0c7ce 100644 +--- a/src/units.h ++++ b/src/units.h +@@ -33,19 +33,19 @@ + X(Time,Hour) \ + + #define LIST_OF_UNITS \ +- X(KWH,kwh,kWh,Energy,"kilo Watt hour") \ +- X(GJ,gj,GJ,Energy,"Giga Joule") \ +- X(M3,m3,m3,Volume,"cubic meter") \ +- X(L,l,l,Volume,"litre") \ +- X(KW,kw,kW,Power,"kilo Watt") \ +- X(M3H,m3h,m3/h,Flow,"cubic meters per hour") \ +- X(C,c,°C,Temperature,"celsius") \ +- X(F,f,°F,Temperature,"fahrenheit") \ +- X(RH,rh,RH,RelativeHumidity,"relative humidity") \ +- X(HCA,hca,hca,HCA,"heat cost allocation") \ +- X(TXT,txt,txt,Text,"text") \ +- X(Second,s,s,Time,"second") \ +- X(Hour,h,h,Time,"hour") ++ X(KWH,kwh,"kWh",Energy,"kilo Watt hour") \ ++ X(GJ,gj,"GJ",Energy,"Giga Joule") \ ++ X(M3,m3,"m3",Volume,"cubic meter") \ ++ X(L,l,"l",Volume,"litre") \ ++ X(KW,kw,"kW",Power,"kilo Watt") \ ++ X(M3H,m3h,"m3/h",Flow,"cubic meters per hour") \ ++ X(C,c,"°C",Temperature,"celsius") \ ++ X(F,f,"°F",Temperature,"fahrenheit") \ ++ X(RH,rh,"RH",RelativeHumidity,"relative humidity") \ ++ X(HCA,hca,"hca",HCA,"heat cost allocation") \ ++ X(TXT,txt,"txt",Text,"text") \ ++ X(Second,s,"s",Time,"second") \ ++ X(Hour,h,"h",Time,"hour") + + enum class Unit + { +-- +2.24.1 + diff --git a/wmbusmeters-Make-easier-to-packaging-wmbumeters-for-linux.patch b/wmbusmeters-Make-easier-to-packaging-wmbumeters-for-linux.patch new file mode 100644 index 0000000..68d67e3 --- /dev/null +++ b/wmbusmeters-Make-easier-to-packaging-wmbumeters-for-linux.patch @@ -0,0 +1,203 @@ +From 7d74511dcb26381f5cab0b6c5be15cd6d4126b63 Mon Sep 17 00:00:00 2001 +From: Damian Wrobel +Date: Sun, 1 Mar 2020 20:41:19 +0100 +Subject: [PATCH] Make easier to packaging wmbumeters for linux + +Makefile: + - Allow to disable stripping of executables as this prevents from + properly creating debug information sub packages, + + - Don't invoke any git commands when building from released + tarball. Moreover, when creating an rpm package with additional + patches then the created git repository is the one in which rpm + applies patches and not the original one. + + - Allow to pass CXXFLAGS and LDFLAGS as distributions requires all + packages to be compiled with the same set of flags. + + - Support to override DESTDIR when installing files. + + - Allow to pass additional arguments (EXTRA_INSTALL_OPTION) + for install.sh script from Makefile. + +Signed-off-by: Damian Wrobel +--- + Makefile | 27 ++++++++++++++++----------- + install.sh | 30 +++++++++++++++--------------- + uninstall.sh | 6 +++--- + 3 files changed, 34 insertions(+), 29 deletions(-) + +diff --git a/Makefile b/Makefile +index 290e753..5f5671f 100644 +--- a/Makefile ++++ b/Makefile +@@ -20,14 +20,16 @@ + # make DEBUG=true + # make DEBUG=true HOST=arm + ++DESTDIR?=/ ++ + ifeq "$(HOST)" "arm" + CXX=arm-linux-gnueabihf-g++ +- STRIP=arm-linux-gnueabihf-strip ++ STRIP?=arm-linux-gnueabihf-strip + BUILD=build_arm + DEBARCH=armhf + else + CXX=g++ +- STRIP=strip ++ STRIP?=strip + #--strip-unneeded --remove-section=.comment --remove-section=.note + BUILD=build + DEBARCH=amd64 +@@ -47,10 +49,10 @@ endif + + $(shell mkdir -p $(BUILD)) + +-COMMIT_HASH:=$(shell git log --pretty=format:'%H' -n 1) +-TAG:=$(shell git describe --tags) +-CHANGES:=$(shell git status -s | grep -v '?? ') +-TAG_COMMIT_HASH:=$(shell git show-ref --tags | grep $(TAG) | cut -f 1 -d ' ') ++COMMIT_HASH?=$(shell git log --pretty=format:'%H' -n 1) ++TAG?=$(shell git describe --tags) ++CHANGES?=$(shell git status -s | grep -v '?? ') ++TAG_COMMIT_HASH?=$(shell git show-ref --tags | grep $(TAG) | cut -f 1 -d ' ') + + ifeq ($(COMMIT),$(TAG_COMMIT)) + # Exactly on the tagged commit. The version is the tag! +@@ -81,7 +83,10 @@ endif + + $(info Building $(VERSION)) + +-CXXFLAGS := $(DEBUG_FLAGS) -fPIC -fmessage-length=0 -std=c++11 -Wall -Wno-unused-function -I$(BUILD) ++CXXFLAGS ?= $(DEBUG_FLAGS) -fPIC -fmessage-length=0 -std=c++11 -Wall -Wno-unused-function ++CXXFLAGS += -I$(BUILD) ++ ++LDFLAGS ?= $(DEBUG_LDFLAGS) + + $(BUILD)/%.o: src/%.cc $(wildcard src/%.h) + $(CXX) $(CXXFLAGS) $< -c -E > $@.src +@@ -139,7 +144,7 @@ all: $(BUILD)/wmbusmeters $(BUILD)/testinternals + dist: wmbusmeters_$(DEBVERSION)_$(DEBARCH).deb + + install: $(BUILD)/wmbusmeters +- @./install.sh $(BUILD)/wmbusmeters / ++ @./install.sh $(BUILD)/wmbusmeters $(DESTDIR) $(EXTRA_INSTALL_OPTIONS) + + uninstall: + @./uninstall.sh / +@@ -162,7 +167,7 @@ wmbusmeters_$(DEBVERSION)_$(DEBARCH).deb: + $(BUILD)/main.o: $(BUILD)/short_manual.h + + $(BUILD)/wmbusmeters: $(METER_OBJS) $(BUILD)/main.o $(BUILD)/short_manual.h +- $(CXX) -o $(BUILD)/wmbusmeters $(METER_OBJS) $(BUILD)/main.o $(DEBUG_LDFLAGS) -lpthread ++ $(CXX) -o $(BUILD)/wmbusmeters $(METER_OBJS) $(BUILD)/main.o $(LDFLAGS) -lpthread + + $(BUILD)/short_manual.h: README.md + echo 'R"MANUAL(' > $(BUILD)/short_manual.h +@@ -172,10 +177,10 @@ $(BUILD)/short_manual.h: README.md + echo ')MANUAL";' >> $(BUILD)/short_manual.h + + $(BUILD)/testinternals: $(METER_OBJS) $(BUILD)/testinternals.o +- $(CXX) -o $(BUILD)/testinternals $(METER_OBJS) $(BUILD)/testinternals.o $(DEBUG_LDFLAGS) -lpthread ++ $(CXX) -o $(BUILD)/testinternals $(METER_OBJS) $(BUILD)/testinternals.o $(LDFLAGS) -lpthread + + $(BUILD)/fuzz: $(METER_OBJS) $(BUILD)/fuzz.o +- $(CXX) -o $(BUILD)/fuzz $(METER_OBJS) $(BUILD)/fuzz.o $(DEBUG_LDFLAGS) -lpthread ++ $(CXX) -o $(BUILD)/fuzz $(METER_OBJS) $(BUILD)/fuzz.o $(LDFLAGS) -lpthread + + clean: + rm -rf build/* build_arm/* build_debug/* build_arm_debug/* *~ +diff --git a/install.sh b/install.sh +index 2a1b12a..966f389 100755 +--- a/install.sh ++++ b/install.sh +@@ -205,34 +205,34 @@ fi + + #################################################################### + ## +-## Create /etc/systemd/system/wmbusmeters.service ++## Create /lib/systemd/system/wmbusmeters.service + ## + + SYSTEMD_NEEDS_RELOAD=false + +-if [ -f "$ROOT"/etc/systemd/system/wmbusmeters.service ] ++if [ -f "$ROOT"/lib/systemd/system/wmbusmeters.service ] + then +- echo systemd: removing "$ROOT"/etc/systemd/system/wmbusmeters.service ++ echo systemd: removing "$ROOT"/lib/systemd/system/wmbusmeters.service + echo systemd: backup stored here: ~/old.wmbusmeters.service.backup +- cp "$ROOT"/etc/systemd/system/wmbusmeters.service ~/old.wmbusmeters@.service.backup +- rm "$ROOT"/etc/systemd/system/wmbusmeters.service ++ cp "$ROOT"/lib/systemd/system/wmbusmeters.service ~/old.wmbusmeters@.service.backup ++ rm "$ROOT"/lib/systemd/system/wmbusmeters.service + SYSTEMD_NEEDS_RELOAD=true + fi + +-if [ -f "$ROOT"/etc/systemd/system/wmbusmeters@.service ] ++if [ -f "$ROOT"/lib/systemd/system/wmbusmeters@.service ] + then +- echo systemd: removing "$ROOT"/etc/systemd/system/wmbusmeters@.service ++ echo systemd: removing "$ROOT"/lib/systemd/system/wmbusmeters@.service + echo systemd: backup stored here: ~/old.wmbusmeters@.service.backup +- cp "$ROOT"/etc/systemd/system/wmbusmeters@.service ~/old.wmbusmeters@.service.backup +- rm "$ROOT"/etc/systemd/system/wmbusmeters@.service ++ cp "$ROOT"/lib/systemd/system/wmbusmeters@.service ~/old.wmbusmeters@.service.backup ++ rm "$ROOT"/lib/systemd/system/wmbusmeters@.service + SYSTEMD_NEEDS_RELOAD=true + fi + +-if [ ! -f "$ROOT"/etc/systemd/system/wmbusmeters@.service ] ++if [ ! -f "$ROOT"/lib/systemd/system/wmbusmeters@.service ] + then +- mkdir -p "$ROOT"/etc/systemd/system/ ++ mkdir -p "$ROOT"/lib/systemd/system/ + # Create service file +- cat < "$ROOT"/etc/systemd/system/wmbusmeters@.service ++ cat < "$ROOT"/lib/systemd/system/wmbusmeters@.service + [Unit] + Description="wmbusmeters service on %I" + After=network.target +@@ -265,9 +265,9 @@ PIDFile=/var/run/wmbusmeters/wmbusmeters-%i.pid + WantedBy=multi-user.target + EOF + +- echo systemd: installed "$ROOT"/etc/systemd/system/wmbusmeters@.service ++ echo systemd: installed "$ROOT"/lib/systemd/system/wmbusmeters@.service + else +- echo systemd: "$ROOT"/etc/systemd/system/wmbusmeters@.service unchanged ++ echo systemd: "$ROOT"/lib/systemd/system/wmbusmeters@.service unchanged + fi + + +@@ -308,7 +308,7 @@ fi + + if [ "$SYSTEMD_NEEDS_RELOAD" = "true" ] + then +- D=$(diff "$ROOT"/etc/systemd/system/wmbusmeters@.service ~/old.wmbusmeters@.service.backup) ++ D=$(diff "$ROOT"/lib/systemd/system/wmbusmeters@.service ~/old.wmbusmeters@.service.backup) + if [ "$D" != "" ] + then + echo +diff --git a/uninstall.sh b/uninstall.sh +index 5030027..4b62f93 100755 +--- a/uninstall.sh ++++ b/uninstall.sh +@@ -52,10 +52,10 @@ then + echo conf dir: removed "$ROOT"/etc/wmbusmeters.d + fi + +-if [ -f "$ROOT"/etc/systemd/system/wmbusmeters.service ] ++if [ -f "$ROOT"/lib/systemd/system/wmbusmeters.service ] + then +- rm "$ROOT"/etc/systemd/system/wmbusmeters.service +- echo systemd: removed "$ROOT"/etc/systemd/system/wmbusmeters.service ++ rm "$ROOT"/lib/systemd/system/wmbusmeters.service ++ echo systemd: removed "$ROOT"/lib/systemd/system/wmbusmeters.service + fi + + if [ -f "$ROOT"/etc/udev/rules.d/99-wmbus-usb-serial.rules ] +-- +2.24.1 + diff --git a/wmbusmeters-Make-wmbusmeters.d-directory-accessible-for-the-owne.patch b/wmbusmeters-Make-wmbusmeters.d-directory-accessible-for-the-owne.patch new file mode 100644 index 0000000..7dd069d --- /dev/null +++ b/wmbusmeters-Make-wmbusmeters.d-directory-accessible-for-the-owne.patch @@ -0,0 +1,26 @@ +From 21463d51e68c887ac5f78fa75229b1e72df8c8f6 Mon Sep 17 00:00:00 2001 +From: Damian Wrobel +Date: Tue, 3 Mar 2020 10:21:33 +0100 +Subject: [PATCH] Make wmbusmeters.d directory accessible for the owner + +Signed-off-by: Damian Wrobel +--- + install.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/install.sh b/install.sh +index 966f389..34929bb 100755 +--- a/install.sh ++++ b/install.sh +@@ -197,7 +197,7 @@ if [ ! -d "$ROOT"/etc/wmbusmeters.d ] + then + # Create the configuration directory + mkdir -p "$ROOT"/etc/wmbusmeters.d +- chmod -R 655 "$ROOT"/etc/wmbusmeters.d ++ chmod -R 755 "$ROOT"/etc/wmbusmeters.d + echo conf dir: created "$ROOT"/etc/wmbusmeters.d + else + echo conf dir: "$ROOT"/etc/wmbusmeters.d unchanged +-- +2.24.1 + diff --git a/wmbusmeters.conf b/wmbusmeters.conf new file mode 100644 index 0000000..940fe25 --- /dev/null +++ b/wmbusmeters.conf @@ -0,0 +1,4 @@ +loglevel=debug +device=auto +logtelegrams=true +format=json diff --git a/wmbusmeters.spec b/wmbusmeters.spec new file mode 100644 index 0000000..ed18608 --- /dev/null +++ b/wmbusmeters.spec @@ -0,0 +1,121 @@ +Name: wmbusmeters + +%global forgeurl https://github.com/weetmuts/%{name} +%global tag 0.9.27 +%global the_binary rtl_wmbus + +Version: %{tag} + +%forgemeta + +Release: 6%{?dist} +Summary: Read the wireless mbus protocol to acquire utility meter readings +License: GPLv3+ +Url: %{forgeurl} +Source0: %{forgesource} +# Default configuration file +# Stores all logs in journald +Source1: %{name}.conf +# Systemd service file +Source2: %{name}@.service +# Upstream reference: https://github.com/weetmuts/wmbusmeters/pull/87 +Patch0: %{name}-Make-easier-to-packaging-wmbumeters-for-linux.patch +# Fixes compilation error on gcc >= 10.x +# Upstream reference: https://github.com/weetmuts/wmbusmeters/pull/85 +Patch1: %{name}-Fix-compilation-error-on-gcc-10.x.patch +# Fixes crash +# Upstream reference: https://github.com/weetmuts/wmbusmeters/pull/86 +Patch2: %{name}-Fix-accessing-empty-string.patch +# Make wmbusmeters.d directory accessible for the owner +# Upstream reference: https://github.com/weetmuts/wmbusmeters/pull/88 +Patch3: %{name}-Make-wmbusmeters.d-directory-accessible-for-the-owne.patch + +BuildRequires: /usr/bin/git +BuildRequires: gcc-c++ +BuildRequires: systemd-rpm-macros + +Requires: /usr/bin/rtl_wmbus + + +%description +The program receives and decodes C1,T1 or S1 telegrams +(using the wireless mbus protocol) to acquire utility meter readings. +The readings can then be published using MQTT, curled to a REST api, +inserted into a database or stored in a log file. + + +%prep +%forgeautosetup -S git + + +%build +%set_build_flags +%{make_build} STRIP=true COMMIT_HASH="" TAG=%{version} COMMIT=%{version} \ + TAG_COMMIT=%{version} CHANGES="" + + +%install +%{make_install} STRIP=true COMMIT_HASH="" TAG=%{version} COMMIT=%{version} \ + TAG_COMMIT=%{version} CHANGES="" \ + DESTDIR=%{buildroot} EXTRA_INSTALL_OPTIONS="--no-adduser --no-udev-rules" + +# We are using journald +rm -rf %{buildroot}%{_sysconfdir}/logrotate.d/ + +# Create directory for storing pid files. +install -m 0755 -d %{buildroot}/%{_rundir}/%{name}/ + +# Fix systemd unit dir location +mv %{buildroot}/lib %{buildroot}/%{_prefix} + +# Install default configuration file +install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}.conf + +# Install systemd service file +install -p -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}@.service + + +%files +%license LICENSE +%doc README.md CHANGES HowToAddaNewMeter.txt +%dir %{_sysconfdir}/%{name}.d/ +%config(noreplace) %{_sysconfdir}/%{name}.conf +%{_sbindir}/wmbusmetersd +%{_bindir}/%{name} +%{_unitdir}/%{name}@.service +%{_mandir}/man1/%{name}* +%ghost %{_rundir}/%{name}/ + + +%post +%systemd_post %{name}@\*.service + +%preun +%systemd_preun %{name}@\*.service + +%postun +%systemd_postun_with_restart %{name}@\*.service + + +%changelog +* Mon Mar 23 2020 Damian Wrobel - 0.9.27-6 +- Remove -v from the forgemeta +- Remove instead of exclude logrotate.d directory +- Use %%{_prefix} instead of /usr +- Add %%systemd_{*} scriplets + +* Wed Mar 04 2020 Damian Wrobel - 0.9.27-5 +- Add creation of /run/wmbusmeters dir. to the service file. + +* Tue Mar 03 2020 Damian Wrobel - 0.9.27-4 +- Use %%set_build_flags + +* Tue Mar 03 2020 Damian Wrobel - 0.9.27-3 +- Fix wmbusmeters.d accessability +- Store all logs in journald + +* Mon Mar 02 2020 Damian Wrobel - 0.9.27-2 +- Add upstream reference to pathces. + +* Fri Feb 28 2020 Damian Wrobel - 0.9.27-1 +- Initial RPM release. diff --git a/wmbusmeters@.service b/wmbusmeters@.service new file mode 100644 index 0000000..946498d --- /dev/null +++ b/wmbusmeters@.service @@ -0,0 +1,14 @@ +[Unit] +Description="wmbusmeters service on %I" +Documentation=https://github.com/weetmuts/wmbusmeters +Documentation=man:wmbusmeters(1) +After=network.target + +[Service] +Type=forking +ExecStartPre=/bin/mkdir -p /run/wmbusmeters +ExecStart=/usr/sbin/wmbusmetersd --device='%I' /run/wmbusmeters/wmbusmeters-%i.pid +PIDFile=/run/wmbusmeters/wmbusmeters-%i.pid + +[Install] +WantedBy=multi-user.target