From d4e6f2cb5ef3eebc9844d9fb96a61f4935d8e3b8 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sat, 18 Jul 2020 18:07:21 +0200 Subject: [PATCH] add install targets --- Makefile | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2181178..3f298dc 100644 --- a/Makefile +++ b/Makefile @@ -35,10 +35,31 @@ RemoteCommand: Log.o RemoteCommand.o UDPSocket.o %.o: %.cpp $(CXX) $(CFLAGS) -c -o $@ $< -install: +.PHONY install: +install: all install -m 755 MMDVMHost /usr/local/bin/ install -m 755 RemoteCommand /usr/local/bin/ +.PHONY install-service: +install-service: install /etc/MMDVM.ini + @useradd --user-group -M --system mmdvm --shell /bin/false || true + @usermod --groups dialout --append mmdvm || true + @mkdir /var/log/mmdvm || true + @chown mmdvm:mmdvm /var/log/mmdvm + @cp ./linux/systemd/mmdvmhost.service /lib/systemd/system/ + @systemctl enable mmdvmhost.service + +/etc/MMDVM.ini: + @cp -n MMDVM.ini /etc/MMDVM.ini + @sed -i 's/FilePath=./FilePath=\/var\/log\/mmdvm\//' /etc/MMDVM.ini + @sed -i 's/Daemon=0/Daemon=1/' /etc/MMDVM.ini + @chown mmdvm:mmdvm /etc/MMDVM.ini + +uninstall-service: + @systemctl stop mmdvmhost.service || true + @systemctl disable mmdvmhost.service || true + @rm -f /usr/local/bin/MMDVMHost || true + clean: $(RM) MMDVMHost RemoteCommand *.o *.d *.bak *~ GitVersion.h