From 340b13ab6e44e74dffe9a9f589c2c956ce75e3da Mon Sep 17 00:00:00 2001 From: Matthias Hannig Date: Wed, 30 Nov 2016 17:42:40 +0100 Subject: [PATCH] added rpm build option for upstart and systemd --- Makefile | 14 ++++++++++++-- etc/systemd/birdwatcher.target | 6 ------ {etc => install}/systemd/birdwatcher4.service | 6 +++--- {etc => install}/systemd/birdwatcher6.service | 6 +++--- .../upstart}/init/bird4watcher.conf | 0 .../upstart}/init/bird6watcher.conf | 0 .../upstart}/init/birdwatcher.conf | 0 7 files changed, 18 insertions(+), 14 deletions(-) delete mode 100644 etc/systemd/birdwatcher.target rename {etc => install}/systemd/birdwatcher4.service (68%) rename {etc => install}/systemd/birdwatcher6.service (68%) rename {docs/upstart_example => install/upstart}/init/bird4watcher.conf (100%) rename {docs/upstart_example => install/upstart}/init/bird6watcher.conf (100%) rename {docs/upstart_example => install/upstart}/init/birdwatcher.conf (100%) diff --git a/Makefile b/Makefile index 9ad0f75..c7db02a 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,8 @@ VERSION=$(APP_VERSION)_$(shell git rev-parse --short HEAD) BUILD_SERVER='' +SYSTEM_INIT=systemd + DIST=DIST/ REMOTE_DIST=$(PROG)-$(DIST) @@ -44,12 +46,20 @@ endif dist: clean linux mkdir -p $(DIST)opt/ecix/birdwatcher/bin - mkdir -p $(DIST)etc/systemd mkdir -p $(DIST)etc/ecix +ifeq ($(SYSTEM_INIT), systemd) + # Installing systemd services + mkdir -p $(DIST)usr/lib/systemd/system/ + cp install/systemd/* $(DIST)usr/lib/systemd/system/. +else + # Installing upstart configuration + mkdir -p $(DIST)/etc/init/ + cp install/upstart/init/* $(DIST)etc/init/. +endif + # Copy config and startup script - cp etc/systemd/* DIST/etc/systemd/. cp etc/ecix/* DIST/etc/ecix/. rm -f DIST/etc/ecix/*.local.* diff --git a/etc/systemd/birdwatcher.target b/etc/systemd/birdwatcher.target deleted file mode 100644 index 11f6f41..0000000 --- a/etc/systemd/birdwatcher.target +++ /dev/null @@ -1,6 +0,0 @@ -[Unit] -Wants=birdwatcher4.service birdwatcher6.service - -[Install] -WantedBy=multi-user.target - diff --git a/etc/systemd/birdwatcher4.service b/install/systemd/birdwatcher4.service similarity index 68% rename from etc/systemd/birdwatcher4.service rename to install/systemd/birdwatcher4.service index fc1bbc9..a4b6563 100644 --- a/etc/systemd/birdwatcher4.service +++ b/install/systemd/birdwatcher4.service @@ -1,11 +1,11 @@ - [Unit] -Description=Birdwatcher (IPv4) +Description=BIRDwatcher IPv4 +Wants=network.target After=network.target [Service] +Type=simple ExecStart=/opt/ecix/birdwatcher/bin/birdwatcher-linux-amd64 [Install] WantedBy=multi-user.target - diff --git a/etc/systemd/birdwatcher6.service b/install/systemd/birdwatcher6.service similarity index 68% rename from etc/systemd/birdwatcher6.service rename to install/systemd/birdwatcher6.service index e61c004..940d53e 100644 --- a/etc/systemd/birdwatcher6.service +++ b/install/systemd/birdwatcher6.service @@ -1,11 +1,11 @@ - [Unit] -Description=Birdwatcher (IPv6) +Description=BIRDwatcher IPv6 +Wants=network.target After=network.target [Service] +Type=simple ExecStart=/opt/ecix/birdwatcher/bin/birdwatcher-linux-amd64 -6 [Install] WantedBy=multi-user.target - diff --git a/docs/upstart_example/init/bird4watcher.conf b/install/upstart/init/bird4watcher.conf similarity index 100% rename from docs/upstart_example/init/bird4watcher.conf rename to install/upstart/init/bird4watcher.conf diff --git a/docs/upstart_example/init/bird6watcher.conf b/install/upstart/init/bird6watcher.conf similarity index 100% rename from docs/upstart_example/init/bird6watcher.conf rename to install/upstart/init/bird6watcher.conf diff --git a/docs/upstart_example/init/birdwatcher.conf b/install/upstart/init/birdwatcher.conf similarity index 100% rename from docs/upstart_example/init/birdwatcher.conf rename to install/upstart/init/birdwatcher.conf