This repository has been archived by the owner on Apr 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
41 lines (38 loc) · 1.75 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
.PHONY: install-user
install-user:
@mkdir --parents $${HOME}/.local/bin \
&& mkdir --parents $${HOME}/.config/systemd/user \
&& cp pbs_exporter.sh $${HOME}/.local/bin/ \
&& chmod +x $${HOME}/.local/bin/pbs_exporter.sh \
&& cp --no-clobber pbs_exporter.conf $${HOME}/.config/pbs_exporter.conf \
&& chmod 400 $${HOME}/.config/pbs_exporter.conf \
&& cp pbs-exporter.timer $${HOME}/.config/systemd/user/ \
&& cp pbs-exporter.service $${HOME}/.config/systemd/user/ \
&& sed -i "s#ExecStart=/usr/local/bin/pbs_exporter.sh#ExecStart=$${HOME}/.local/bin/pbs_exporter.sh#" \
$${HOME}/.config/systemd/user/pbs-exporter.service \
&& sed -i "s#LoadCredential=creds:/etc/pbs_exporter.conf#LoadCredential=creds:$${HOME}/.config/pbs_exporter.conf#" \
$${HOME}/.config/systemd/user/pbs-exporter.service \
&& systemctl --user enable --now pbs-exporter.timer
.PHONY: uninstall-user
uninstall-user:
@rm -f $${HOME}/.local/bin/pbs_exporter.sh \
&& rm -f $${HOME}/.config/pbs_exporter.conf \
&& systemctl --user disable --now pbs-exporter.timer \
&& rm -f $${HOME}/.config/.config/systemd/user/pbs-exporter.timer \
&& rm -f $${HOME}/.config/systemd/user/pbs-exporter.service
.PHONY: install
install:
@cp pbs_exporter.sh /usr/local/bin/ \
&& chmod +x /usr/local/bin/pbs_exporter.sh \
&& cp --no-clobber pbs_exporter.conf /etc/pbs_exporter.conf \
&& chmod 400 /etc/pbs_exporter.conf \
&& cp pbs-exporter.timer /etc/systemd/system/ \
&& cp pbs-exporter.service /etc/systemd/system/ \
&& systemctl enable --now pbs-exporter.timer
.PHONY: uninstall
uninstall:
@rm -f /usr/local/bin/pbs_exporter.sh \
&& rm -f /etc/pbs_exporter.conf \
&& systemctl disable --now pbs-exporter.timer \
&& rm -f /etc/systemd/system/pbs-exporter.timer \
&& rm -f /etc/systemd/system/pbs-exporter.service