From f32da4ead891548cd23ec0dd6408ef3125b4e9e3 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Wed, 24 Feb 2021 18:19:42 -0500 Subject: debian package will include service file; install target will enable service --- Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0fe0bb0..94a7956 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ INSTALL_MKDIR = $(INSTALL) -d -m 755 prefix ?= /usr bindir ?= $(prefix)/bin +etcdir ?= /etc # Targets all: tuntox tuntox_nostatic @@ -45,15 +46,22 @@ clean: rm -f *.o tuntox cscope.out gitversion.h tox_bootstrap.h install: tuntox_nostatic - $(INSTALL_MKDIR) -d $(DESTDIR)$(bindir) - cp tuntox_nostatic $(DESTDIR)$(bindir)/tuntox - install scripts/tokssh $(DESTDIR)$(bindir)/ + install -d -m755 $(DESTDIR)$(bindir) $(DESTDIR)$(etcdir) + install -d -m700 $(DESTDIR)$(etcdir)/tuntox + install -D -T tuntox_nostatic $(DESTDIR)$(bindir)/tuntox + install -D scripts/tokssh -t $(DESTDIR)$(bindir)/ + install -m0644 -D -t $(DESTDIR)$(etcdir)/systemd/system scripts/tuntox.service +ifeq ($(SKIP_SYSTEMCTL),) + systemctl daemon-reload + systemctl restart tuntox + systemctl status tuntox +endif debs = ../tuntox_0.0.9-1_amd64.deb ../tuntox-dbgsym_0.0.9-1_amd64.deb .PHONY: install-debs debs install-debs: $(debs) $(shell [ "$$(id -u)" = 0 ] || echo sudo) dpkg -i $(debs) $(debs) debs: - fakeroot ./debian/rules binary + fakeroot -- sh -c 'SKIP_SYSTEMCTL=y ./debian/rules binary' .PHONY: all clean tuntox -- cgit v1.2.3