]> arthur.barton.de Git - netatalk.git/blob - distrib/initscripts/Makefile.am
New service controller
[netatalk.git] / distrib / initscripts / Makefile.am
1 ## Makefile for distrib/initscripts/
2
3 SUFFIXES = .tmpl .
4
5 pkgconfdir = @PKGCONFDIR@
6
7 #
8 # Template Generation
9 #
10
11 .tmpl:
12         sed -e s@:BINDIR:@${bindir}@ \
13             -e s@:SBINDIR:@${sbindir}@ \
14             -e s@:ETCDIR:@${pkgconfdir}@ \
15             -e s@:NETATALK_VERSION:@${NETATALK_VERSION}@ \
16             <$< >$@
17
18 GENERATED_FILES = \
19         rc.bsd \
20         rc.debian \
21         rc.gentoo \
22         rc.netbsd \
23         rc.redhat \
24         rc.solaris \
25         rc.suse \
26         service.netatalk.systemd
27
28 TEMPLATES = \
29         rc.bsd.tmpl \
30         rc.debian.tmpl \
31         rc.gentoo.tmpl \
32         rc.netbsd.tmpl \
33         rc.redhat.tmpl \
34         rc.solaris.tmpl \
35         rc.suse.tmpl \
36         service.netatalk.systemd.tmpl
37
38 CLEANFILES = $(GENERATED_FILES) $(sysv_SCRIPTS) $(service_DATA) afpd cnid_metad
39 EXTRA_DIST = $(TEMPLATES)
40
41 # overwrite automake uninstall
42 # not beautiful, but this way we can call the OS specific init script
43 # tools, like chkconfig, insserv or rc-update
44
45 uninstall: uninstall-startup
46
47 #
48 # checking for "redhat" style sysv scripts:
49 #
50
51 if USE_REDHAT_SYSV
52
53 sysvdir = /etc/rc.d/init.d
54 sysv_SCRIPTS = netatalk
55
56 $(sysv_SCRIPTS): rc.redhat
57         cp -f rc.redhat $(sysv_SCRIPTS)
58         chmod a+x $(sysv_SCRIPTS)
59
60 install-data-hook:
61         -chkconfig --add $(sysv_SCRIPTS)
62
63 uninstall-startup:
64         -chkconfig --del $(sysv_SCRIPTS)
65         rm -f $(DESTDIR)$(sysvdir)/$(sysv_SCRIPTS)
66
67 endif
68
69 #
70 # checking for general systemd scripts:
71 #
72
73 if USE_SYSTEMD
74
75 servicedir      = /lib/systemd/system
76 service_DATA    = netatalk.service
77
78 netatalk.service: service.netatalk.systemd
79         cp -f service.netatalk.systemd netatalk.service
80
81 install-data-hook:
82         -systemctl daemon-reload
83
84 uninstall-startup:
85         -systemctl disable $(service_DATA)
86         rm -f $(DESTDIR)$(servicedir)/netatalk.service
87         -systemctl daemon-reload
88
89 endif
90
91 #
92 # checking for "SuSE" style sysv scripts:
93 #
94
95 if USE_SUSE_SYSV
96
97 sysvdir = /etc/init.d
98 sysv_SCRIPTS = netatalk
99
100 $(sysv_SCRIPTS): rc.suse
101         cp -f rc.suse $(sysv_SCRIPTS)
102         chmod a+x $(sysv_SCRIPTS)
103
104 install-data-hook:
105         -insserv $(sysv_SCRIPTS)
106
107 uninstall-startup:
108         -insserv -d $(sysv_SCRIPTS)
109         rm -f $(DESTDIR)$(sysvdir)/$(sysv_SCRIPTS)
110
111 endif
112
113 #
114 # checking for NetBSD init scripts
115 #
116
117 if USE_NETBSD
118
119 sysvdir = /etc/rc.d
120 sysv_SCRIPTS = netatalk
121
122 netatalk: rc.netbsd
123         cp -f $< $@
124         chmod a+x $@
125
126 install-data-hook:
127
128 uninstall-hook:
129
130 uninstall-startup: uninstall-am
131
132 endif
133
134 #
135 # checking for Solaris init scripts
136 #
137
138 if USE_SOLARIS
139
140 sysvdir = /etc/init.d
141 sysv_SCRIPTS = netatalk
142
143 $(sysv_SCRIPTS): rc.solaris
144         cp -f rc.solaris $@
145         chmod a+x $@
146
147 install-data-hook:
148         rm -f $(DESTDIR)/etc/rc2.d/S90$(sysv_SCRIPTS)
149         -ln -s ../init.d/$(sysv_SCRIPTS) $(DESTDIR)/etc/rc2.d/S90$(sysv_SCRIPTS)
150         rm -f $(DESTDIR)/etc/rc0.d/K04$(sysv_SCRIPTS)
151         -ln -s ../init.d/$(sysv_SCRIPTS) $(DESTDIR)/etc/rc0.d/K04$(sysv_SCRIPTS)
152
153 uninstall-startup:
154         rm -f $(DESTDIR)$(sysvdir)/$(sysv_SCRIPTS) \
155                 $(DESTDIR)/etc/rc2.d/S90$(sysv_SCRIPTS) \
156                 $(DESTDIR)/etc/rc0.d/K04$(sysv_SCRIPTS)
157
158 endif
159
160 #
161 # checking for "Gentoo" style sysv scripts:
162 #
163
164 if USE_GENTOO
165
166 sysvdir = /etc/init.d
167 sysv_SCRIPTS = netatalk
168
169 $(sysv_SCRIPTS): rc.gentoo
170         cp -f rc.gentoo $(sysv_SCRIPTS)
171         chmod a+x $(sysv_SCRIPTS)
172
173 install-data-hook:
174 #       -rc-update add $(sysv_SCRIPTS) default
175
176 uninstall-startup:
177 #       -rc-update del $(sysv_SCRIPTS) default
178 #       rm -f $(DESTDIR)$(sysvdir)/$(sysv_SCRIPTS)
179
180 endif
181
182 #
183 # checking for "Debian" style sysv scripts:
184 #
185
186 if USE_DEBIAN
187
188 sysvdir = /etc/init.d
189 sysv_SCRIPTS = netatalk
190
191 $(sysv_SCRIPTS): rc.debian
192         cp -f rc.debian $(sysv_SCRIPTS)
193         chmod a+x $(sysv_SCRIPTS)
194
195 install-data-hook:
196 #       update-rc.d $(sysv_SCRIPTS) defaults 90 10
197
198 uninstall-startup:
199 #       rm -f $(DESTDIR)$(sysvdir)/$(sysv_SCRIPTS)
200 #       update-rc.d netatalk remove
201
202 endif
203
204
205 #
206 # defaults, no init scripts installed
207 #
208
209 if USE_UNDEF
210
211 install-data-hook:
212
213 uninstall-hook:
214
215 uninstall-startup: uninstall-am
216
217 endif
218