# "on_off foo" wil turn into "ON" or "OFF" %define on_off() %{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}} %define _with_tests on %bcond_with doc %bcond_with sys_assert %bcond_with tests # NOTE: To disable coredump set DumpCore=0 in configuration file Name: crash-worker Summary: Crash-manager Version: 5.0.8 Release: 1 Group: Framework/system License: Apache-2.0 and BSD Source0: %{name}-%{version}.tar.gz Source1001: crash-worker.manifest BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(iniparser) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(rpm) BuildRequires: cmake BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(libunwind-generic) BuildRequires: libelf-devel libelf BuildRequires: libebl-devel libebl BuildRequires: libdw-devel libdw %if %{with doc} BuildRequires: doxygen %endif Requires(post): coreutils Requires(post): tar Requires(post): gzip Requires: zip Requires: libelf Requires: libdw Requires: %{_sbindir}/minicoredumper Requires: %{_bindir}/buxton2ctl %description crash-manager %if %{with doc} %package doc Summary: Documentation package for crash-worker Group: Framework/System %description doc This package provides development documentation for crash-worker. %endif %if %{with tests} %package tests Summary: Package with binaries and data for crash-worker tests %description tests This package contains installable tests in Bash. %endif %prep %setup -q #Path to store logs and coredump files %define crash_root_path %{TZ_SYS_CRASH_ROOT} %define crash_path %{TZ_SYS_CRASH} %define crash_temp %{crash_root_path}/temp #Debug mode path - existence of file at path below mean that core file should be generated %define debugmode_path %{TZ_SYS_ETC}/.debugmode #Path for log_dump module %define crash_all_log %{TZ_SYS_ALLLOGS} %define crash_dump_gen %{TZ_SYS_DUMPGEN} %define upgrade_script_path %{TZ_SYS_RO_SHARE}/upgrade/scripts %build cp %{SOURCE1001} . export CFLAGS+=" -Werror" %ifarch %{arm} aarch64 %define ARCH arm %else %define ARCH x86 %endif %ifarch %{arm} %ix86 %define ARCH_BIT 32 %else %define ARCH_BIT 64 %endif %cmake . \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DTMP_FILES_DIR=%{_sysconfdir}/tmpfiles.d \ -DARCH=%{ARCH} \ -DARCH_BIT=%{ARCH_BIT} \ -DCRASH_MANAGER_CONFIG_PATH=%{_sysconfdir}/crash-manager.conf \ -DTZ_SYS_ETC=%{TZ_SYS_ETC} \ -DTZ_SYS_BIN=%{TZ_SYS_BIN} \ -DCRASH_ROOT_PATH=%{crash_root_path} \ -DCRASH_PATH=%{crash_path} \ -DCRASH_TEMP=%{crash_temp} \ -DDEBUGMODE_PATH=%{debugmode_path} \ -DMINICOREDUMPER_BIN_PATH=%{_sbindir}/minicoredumper \ -DMINICOREDUMPER_CONFIG_PATH=%{_sysconfdir}/minicoredumper/minicoredumper.cfg.json \ -DCRASH_STACK_PATH=%{_libexecdir}/crash-stack \ -DCRASH_TESTS_PATH=%{_libdir}/crash-worker-tests \ -DSYS_ASSERT=%{on_off sys_assert} \ -DUPGRADE_SCRIPT_PATH=%{upgrade_script_path} \ make %{?jobs:-j%jobs} %if %{with doc} make doc %endif %install rm -rf %{buildroot} %make_install mkdir -p %{buildroot}%{crash_root_path} mkdir -p %{buildroot}%{crash_path} mkdir -p %{buildroot}%{crash_temp} # log_dump dir mkdir -p %{buildroot}%{crash_all_log} mkdir -p %{buildroot}%{crash_dump_gen} cp dump_scripts/* %{buildroot}%{crash_dump_gen} chmod 755 %{buildroot}%{crash_dump_gen}/* %post %if %{with sys_assert} if [ ! -d /.build ]; then orig="%{_libdir}/libsys-assert.so" pattern=$(echo $orig | sed -e 's|/|\\/|g') ret=$(sed -n "/${pattern}/p" %{_sysconfdir}/ld.so.preload) if [ -z "$ret" ]; then echo "%{_libdir}/libsys-assert.so" >> %{_sysconfdir}/ld.so.preload fi chmod 644 %{_sysconfdir}/ld.so.preload fi /sbin/ldconfig %endif /usr/bin/chsmack -a "System" -t %{crash_path} /usr/bin/chsmack -a "System" -t %{crash_temp} /usr/bin/chsmack -a "System" -t %{crash_dump_gen} /usr/bin/chsmack -a "System" -t %{crash_dump_gen}/module.d /usr/bin/chsmack -a "System::Shared" -t %{crash_all_log} /usr/bin/chsmack -a "_" %{crash_dump_gen}/module.d/* %postun %if %{with sys_assert} orig="%{_libdir}/libsys-assert.so" pattern=$(echo $orig | sed -e 's|/|\\/|g') sed -i "/${pattern}/D" %{_sysconfdir}/ld.so.preload /sbin/ldconfig %endif %files %license LICENSE %manifest crash-worker.manifest %defattr(-,system_fw,system_fw,-) %dir %{crash_root_path} %dir %{crash_path} %dir %{crash_temp} %dir %{crash_all_log} %{crash_dump_gen}/* %attr(0750,system_fw,system_fw) %{_bindir}/* %{_unitdir}/log_dump.service %{_sysconfdir}/crash-manager.conf %attr(-,root,root) %{_sysconfdir}/dbus-1/system.d/log_dump.conf %attr(-,root,root) %{_prefix}/lib/sysctl.d/99-crash-manager.conf %attr(-,root,root) %{_datadir}/dbus-1/system-services/org.tizen.system.crash.service %{_libexecdir}/crash-stack %if %{with sys_assert} %{_libdir}/libsys-assert.so %{_sysconfdir}/tmpfiles.d/sys-assert.conf %endif #upgrade script %attr(-,root,root) %{upgrade_script_path}/500.crash-manager-upgrade.sh %if %{with doc} %files doc %{_datadir}/doc/crash-worker %endif %if %{with tests} %files tests %manifest %{name}.manifest %defattr(-,root,root) %{_libdir}/crash-worker-tests/test1-default-crash %{_libdir}/crash-worker-tests/test1-default-sleep %{_libdir}/crash-worker-tests/test1-default-ill %{_libdir}/crash-worker-tests/test1-custom-crash %{_libdir}/crash-worker-tests/test1-custom-sleep %{_libdir}/crash-worker-tests/test1-custom-ill %{_libdir}/crash-worker-tests/run_tests.sh %{_libdir}/crash-worker-tests/tests_common.sh %{_libdir}/crash-worker-tests/crash_common.sh %endif