feat(systemd): add systemd service

add systemd service through use of a template. This makes sure that
wherever dexedrine is installed the systemd unitfile will be able to
find it.
This commit is contained in:
Robert Morrison 2023-12-30 18:10:06 +00:00
parent 0385ff1446
commit ba0fbf7a8b
Signed by: robert
GPG Key ID: 73E012EB3F4EC696
3 changed files with 14 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
## Ignore the output binary ## Ignore the output binary
dexedrine dexedrine
dexedrine.service

View File

@ -13,17 +13,21 @@ dexpath = $(bindir)/dexedrine
.PHONY: all clean install .PHONY: all clean install
# Define the default rule to build the program # Define the default rule to build the program
all: dexedrine all: dexedrine dexedrine.service
# Define the rule to compile the source file # Define the rule to compile the source file
dexedrine: dexedrine.c dexedrine.h dexedrine: dexedrine.c dexedrine.h
$(CC) $(CFLAGS) dexedrine.c -o dexedrine $(LIBS) $(CC) $(CFLAGS) dexedrine.c -o dexedrine $(LIBS)
dexedrine.service: dexedrine.service.template
sed --posix "s@%DEXPATH%@$(dexpath)@" dexedrine.service.template > dexedrine.service
# Define the rule to clean the generated files # Define the rule to clean the generated files
clean: clean:
rm dexedrine rm dexedrine
# Define how to install # Define how to install
install: install: all
install dexedrine $(DESTDIR)$(dexpath) install dexedrine $(DESTDIR)$(dexpath)
install dexedrine.service /usr/lib/systemd/user/dexedrine.service

View File

@ -0,0 +1,7 @@
[Unit]
Description=Dexedrine
[Service]
Type=simple
ExecStart=%DEXPATH%
KillSignal=SIGINT