From 6d2cfcddfc104f977c244d6a5b55b1701edd7666 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Thu, 25 Jul 2019 11:15:03 -0700 Subject: [PATCH] rmtfs.service: Add systemd service Add rmtfs.service and install this. Signed-off-by: Bjorn Andersson --- .gitignore | 1 + Makefile | 12 +++++++++--- rmtfs.service.in | 11 +++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 rmtfs.service.in diff --git a/.gitignore b/.gitignore index b619935..eab0e81 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ rmtfs *.o +rmtfs.service diff --git a/Makefile b/Makefile index 1c66244..54ae35f 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,8 @@ OUT := rmtfs CFLAGS += -Wall -g -O2 LDFLAGS += -lqrtr -ludev -lpthread prefix = /usr/local +bindir := $(prefix)/bin +servicedir := $(prefix)/lib/systemd/system SRCS := qmi_rmtfs.c rmtfs.c rproc.c sharedmem.c storage.c util.c OBJS := $(SRCS:.c=.o) @@ -13,9 +15,13 @@ $(OUT): $(OBJS) %.c: %.qmi qmic -k < $< -install: $(OUT) - install -D -m 755 $< $(DESTDIR)$(prefix)/bin/$< +rmtfs.service: rmtfs.service.in + @sed 's+RMTFS_PATH+$(bindir)+g' $< > $@ + +install: $(OUT) rmtfs.service + @install -D -m 755 $(OUT) $(DESTDIR)$(prefix)/bin/$(OUT) + @install -D -m 644 rmtfs.service $(DESTDIR)$(servicedir)/rmtfs.service clean: - rm -f $(OUT) $(OBJS) + rm -f $(OUT) $(OBJS) rmtfs.service diff --git a/rmtfs.service.in b/rmtfs.service.in new file mode 100644 index 0000000..0dd59d4 --- /dev/null +++ b/rmtfs.service.in @@ -0,0 +1,11 @@ +[Unit] +Description=Qualcomm remotefs service +Requires=qrtr-ns.service +After=qrtr-ns.service + +[Service] +ExecStart=RMTFS_PATH/rmtfs -r -P -s +Restart=always + +[Install] +WantedBy=multi-user.target