[collectd] [PATCH] Install types.db into PKGDATADIR instead of PKGLIBDIR.

Sebastian Harl sh at tokkee.org
Fri Oct 10 15:16:37 CEST 2008


The FHS specifies that /usr/share should be used to store architecture
independent data while /usr/lib includes object files, libraries and
architecture dependent data.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 contrib/exec-munin.px        |    2 +-
 contrib/fedora/collectd.spec |    2 +-
 contrib/redhat/collectd.conf |    2 +-
 contrib/redhat/collectd.spec |    4 ++--
 src/Makefile.am              |    2 +-
 src/collectd.conf.in         |    2 +-
 src/configfile.c             |    2 +-
 src/types.db.pod             |    7 ++++---
 8 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/contrib/exec-munin.px b/contrib/exec-munin.px
index 2460956..29d5a55 100755
--- a/contrib/exec-munin.px
+++ b/contrib/exec-munin.px
@@ -60,7 +60,7 @@ the C<nut> plugin above provides C<in> and C<out> which are both voltages, you
 can use a hyphen to add a "type instance" to the type.
 
 For a list of already defined "types" look at the F<types.db> file in
-collectd's library path, e.E<nbsp>g. F</usr/lib/collectd/>.
+collectd's shared data directory, e.E<nbsp>g. F</usr/share/collectd/>.
 
 =item B<Interval> I<Seconds>
 
diff --git a/contrib/fedora/collectd.spec b/contrib/fedora/collectd.spec
index 89ce123..35eb8be 100644
--- a/contrib/fedora/collectd.spec
+++ b/contrib/fedora/collectd.spec
@@ -232,7 +232,7 @@ exit 0
 %attr(0644,root,root) %{_libdir}/%{name}/wireless.so*
 %attr(0644,root,root) %{_libdir}/%{name}/wireless.la
 
-%attr(0644,root,root) %{_libdir}/%{name}/types.db
+%attr(0644,root,root) %{_datadir}/%{name}/types.db
 
 %dir /var/lib/collectd
 
diff --git a/contrib/redhat/collectd.conf b/contrib/redhat/collectd.conf
index 7a026fa..0aaaee3 100644
--- a/contrib/redhat/collectd.conf
+++ b/contrib/redhat/collectd.conf
@@ -9,7 +9,7 @@ FQDNLookup   true
 BaseDir     "/var/lib/collectd"
 PIDFile     "/var/run/collectd.pid"
 PluginDir   "/usr/lib/collectd"
-TypesDB     "/usr/lib/collectd/types.db"
+TypesDB     "/usr/share/collectd/types.db"
 Interval     10
 ReadThreads  5
 
diff --git a/contrib/redhat/collectd.spec b/contrib/redhat/collectd.spec
index bce7647..62acc18 100644
--- a/contrib/redhat/collectd.spec
+++ b/contrib/redhat/collectd.spec
@@ -85,7 +85,7 @@ cp contrib/redhat/collectd.conf $RPM_BUILD_ROOT/etc/collectd.conf
 sed -i 's:#BaseDir     "/usr/var/lib/collectd":BaseDir     "/var/lib/collectd":' $RPM_BUILD_ROOT/etc/collectd.conf
 sed -i 's:#PIDFile     "/usr/var/run/collectd.pid":PIDFile     "/var/run/collectd.pid":' $RPM_BUILD_ROOT/etc/collectd.conf
 sed -i 's:#PluginDir   "/usr/lib/collectd":PluginDir   "/usr/lib/collectd":' $RPM_BUILD_ROOT/etc/collectd.conf
-sed -i 's:#TypesDB     "/usr/lib/collectd/types.db":TypesDB     "/usr/lib/collectd/types.db":' $RPM_BUILD_ROOT/etc/collectd.conf
+sed -i 's:#TypesDB     "/usr/share/collectd/types.db":TypesDB     "/usr/share/collectd/types.db":' $RPM_BUILD_ROOT/etc/collectd.conf
 sed -i 's:#Interval     10:Interval     10:' $RPM_BUILD_ROOT/etc/collectd.conf
 sed -i 's:#ReadThreads  5:ReadThreads  5:' $RPM_BUILD_ROOT/etc/collectd.conf
 ##Move config contribs
@@ -247,7 +247,7 @@ exit 0
 %attr(0644,root,root) %{_libdir}/%{name}/wireless.so*
 %attr(0644,root,root) %{_libdir}/%{name}/wireless.la
 
-%attr(0644,root,root) %{_libdir}/%{name}/types.db
+%attr(0644,root,root) %{_datadir}/%{name}/types.db
 
 %exclude %{_libdir}/perl5/5.8.8/%{_arch}-linux-thread-multi/perllocal.pod
 %attr(0644,root,root) %{_libdir}/perl5/site_perl/5.8.8/Collectd.pm
diff --git a/src/Makefile.am b/src/Makefile.am
index 82ce17d..72546f4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -838,7 +838,7 @@ install-exec-hook:
 	else \
 		$(INSTALL) -m 0640 collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf; \
 	fi; \
-	cp -f $(srcdir)/types.db $(DESTDIR)$(pkglibdir)/;
 	$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
+	$(INSTALL) -m 0644 $(srcdir)/types.db $(DESTDIR)$(pkgdatadir)/types.db;
 	$(INSTALL) -m 0644 $(srcdir)/postgresql_default.conf \
 		$(DESTDIR)$(pkgdatadir)/postgresql_default.conf;
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 53abd3f..e8fe758 100644
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
@@ -9,7 +9,7 @@ FQDNLookup   true
 #BaseDir     "@prefix@/var/lib/@PACKAGE_NAME@"
 #PIDFile     "@prefix@/var/run/@PACKAGE_NAME at .pid"
 #PluginDir   "@prefix@/lib/@PACKAGE_NAME@"
-#TypesDB     "@prefix@/lib/@PACKAGE_NAME@/types.db"
+#TypesDB     "@prefix@/share/@PACKAGE_NAME@/types.db"
 #Interval     10
 #ReadThreads  5
 
diff --git a/src/configfile.c b/src/configfile.c
index 9609086..ca0cafe 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -891,7 +891,7 @@ int cf_read (char *filename)
 
 	/* Read the default types.db if no `TypesDB' option was given. */
 	if (cf_default_typesdb)
-		read_types_list (PLUGINDIR"/types.db");
+		read_types_list (PKGDATADIR"/types.db");
 
 	return (0);
 } /* int cf_read */
diff --git a/src/types.db.pod b/src/types.db.pod
index f0a49f6..11c7f79 100644
--- a/src/types.db.pod
+++ b/src/types.db.pod
@@ -29,9 +29,10 @@ happen. See L<rrdcreate(1)> for more details.
 =head1 FILES
 
 The location of the types.db file is defined by the B<TypesDB> configuration
-option (see L<collectd.conf(5)>). If you want to specify custom data-sets, you
-should do so by using a custom file specified as an additional argument to the
-B<TypesDB> option.
+option (see L<collectd.conf(5)>). It defaults to collectd's shared data
+directory, i.E<nbsp>e. F<I<prefix>/share/collectd/>. If you want to specify
+custom data-sets, you should do so by using a custom file specified as an
+additional argument to the B<TypesDB> option.
 
 =head1 SEE ALSO
 
-- 
1.5.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20081010/79a2385c/attachment.pgp 


More information about the collectd mailing list