summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2019-07-25 11:36:16 -0700
committerBjorn Andersson <bjorn.andersson@linaro.org>2019-07-25 11:36:16 -0700
commit75a7a89398ae49c5a51e65b1ae7bfa23075c4f4a (patch)
tree726921f7b1a28226963e0e0ebb0445c690f0ea7b
parent6348c52f205426b91d3f8384267b5691d93f81bd (diff)
tqftpserv.service: Add systemd service
Add tqftpserv.service and install this. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
-rw-r--r--Makefile14
-rw-r--r--tqftpserv.service.in12
2 files changed, 23 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 939430a..89ab0b7 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,10 @@ TQFTPSERV := tqftpserv
CFLAGS := -Wall -g -O2
LDFLAGS := -lqrtr
+prefix ?= /usr/local
+bindir := $(prefix)/bin
+servicedir := $(prefix)/lib/systemd/system
+
SRCS := tqftpserv.c
OBJS := $(SRCS:.c=.o)
@@ -10,8 +14,12 @@ OBJS := $(SRCS:.c=.o)
$(TQFTPSERV): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
-install: $(TQFTPSERV)
- install -D -m 755 $< $(DESTDIR)$(prefix)/bin/$<
+tqftpserv.service: tqftpserv.service.in
+ @sed 's+TQFTPSERV_PATH+$(bindir)+g' $< > $@
+
+install: $(TQFTPSERV) tqftpserv.service
+ @install -D -m 755 $(TQFTPSERV) $(DESTDIR)$(bindir)/$(TQFTPSERV)
+ @install -D -m 644 tqftpserv.service $(DESTDIR)$(servicedir)/tqftpserv.service
clean:
- rm -f $(TQFTPSERV) $(OBJS)
+ rm -f $(TQFTPSERV) $(OBJS) tqftpserv.service
diff --git a/tqftpserv.service.in b/tqftpserv.service.in
new file mode 100644
index 0000000..2cf828c
--- /dev/null
+++ b/tqftpserv.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=QRTR TFTP service
+Requires=qrtr-ns.service
+After=qrtr-ns.service
+
+[Service]
+ExecStart=TQFTPSERV_PATH/tqftpserv
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+