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:
parent
0385ff1446
commit
ba0fbf7a8b
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
||||||
## Ignore the output binary
|
## Ignore the output binary
|
||||||
dexedrine
|
dexedrine
|
||||||
|
dexedrine.service
|
||||||
|
|
|
||||||
8
Makefile
8
Makefile
|
|
@ -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
|
||||||
|
|
|
||||||
7
dexedrine.service.template
Normal file
7
dexedrine.service.template
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Dexedrine
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=%DEXPATH%
|
||||||
|
KillSignal=SIGINT
|
||||||
Loading…
Reference in New Issue
Block a user