1 # "on_off foo" wil turn into "ON" or "OFF"
2 %define on_off() %{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
5 %define _with_logdump on
6 %define _with_livedumper on
11 %bcond_with livedumper
13 # NOTE: To disable coredump set DumpCore=0 in configuration file
16 Summary: Crash-manager
19 Group: Framework/system
20 License: Apache-2.0 and BSD
21 Source0: %{name}-%{version}.tar.gz
22 Source1001: crash-worker.manifest
23 BuildRequires: pkgconfig(dlog)
24 BuildRequires: pkgconfig(libtzplatform-config)
25 BuildRequires: pkgconfig(iniparser)
26 BuildRequires: pkgconfig(capi-system-info)
27 BuildRequires: pkgconfig(glib-2.0)
28 BuildRequires: pkgconfig(rpm)
30 BuildRequires: pkgconfig(pkgmgr-info)
32 BuildRequires: pkgconfig(libunwind-generic)
33 BuildRequires: libelf-devel libelf
34 BuildRequires: libebl-devel libebl
35 BuildRequires: libdw-devel libdw
38 BuildRequires: doxygen
41 %if %{with livedumper}
42 BuildRequires: boost-devel
45 Requires(post): coreutils
51 Requires: %{_sbindir}/minicoredumper
52 Requires: %{_bindir}/buxton2ctl
58 Summary: Crash-manager development package
60 This package provides library and header files.
64 Summary: Documentation package for crash-worker
65 Group: Framework/System
68 This package provides development documentation for crash-worker.
73 Summary: Package with binaries and data for crash-worker tests
76 This package contains installable tests in Bash.
79 %if %{with livedumper}
81 Summary: Livedumper allows to dump core of live process
83 %description livedumper
89 #Path to store logs and coredump files
90 %define crash_root_path %{TZ_SYS_CRASH_ROOT}
91 %define crash_path %{TZ_SYS_CRASH}
92 %define crash_temp %{crash_root_path}/temp
94 #Debug mode path - existence of file at path below mean that core file should be generated
95 %define debugmode_path %{TZ_SYS_ETC}/.debugmode
97 #Path for log_dump module
98 %define crash_all_log %{TZ_SYS_ALLLOGS}
99 %define crash_dump_gen %{TZ_SYS_DUMPGEN}
101 %define upgrade_script_path %{TZ_SYS_RO_SHARE}/upgrade/scripts
106 export CFLAGS+=" -Werror"
108 %ifarch %{arm} aarch64
121 -DCMAKE_INSTALL_PREFIX=%{_prefix} \
122 -DTMP_FILES_DIR=%{_sysconfdir}/tmpfiles.d \
124 -DARCH_BIT=%{ARCH_BIT} \
125 -DDUMP_SYSTEMSTATE_CONFIG_DIR_PATH=%{_sysconfdir}/dump_systemstate.conf.d \
126 -DCRASH_MANAGER_CONFIG_PATH=%{_sysconfdir}/crash-manager.conf \
127 -DCRASH_ROOT_PATH=%{crash_root_path} \
128 -DCRASH_PATH=%{crash_path} \
129 -DCRASH_TEMP=%{crash_temp} \
130 -DDEBUGMODE_PATH=%{debugmode_path} \
131 -DMINICOREDUMPER_BIN_PATH=%{_sbindir}/minicoredumper \
132 -DMINICOREDUMPER_CONFIG_PATH=%{_sysconfdir}/minicoredumper/minicoredumper.cfg.json \
133 -DLIVEDUMPER_BIN_PATH=%{_bindir}/livedumper \
134 -DLOG_DUMP_BIN_PATH=%{_bindir}/log_dump \
135 -DDUMP_SYSTEMSTATE_BIN_PATH=%{_bindir}/dump_systemstate \
136 -DCRASH_STACK_BIN_PATH=%{_libexecdir}/crash-stack \
137 -DCRASH_POPUP_BIN_PATH=%{_libexecdir}/crash-popup-launch \
138 -DCRASH_NOTIFY_BIN_PATH=%{_libexecdir}/crash-notify-send \
139 -DCRASH_TESTS_PATH=%{_libdir}/crash-worker-tests \
140 -DSYS_ASSERT=%{on_off sys_assert} \
141 -DLOG_DUMP=%{on_off logdump} \
142 -DLIVEDUMPER=%{on_off livedumper} \
143 -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \
147 make %{?jobs:-j%jobs}
155 mkdir -p %{buildroot}%{crash_root_path}
156 mkdir -p %{buildroot}%{crash_path}
157 mkdir -p %{buildroot}%{crash_temp}
161 mkdir -p %{buildroot}%{crash_all_log}
162 mkdir -p %{buildroot}%{crash_dump_gen}
163 cp dump_scripts/* %{buildroot}%{crash_dump_gen}
164 chmod 755 %{buildroot}%{crash_dump_gen}/*
168 %if %{with sys_assert}
169 if [ ! -d /.build ]; then
170 orig="%{_libdir}/libsys-assert.so"
171 pattern=$(echo $orig | sed -e 's|/|\\/|g')
172 ret=$(sed -n "/${pattern}/p" %{_sysconfdir}/ld.so.preload)
173 if [ -z "$ret" ]; then
174 echo "%{_libdir}/libsys-assert.so" >> %{_sysconfdir}/ld.so.preload
176 chmod 644 %{_sysconfdir}/ld.so.preload
182 /usr/bin/chsmack -a "System" -t %{crash_path}
183 /usr/bin/chsmack -a "System" -t %{crash_temp}
186 /usr/bin/chsmack -a "System" -t %{crash_dump_gen}
187 /usr/bin/chsmack -a "System" -t %{crash_dump_gen}/module.d
188 /usr/bin/chsmack -a "System::Shared" -t %{crash_all_log}
189 /usr/bin/chsmack -a "_" %{crash_dump_gen}/module.d/*
193 %if %{with sys_assert}
194 orig="%{_libdir}/libsys-assert.so"
195 pattern=$(echo $orig | sed -e 's|/|\\/|g')
196 sed -i "/${pattern}/D" %{_sysconfdir}/ld.so.preload
201 %license LICENSE LICENSE.BSD
202 %manifest crash-worker.manifest
203 %defattr(-,system_fw,system_fw,-)
204 %dir %{crash_root_path}
207 %{_sysconfdir}/crash-manager.conf
208 %attr(-,root,root) %{_prefix}/lib/sysctl.d/70-crash-manager.conf
209 %attr(0750,system_fw,system_fw) %{_bindir}/crash-manager
210 %attr(0750,system_fw,system_fw) %{_bindir}/dump_systemstate
211 %{_sysconfdir}/dump_systemstate.conf.d/files/files.conf.example
212 %{_sysconfdir}/dump_systemstate.conf.d/programs/programs.conf.example
213 %{_libexecdir}/crash-stack
214 %{_libexecdir}/crash-popup-launch
215 %{_libexecdir}/crash-notify-send
216 %{_libdir}/libcrash-manager.so.*
219 %dir %{crash_all_log}
221 %attr(-,root,root) %{_unitdir}/log_dump.service
222 %attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/log_dump.conf
223 %attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.service
224 %attr(0750,system_fw,system_fw) %{_bindir}/log_dump
227 %if %{with sys_assert}
228 %{_libdir}/libsys-assert.so
229 %{_sysconfdir}/tmpfiles.d/sys-assert.conf
233 %attr(-,root,root) %{upgrade_script_path}/500.crash-manager-upgrade.sh
236 %{_includedir}/crash-manager.h
237 %{_libdir}/libcrash-manager.so
238 %{_datadir}/pkgconfig/*.pc
242 %{_datadir}/doc/crash-worker
247 %manifest %{name}.manifest
248 %defattr(-,root,root)
249 %{_libdir}/crash-worker-tests/test1-default-crash
250 %{_libdir}/crash-worker-tests/test1-default-sleep
251 %{_libdir}/crash-worker-tests/test1-default-ill
252 %{_libdir}/crash-worker-tests/test1-custom-crash
253 %{_libdir}/crash-worker-tests/test1-custom-sleep
254 %{_libdir}/crash-worker-tests/test1-custom-ill
255 %{_libdir}/crash-worker-tests/run_tests.sh
256 %{_libdir}/crash-worker-tests/tests_common.sh
257 %{_libdir}/crash-worker-tests/crash_common.sh
261 %if %{with livedumper}
263 %manifest %{name}.manifest
264 %{_bindir}/livedumper