2 # Copyright (C) 2000-2016 Kern Sibbald
3 # License: BSD 2-Clause; see file LICENSE-FOSS
5 # This file is used as the template to create the
6 # Makefile for the systemd specific installation.
9 # for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
13 INSTALL_PROGRAM = @INSTALL_PROGRAM@
14 # should be /lib/systemd/system and get be get with
15 # systemctl show | grep UnitPath | cut -d " " -f2
16 SYSTEMD_UNITDIR = @SYSTEMD_UNITDIR@
17 SYSTEMD_TMPFILES = /etc/tmpfiles.d
21 install: install-dir install-conf install-autostart
24 mkdir -p $(DESTDIR)/$(SYSTEMD_UNITDIR) $(DESTDIR)/$(SYSTEMD_TMPFILES)
27 @$(INSTALL_PROGRAM) -m 644 bacula.conf $(DESTDIR)/$(SYSTEMD_TMPFILES)/bacula.conf
29 install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir
32 @$(INSTALL_PROGRAM) -m 644 bacula-fd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
33 @$(INSTALL_PROGRAM) -m 644 bacula-dir.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
34 @$(INSTALL_PROGRAM) -m 644 bacula-sd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
37 @if test x$(DESTDIR) = x -a -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
38 /bin/systemctl stop bacula-fd.service; \
39 /bin/systemctl disable bacula-fd.service; \
41 @$(INSTALL_PROGRAM) -m 644 bacula-fd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-fd.service
42 # set symlinks for script at startup and shutdown
43 @if test x$(DESTDIR) = x ; then \
44 /bin/systemctl enable bacula-fd.service; \
45 /bin/systemctl start bacula-fd.service; \
50 @if test x$(DESTDIR) = x -a -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
51 /bin/systemctl stop bacula-sd.service; \
52 /bin/systemctl disable bacula-sd.service; \
54 @$(INSTALL_PROGRAM) -m 644 bacula-sd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-sd.service
55 # set symlinks for script at startup and shutdown
56 @if test x$(DESTDIR) = x ; then \
57 /bin/systemctl enable bacula-sd.service; \
58 /bin/systemctl start bacula-sd.service; \
62 install-autostart-dir:
63 @if test x$(DESTDIR) = x -a -f $(SYSTEMD_UNITDIR)/bacula-dir.service; then \
64 /bin/systemctl stop bacula-dir.service; \
65 /bin/systemctl disable bacula-dir.service; \
67 @$(INSTALL_PROGRAM) -m 644 bacula-dir.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-dir.service
68 # set symlinks for script at startup and shutdown
69 @if test x$(DESTDIR) = x ; then \
70 /bin/systemctl enable bacula-dir.service; \
71 /bin/systemctl start bacula-dir.service; \
75 uninstall: uninstall-autostart uninstall-conf
77 uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir
79 uninstall-autostart-fd:
80 @if test x$(DESTDIR) = x -a -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
81 /bin/systemctl stop bacula-fd.service; \
82 /bin/systemctl disable bacula-fd.service; \
84 @rm -f $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-fd.service
87 uninstall-autostart-sd:
88 @if test x$(DESTDIR) = x -a -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
89 /bin/systemctl stop bacula-fd.service; \
90 /bin/systemctl disable bacula-fd.service; \
92 @rm -f $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-sd.service
94 uninstall-autostart-dir:
95 @if test x$(DESTDIR) = x -a -f $(SYSTEMD)/bacula-dir.service; then \
96 /bin/systemctl stop bacula-dir.service; \
97 /bin/systemctl disable bacula-dir.service; \
99 @rm -f $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-dir.service
102 @rm -f $(DESTDIR)/$(SYSTEMD_TMPFILES)/bacula.conf
108 @rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
109 @rm -f bacula.conf bacula-sd.service bacula-fd.service bacula-dir.service
112 @rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
113 @rm -f bacula.conf bacula-sd.service bacula-fd.service bacula-dir.service