%attr(-,root,root) %{_prefix}/lib/sysctl.d/70-crash-manager.conf
%attr(0750,crash_worker,crash_worker) %{_bindir}/crash-manager
%attr(0750,crash_worker,crash_worker) %{_bindir}/dump_systemstate
-%{_sysconfdir}/dump_systemstate.conf.d/files/files.conf.example
-%{_sysconfdir}/dump_systemstate.conf.d/files/10-crash-worker.conf
-%{_sysconfdir}/dump_systemstate.conf.d/programs/programs.conf.example
-%{_sysconfdir}/dump_systemstate.conf.d/programs/10-crash-worker.conf
+%{_sysconfdir}/dump_systemstate.conf.d/files/*.conf*
+%{_sysconfdir}/dump_systemstate.conf.d/programs/*.conf*
%{_libexecdir}/crash-stack
%{_libexecdir}/crash-popup-launch
%{_libexecdir}/crash-notify-send
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}/files.conf.example
- DESTINATION ${DUMP_SYSTEMSTATE_CONFIG_DIR_PATH}/files
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}/files/10-crash-worker.conf
- DESTINATION ${DUMP_SYSTEMSTATE_CONFIG_DIR_PATH}/files
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}/programs.conf.example
- DESTINATION ${DUMP_SYSTEMSTATE_CONFIG_DIR_PATH}/programs
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/src/${PROJECT_NAME}/programs/10-crash-worker.conf
- DESTINATION ${DUMP_SYSTEMSTATE_CONFIG_DIR_PATH}/programs
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(DIRECTORY files DESTINATION ${DUMP_SYSTEMSTATE_CONFIG_DIR_PATH}
+ PATTERN "files/*.conf*"
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+INSTALL(DIRECTORY programs DESTINATION ${DUMP_SYSTEMSTATE_CONFIG_DIR_PATH}
+ PATTERN "programs/*.conf*"
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
int c, ret, i, dpercent, exit_code = 0;
const char *arg_file = NULL;
int out_fd = -1;
- bool arg_buxton = false;
- bool arg_dlog = false;
- bool arg_dmesg = false;
bool arg_extras = true;
- bool arg_journal = false;
- bool arg_pkgs = false;
char timestr[80];
time_t cur_time;
struct tm gm_tm;
while ((c = getopt_long(argc, argv, "hf:kdbjeEp", long_options, NULL)) != -1) {
switch (c) {
- case 'b':
- arg_buxton = true;
- break;
- case 'd':
- arg_dlog = true;
- break;
- case 'k':
- arg_dmesg = true;
+ case 'b': /* buxton */
+ case 'd': /* dlog */
+ case 'k': /* dmesg */
+ case 'j': /* journal */
+ case 'p': /* pkgs */
+ // Above flags are handled through extra config files
break;
case 'e': // This flag is here for backward compatibility
arg_extras = true;
case 'E':
arg_extras = false;
break;
- case 'j':
- arg_journal = true;
- break;
- case 'p':
- arg_pkgs = true;
- break;
case 'f':
arg_file = optarg;
break;
spawn_wait_checked(du_args, NULL);
}
- fprintf_fd(out_fd, "\n==== System timezone (ls -al /opt/etc/localtime)\n");
- char *ls_args[] = {"/bin/ls", "-al", "/opt/etc/localtime", NULL};
- spawn_wait_checked(ls_args, NULL);
-
- fprintf_fd(out_fd, "\n==== System summary (/usr/bin/top -bcH -n 1)\n");
- char *top_args[] = {"/bin/top", "-bcH", "-n", "1", NULL};
- char *top_env[] = {"COLUMNS=200", NULL};
- spawn_wait_checked(top_args, top_env);
-
- fprintf_fd(out_fd, "\n==== Current processes (/bin/ps auxfw)\n");
- char *ps_args[] = {"/bin/ps", "auxfw", NULL};
- spawn_wait_checked(ps_args, NULL);
-
- fprintf_fd(out_fd, "\n==== System memory statistics (/usr/bin/memps -v)\n");
- char *memps_args[] = {"/bin/memps", "-v", NULL};
- spawn_wait_checked(memps_args, NULL);
-
- if (arg_buxton) {
- fprintf_fd(out_fd, "\n==== System configuration (/usr/bin/buxton2ctl dump memory, system)\n");
- char *get_mem_args[] = {"/bin/buxton2ctl", "dump", "memory", NULL};
- spawn_wait_checked(get_mem_args, NULL);
-
- char *get_sys_args[] = {"/bin/buxton2ctl", "dump", "system", NULL};
- spawn_wait_checked(get_sys_args, NULL);
- }
-
- if (arg_pkgs) {
- fprintf_fd(out_fd, "\n==== Installed packages (/usr/bin/pkgcmd -l)\n");
- char *pkgcmd_args[] = {"/usr/bin/pkgcmd", "-l", "--global", NULL}; // see TODO file
- spawn_wait_checked(pkgcmd_args, NULL);
- }
-
- if (arg_dmesg) {
- fprintf_fd(out_fd, "\n==== Kernel messages (TZ=UTC /bin/dmesg -T)\n");
- char *dmesg_args[] = {"/bin/dmesg", "-T", NULL};
- char *dmesg_env[] = {"TZ=UTC", NULL};
- spawn_wait_checked(dmesg_args, dmesg_env);
- }
-
- if (arg_dlog) {
- fprintf_fd(out_fd, "\n==== Log messages\n");
- char *dlogutil_args[] = {"/bin/dlogutil", "-d", "-v", "threadtime", "-u", "16384", NULL};
- spawn_wait_checked(dlogutil_args, NULL);
- }
-
- if (arg_journal) {
- fprintf_fd(out_fd, "\n==== Journal messages\n");
- char *journalctl_args[] = {"/bin/journalctl", "-b", "-n", "1024", NULL};
- spawn_wait_checked(journalctl_args, NULL);
- }
-
if (arg_extras)
exit_code |= handle_extra_dir(out_fd, DUMP_SYSTEMSTATE_CONFIG_DIR_PROGRAMS_PATH, handle_extra_program, argc, argv);