-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (32 loc) · 1.1 KB
/
Makefile
File metadata and controls
38 lines (32 loc) · 1.1 KB
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
SHELL := /bin/bash
PREFIX ?= /usr/local
SBINDIR ?= $(PREFIX)/sbin
SYSTEMD_UNIT_DIR ?= /etc/systemd/system
SYSTEMCTL ?= systemctl
SHELLCHECK ?= shellcheck
SHFMT ?= shfmt
BATS ?= bats
SCRIPT := autoupdate-and-reboot.sh
CLEANSHUTDOWN := cleanshutdown
SERVICE := systemd/autoupdate.service
TIMER := systemd/autoupdate.timer
.PHONY: install uninstall lint test
install: $(SCRIPT) $(SERVICE) $(TIMER)
install -Dm755 $(SCRIPT) $(DESTDIR)$(SBINDIR)/autoupdate-and-reboot.sh
install -Dm755 $(CLEANSHUTDOWN) $(DESTDIR)$(SBINDIR)/cleanshutdown
install -Dm644 $(SERVICE) $(DESTDIR)$(SYSTEMD_UNIT_DIR)/autoupdate.service
install -Dm644 $(TIMER) $(DESTDIR)$(SYSTEMD_UNIT_DIR)/autoupdate.timer
$(SYSTEMCTL) daemon-reload
$(SYSTEMCTL) enable --now autoupdate.timer
-$(SYSTEMCTL) disable --now apt-daily-upgrade.timer
uninstall:
-$(SYSTEMCTL) disable --now autoupdate.timer
rm -f $(DESTDIR)$(SBINDIR)/autoupdate-and-reboot.sh
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/autoupdate.service
rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/autoupdate.timer
$(SYSTEMCTL) daemon-reload
lint:
$(SHELLCHECK) $(SCRIPT)
$(SHFMT) -d .
test:
$(BATS) test