SUFFIXES = .tmpl .
+pkgconfdir = @PKGCONFDIR@
+
+#
+# Template Generation
+#
+
.tmpl:
sed -e s@:BINDIR:@${bindir}@ \
-e s@:SBINDIR:@${sbindir}@ \
- -e s@:ETCDIR:@${CONFIG_DIR}@ \
- <$^ >$@
+ -e s@:ETCDIR:@${pkgconfdir}@ \
+ <$< >$@
+
+GENERATED_FILES = \
+ rc.afpd.netbsd \
+ rc.atalk.redhat \
+ rc.atalk.tru64 \
+ rc.atalk.bsd \
+ rc.atalkd.netbsd \
+ rc.atalk.suse \
+ rc.cnid_metad.netbsd \
+ rc.papd.netbsd \
+ rc.timelord.netbsd \
+ rc.atalk.sysv \
+ rc.atalk.gentoo \
+ rc.atalk.debian
+
+TEMPLATES = \
+ rc.afpd.netbsd.tmpl \
+ rc.atalk.redhat.tmpl \
+ rc.atalk.tru64.tmpl \
+ rc.atalk.bsd.tmpl \
+ rc.atalkd.netbsd.tmpl \
+ rc.atalk.suse.tmpl \
+ rc.cnid_metad.netbsd.tmpl \
+ rc.papd.netbsd.tmpl \
+ rc.timelord.netbsd.tmpl \
+ rc.atalk.sysv.tmpl \
+ rc.atalk.gentoo.tmpl \
+ rc.atalk.debian.tmpl
-sysvdir = /etc/rc.d/init.d
+CLEANFILES = $(GENERATED_FILES) atalk afpd atalkd papd timelord
+EXTRA_DIST = $(TEMPLATES) rc.atalk.cobalt
-CLEANFILES = rc.atalk.redhat atalk
+# overwrite automake uninstall
+# not beautiful, but this way we can call the OS specific init script
+# tools, like chkconfig, insserv or rc-update
+
+uninstall: uninstall-startup
#
# checking for "redhat" style sysv scripts:
if USE_REDHAT
+sysvdir = $(DESTDIR)$(sysconfdir)/rc.d/init.d
sysv_SCRIPTS = atalk
atalk: rc.atalk.redhat
cp -f rc.atalk.redhat atalk
chmod a+x atalk
+install-data-hook:
+ -chkconfig --add atalk
+
+uninstall-startup:
+ -chkconfig --del atalk
+ rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/atalk
+
+endif
+
+#
+# checking for "SuSE" style sysv scripts:
+#
+
+if USE_SUSE
+
+sysvdir = $(DESTDIR)$(sysconfdir)/init.d
+sysv_SCRIPTS = atalk
+
+atalk: rc.atalk.suse
+ cp -f rc.atalk.suse atalk
+ chmod a+x atalk
+
+install-data-hook:
+ -insserv atalk
+
+uninstall-startup:
+ -insserv -d atalk
+ rm -f $(DESTDIR)$(sysconfdir)/init.d/atalk
+
endif
#
if USE_COBALT
+sysvdir = $(DESTDIR)$(sysconfdir)/rc.d/init.d
sysv_SCRIPTS = atalk
atalk: rc.atalk.cobalt
cp -f rc.atalk.cobalt atalk
chmod a+x atalk
+install-data-hook:
+
+uninstall-hook:
+
+uninstall-startup: uninstall-am
+
+endif
+
+#
+# checking for "tru64" style sysv scripts:
+#
+
+if USE_TRU64
+
+sysvdir = $(DESTDIR)$(sysconfdir)/init.d
+sysv_SCRIPTS = atalk
+
+atalk: rc.atalk.tru64
+ cp -f rc.atalk.tru64 atalk
+ chmod a+x atalk
+
+install-data-hook:
+
+uninstall-hook:
+
+uninstall-startup: uninstall-am
+
+endif
+
+#
+# checking for NetBSD init scripts
+#
+
+if USE_NETBSD
+
+sysvdir = $(DESTDIR)$(sysconfdir)/rc.d
+sysv_SCRIPTS = afpd atalkd papd timelord
+
+afpd: rc.afpd.netbsd
+ cp -f $< $@
+
+atalkd: rc.atalkd.netbsd
+ cp -f $< $@
+ chmod a+x $@
+
+papd: rc.papd.netbsd
+ cp -f $< $@
+ chmod a+x $@
+
+timelord: rc.timelord.netbsd
+ cp -f $< $@
+ chmod a+x $@
+
+install-data-hook:
+
+uninstall-hook:
+
+uninstall-startup: uninstall-am
+
+endif
+
+#
+# checking for Solaris init scripts
+#
+
+if USE_SOLARIS
+
+sysvdir = $(DESTDIR)$(sysconfdir)/init.d
+sysv_SCRIPTS = atalk
+
+atalk: rc.atalk.sysv
+ cp -f rc.atalk.sysv $@
+ chmod a+x $@
+
+install-data-hook:
+ rm -f $(DESTDIR)$(sysconfdir)/rc2.d/S90atalk
+ -ln -s ../init.d/atalk $(DESTDIR)$(sysconfdir)/rc2.d/S90atalk
+ rm -f $(DESTDIR)$(sysconfdir)/rc0.d/K04atalk
+ -ln -s ../init.d/atalk $(DESTDIR)$(sysconfdir)/rc0.d/K04atalk
+
+uninstall-startup:
+ rm -f $(DESTDIR)$(sysconfdir)/init.d/atalk \
+ $(DESTDIR)$(sysconfdir)/rc2.d/S90atalk \
+ $(DESTDIR)$(sysconfdir)/rc0.d/K04atalk
+
+endif
+
+#
+# checking for "Gentoo" style sysv scripts:
+#
+
+if USE_GENTOO
+
+sysvdir = $(DESTDIR)$(sysconfdir)/init.d
+sysv_SCRIPTS = atalk
+
+atalk: rc.atalk.gentoo
+ cp -f rc.atalk.gentoo atalk
+ chmod a+x atalk
+
+install-data-hook:
+ -rc-update add atalk default
+
+uninstall-startup:
+ -rc-update del atalk default
+ rm -f $(DESTDIR)$(sysconfdir)/init.d/atalk
+
+endif
+
+#
+# checking for "Debian" style sysv scripts:
+#
+
+if USE_DEBIAN
+
+sysvdir = $(DESTDIR)$(sysconfdir)/init.d
+sysv_SCRIPTS = atalk
+
+atalk: rc.atalk.debian
+ cp -f rc.atalk.debian atalk
+ chmod a+x atalk
+
+install-data-hook:
+ update-rc.d atalk defaults 90 10
+
+uninstall-startup:
+ rm -f $(DESTDIR)$(sysconfdir)/init.d/atalk
+ update-rc.d atalk remove
+
+endif
+
+#
+# defaults, no init scripts installed
+#
+
+if USE_UNDEF
+
+install-data-hook:
+
+uninstall-hook:
+
+uninstall-startup: uninstall-am
+
endif
+