-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
46 lines (39 loc) · 1.58 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# SPDX-FileCopyrightText: 2023 Fredrik Salomonsson <plattfot@posteo.net>
#
# SPDX-License-Identifier: GPL-3.0-or-later
PREFIX ?= /
PREFIX_BIN ?= $(PREFIX)/usr/bin
PREFIX_LIB ?= $(PREFIX)/usr/lib
PREFIX_ETC ?= $(PREFIX)/etc
SYSTEMD_CONF ?= $(PREFIX_ETC)
.PHONY: usage
usage:
@echo "To install baksnapper run make install. The default is to install the"
@echo "script to '/'. To change this behaviour add PREFIX=<path> to the"
@echo "make install command"
@echo "For a more fine grain control there are four different variables "
@echo "you can change."
@echo ""
@echo "PREFIX_BIN: Where the baksnapper scripts will end up."
@echo " Default is PREFIX/usr/bin."
@echo "PREFIX_LIB: Where the systemd scripts will end up."
@echo " Default is PREFIX/usr/lib."
@echo "PREFIX_ETC: Where the example config file will end up."
@echo " Default is PREFIX/etc."
@echo "BSCONF_ROOT: Path to where the systemd service unit will look for"
@echo " config files, default is PREFIX_ETC."
$(PREFIX_BIN) $(PREFIX_LIB)/systemd/system $(PREFIX_ETC)/baksnapper/example:
@install -d $@
.PHONY: install bin systemd etc
install: bin systemd
bin: | $(PREFIX_BIN)
@install baksnapper.sh $|/baksnapper
@install baksnapperd.sh $|/baksnapperd
systemd: etc | $(PREFIX_LIB)/systemd/system
@install --mode=644 systemd/baksnapper@.timer $|/
@sed "s|<BSCONF_ROOT>|$(BSCONF_ROOT)|" \
systemd/baksnapper@.service.template \
> $|/baksnapper@.service
@chmod 644 $|/baksnapper@.service
etc: | $(PREFIX_ETC)/baksnapper/example
@install systemd/example.bsconf $|/root.bsconf