summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
+