From 1e78f80de7eb0eeec858087b9517c9ae5cc91199 Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Tue, 9 Jul 2019 01:35:43 -0700 Subject: [PATCH] Rename templates --- Makefile | 5 +++-- .../{unifi-poller.rb.tmpl => formula.rb.tmpl} | 0 init/systemd/template.unit.service | 20 +++++++++++++++++++ init/systemd/unifi-poller.service | 20 ------------------- 4 files changed, 23 insertions(+), 22 deletions(-) rename init/homebrew/{unifi-poller.rb.tmpl => formula.rb.tmpl} (100%) create mode 100644 init/systemd/template.unit.service delete mode 100644 init/systemd/unifi-poller.service diff --git a/Makefile b/Makefile index 6791d8b5..9e5501b8 100644 --- a/Makefile +++ b/Makefile @@ -279,7 +279,8 @@ package_build_linux: readme man linux cp examples/$(CONFIG_FILE).example $@/etc/$(BINARY)/$(CONFIG_FILE) cp LICENSE *.html examples/*?.?* $@/usr/share/doc/$(BINARY)/ # These go to their own folder so the img src in the html pages continue to work. - cp init/systemd/$(BINARY).service $@/lib/systemd/system/ + sed -e "s/{{BINARY}}/$(BINARY)/g" -e "s/{{DESC}}/$(DESC)/g" \ + init/systemd/template.unit.service > $@/lib/systemd/system/$(BINARY).service package_build_linux_386: package_build_linux linux386 mkdir -p $@ @@ -316,7 +317,7 @@ $(BINARY).rb: v$(VERSION).tar.gz.sha256 -e "s%{{GHREPO}}%$(GHREPO)%g" \ -e "s%{{CONFIG_FILE}}%$(CONFIG_FILE)%g" \ -e "s%{{Class}}%$(shell echo $(BINARY) | perl -pe 's/(?:\b|-)(\p{Ll})/\u$$1/g')%g" \ - init/homebrew/$(BINARY).rb.tmpl | tee $(BINARY).rb + init/homebrew/formula.rb.tmpl | tee $(BINARY).rb # Extras # Run code tests and lint. diff --git a/init/homebrew/unifi-poller.rb.tmpl b/init/homebrew/formula.rb.tmpl similarity index 100% rename from init/homebrew/unifi-poller.rb.tmpl rename to init/homebrew/formula.rb.tmpl diff --git a/init/systemd/template.unit.service b/init/systemd/template.unit.service new file mode 100644 index 00000000..a471a3ef --- /dev/null +++ b/init/systemd/template.unit.service @@ -0,0 +1,20 @@ +# Systemd service unit for {{BINARY}}. + +[Unit] +Description={{BINARY}} - {{DESC}} +After=network.target +Requires=network.target + +[Service] +ExecStart=/usr/bin/{{BINARY}} $DAEMON_OPTS +EnvironmentFile=-/etc/default/{{BINARY}} +EnvironmentFile=-/etc/sysconfig/{{BINARY}} +Restart=on-error +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier={{BINARY}} +Type=simple +User=nobody + +[Install] +WantedBy=multi-user.target diff --git a/init/systemd/unifi-poller.service b/init/systemd/unifi-poller.service deleted file mode 100644 index c8c65428..00000000 --- a/init/systemd/unifi-poller.service +++ /dev/null @@ -1,20 +0,0 @@ -# Sytemd service unit for unifi-poller. - -[Unit] -Description=UniFi Poller - Stores UniFi Metrics in InfluxDB -After=network.target -Requires=network.target - -[Service] -ExecStart=/usr/bin/unifi-poller $DAEMON_OPTS -EnvironmentFile=-/etc/default/unifi-poller -EnvironmentFile=-/etc/sysconfig/unifi-poller -Restart=on-error -StandardOutput=syslog -StandardError=syslog -SyslogIdentifier=unifi-poller -Type=simple -User=nobody - -[Install] -WantedBy=multi-user.target