From 9bf08d1d6d5e8d930a458854d25f752b9882d0e1 Mon Sep 17 00:00:00 2001 From: June Tate-Gans Date: Sat, 24 Apr 2021 23:50:48 -0500 Subject: [PATCH] qol fixes: Update Makefile and add systemd unit This removes the makefile packaging target, since it wasn't really all that useful for distribution of the program. Additionally, this sets up an install target to install g13d to the users' local directory. This is kinda a hack -- really we should be installing g13d to $PREFIX/bin, dropping a g13d unit somewhere, and then setting up appropriate permissions, etc. It works for me, though. --- Makefile | 23 +++++++++++++---------- g13d.service | 7 +++++++ 2 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 g13d.service diff --git a/Makefile b/Makefile index 1b44d5c..d558d19 100644 --- a/Makefile +++ b/Makefile @@ -21,14 +21,14 @@ g13_lcd.o: g13.h helper.hpp g13_lcd.cc g13_stick.o: g13.h helper.hpp g13_stick.cc g++ $(FLAGS) -c g13_stick.cc - + g13_keys.o: g13.h helper.hpp g13_keys.cc g++ $(FLAGS) -c g13_keys.cc helper.o: helper.hpp helper.cpp g++ $(FLAGS) -c helper.cpp - - + + g13d: g13_main.o g13.o g13_log.o g13_fonts.o g13_lcd.o g13_stick.o g13_keys.o helper.o g++ -o g13d -std=c++0x \ g13_main.o g13.o g13_log.o g13_fonts.o g13_lcd.o g13_stick.o g13_keys.o helper.o \ @@ -39,11 +39,14 @@ g13d: g13_main.o g13.o g13_log.o g13_fonts.o g13_lcd.o g13_stick.o g13_keys.o he pbm2lpbm: pbm2lpbm.c g++ -o pbm2lpbm pbm2lpbm.c -package: - rm -Rf g13-userspace - mkdir g13-userspace - cp g13.cc g13.h logo.h Makefile pbm2lpbm.c g13-userspace - tar cjf g13-userspace.tbz2 g13-userspace - rm -Rf g13-userspace clean: - rm -f g13 pbm2lpbm \ No newline at end of file + rm -f g13 pbm2lpbm + +install: + install -d ${HOME}/.local/bin + install -m700 -d ${HOME}/.local/var/g13d + install -d ${HOME}/.config/systemd/user + cat g13d.service |sed "s,@HOME@,${HOME},g" > ${HOME}/.config/systemd/user/g13d.service + install -m755 g13d ${HOME}/.local/bin/g13d + +.PHONY: all clean install diff --git a/g13d.service b/g13d.service new file mode 100644 index 0000000..f683203 --- /dev/null +++ b/g13d.service @@ -0,0 +1,7 @@ +[Unit] +Description=Logitech g13 daemon + +[Service] +Type=simple +ExecStart=@HOME@/.local/bin/g13d --pipe_in @HOME@/.local/var/g13d/in --pipe_out @HOME@/.local/var/g13d/out +Restart=on-failure