Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
abrt-oops.init | 2 +-
src/plugins/Makefile.am | 3 ++-
src/plugins/abrt-dump-oops.c | 17 ++++++++++++++++-
src/plugins/abrt-oops.service | 2 +-
4 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/abrt-oops.init b/abrt-oops.init
index cb64dac..a9934a9 100644
--- a/abrt-oops.init
+++ b/abrt-oops.init
@@ -34,7 +34,7 @@ check() {
start() {
check
killall abrt-dump-oops 2>/dev/null
- setsid abrt-dump-oops -d /var/spool/abrt -rwx /var/log/messages </dev/null
>/dev/null 2>&1 &
+ setsid abrt-dump-oops -rwxD /var/log/messages </dev/null >/dev/null 2>&1
&
$dry_run || touch -- "$LOCK"
return $RETVAL
}
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 660a38a..11b3bf1 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -111,7 +111,8 @@ abrt_dump_oops_CPPFLAGS = \
-Wall -Wwrite-strings -Werror
abrt_dump_oops_LDADD = \
$(GLIB_LIBS) \
- $(LIBREPORT_LIBS)
+ $(LIBREPORT_LIBS) \
+ ../lib/libabrt.la
abrt_action_analyze_c_SOURCES = \
abrt-action-analyze-c.c
diff --git a/src/plugins/abrt-dump-oops.c b/src/plugins/abrt-dump-oops.c
index b43d507..67cb610 100644
--- a/src/plugins/abrt-dump-oops.c
+++ b/src/plugins/abrt-dump-oops.c
@@ -576,6 +576,7 @@ int main(int argc, char **argv)
/* Can't keep these strings/structs static: _() doesn't support that */
const char *program_usage_string = _(
"\b [-vsrowx] [-d DIR] FILE\n"
+ " or: \b [-vsrowx] -D file\n"
"\n"
"Extract oops from syslog/dmesg file"
);
@@ -587,6 +588,7 @@ int main(int argc, char **argv)
OPT_w = 1 << 4,
OPT_d = 1 << 5,
OPT_x = 1 << 6,
+ OPT_D = 1 << 7,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
@@ -600,10 +602,14 @@ int main(int argc, char **argv)
*/
OPT_STRING('d', NULL, &debug_dumps_dir, "DIR",
_("Create ABRT dump in DIR for every oops found")),
OPT_BOOL( 'x', NULL, NULL, _("Make the dump directory world
readable")),
+ OPT_BOOL( 'D', NULL, NULL, _("Load dynamically DUMP_DIR location
from abrt.conf")),
OPT_END()
};
unsigned opts = parse_opts(argc, argv, program_options, program_usage_string);
+ if ((opts & OPT_d) && (opts & OPT_D))
+ show_usage_and_die(program_usage_string, program_options);
+
export_abrt_envvars(0);
msg_prefix = g_progname;
@@ -713,8 +719,14 @@ int main(int argc, char **argv)
while (i < oops_cnt)
printf("\nVersion: %s", (char*)g_list_nth_data(oops_list,
i++));
}
- if (opts & OPT_d)
+ if ((opts & OPT_d) || (opts & OPT_D))
{
+ if (opts & OPT_D)
+ {
+ load_abrt_conf();
+ debug_dumps_dir = g_settings_dump_location;
+ }
+
log("Creating dump directories");
errors += save_oops_to_dump_dir(oops_list, oops_cnt);
if (errors > 0)
@@ -729,6 +741,9 @@ int main(int argc, char **argv)
"Reported %u kernel oopses to Abrt",
oops_cnt
);
+
+ if (opts & OPT_D)
+ free_abrt_conf_data();
}
}
list_free_with_free(oops_list);
diff --git a/src/plugins/abrt-oops.service b/src/plugins/abrt-oops.service
index 4911e2b..b21e1f0 100644
--- a/src/plugins/abrt-oops.service
+++ b/src/plugins/abrt-oops.service
@@ -3,7 +3,7 @@ Description=ABRT kernel log watcher
After=syslog.target
[Service]
-ExecStart=/usr/bin/abrt-dump-oops -d /var/spool/abrt -rwx /var/log/messages
+ExecStart=/usr/bin/abrt-dump-oops -rwxD /var/log/messages
[Install]
WantedBy=multi-user.target
--
1.7.6.345.g5c2f8