summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-11-16 23:08:27 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-11-16 23:29:18 +0100
commit4ec24515daa780118709e04cd78dae93f25a8428 (patch)
treeefe4f28261d081632f0c3134b8709b2d363f749b
parent943aad8ca57a6b5c49c4ea60f9e8c13bf9b20e6c (diff)
journal: use $(localstatedir)/lib/systemd/catalog for the catalog
The path doesn't change in the standard configuration. Also, give full path to the journalctl binary in the hook, since it might be installed outside of $PATH. Also, add uninstall hook to remove the binary catalog.
-rw-r--r--Makefile.am16
-rw-r--r--src/journal/catalog.c3
2 files changed, 14 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am
index 7860174e52..f3bda0176b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -63,6 +63,8 @@ bashcompletiondir=$(sysconfdir)/bash_completion.d
rpmmacrosdir=$(sysconfdir)/rpm
sysvinitdir=$(SYSTEM_SYSVINIT_PATH)
varlogdir=$(localstatedir)/log
+systemdstatedir=$(localstatedir)/lib/systemd
+catalogstatedir=$(systemdstatedir)/catalog
# Our own, non-special dirs
pkgsysconfdir=$(sysconfdir)/systemd
@@ -94,6 +96,7 @@ BUILT_SOURCES =
INSTALL_EXEC_HOOKS =
UNINSTALL_EXEC_HOOKS =
INSTALL_DATA_HOOKS =
+UNINSTALL_DATA_HOOKS =
DISTCLEAN_LOCAL_HOOKS =
pkginclude_HEADERS =
noinst_LTLIBRARIES =
@@ -126,6 +129,7 @@ AM_CPPFLAGS = \
-DUSER_CONFIG_FILE=\"$(pkgsysconfdir)/user.conf\" \
-DUSER_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/user\" \
-DUSER_DATA_UNIT_PATH=\"$(userunitdir)\" \
+ -DCATALOG_PATH=\"$(catalogstatedir)\" \
-DSYSTEMD_CGROUP_AGENT_PATH=\"$(rootlibexecdir)/systemd-cgroups-agent\" \
-DSYSTEMD_BINARY_PATH=\"$(rootlibexecdir)/systemd\" \
-DSYSTEMD_SHUTDOWN_BINARY_PATH=\"$(rootlibexecdir)/systemd-shutdown\" \
@@ -2725,11 +2729,17 @@ UNINSTALL_EXEC_HOOKS += \
# Update catalog on installation. Do not bother if installing
# in DESTDIR, since this is likely for packaging purposes.
catalog-update-hook:
- -test -n "$(DESTDIR)" || journalctl --update-catalog
+ -test -n "$(DESTDIR)" || $(rootbindir)/journalctl --update-catalog
INSTALL_DATA_HOOKS += \
catalog-update-hook
+catalog-remove-hook:
+ -test -n "$(DESTDIR)" || rm -f $(catalogstatedir)/database
+
+UNINSTALL_DATA_HOOKS += \
+ catalog-remove-hook
+
noinst_PROGRAMS += \
test-journal \
test-journal-send \
@@ -3596,7 +3606,7 @@ polkitpolicy_files += \
logind-install-data-hook:
$(MKDIR_P) -m 0755 \
$(DESTDIR)$(systemunitdir)/multi-user.target.wants \
- $(DESTDIR)$(localstatedir)/lib/systemd
+ $(DESTDIR)$(systemdstatedir)
( cd $(DESTDIR)$(systemunitdir) && \
rm -f dbus-org.freedesktop.login1.service && \
$(LN_S) systemd-logind.service dbus-org.freedesktop.login1.service)
@@ -4061,7 +4071,7 @@ endif
install-exec-hook: $(INSTALL_EXEC_HOOKS)
-uninstall-hook: $(UNINSTALL_EXEC_HOOKS)
+uninstall-hook: $(UNINSTALL_DATA_HOOKS) $(UNINSTALL_EXEC_HOOKS)
install-data-hook: systemd-install-data-hook $(INSTALL_DATA_HOOKS)
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
index 2812d5970b..3735ad9213 100644
--- a/src/journal/catalog.c
+++ b/src/journal/catalog.c
@@ -269,7 +269,6 @@ static int import_file(Hashmap *h, struct strbuf *sb, const char *path) {
return 0;
}
-#define CATALOG_PATH "/var/lib/systemd/catalog"
#define CATALOG_DATABASE CATALOG_PATH "/database"
int catalog_update(void) {
@@ -414,7 +413,7 @@ static int open_mmap(int *_fd, struct stat *_st, void **_p) {
assert(_st);
assert(_p);
- fd = open("/var/lib/systemd/catalog/database", O_RDONLY|O_CLOEXEC);
+ fd = open(CATALOG_DATABASE, O_RDONLY|O_CLOEXEC);
if (fd < 0)
return -errno;