sys-assert: add option to disable sys-assert 18/43618/2 accepted/tizen_3.0_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable tizen tizen_3.0.m1_mobile tizen_3.0.m1_tv tizen_3.0.m2 accepted/tizen/3.0/common/20161114.110045 accepted/tizen/ivi/20160218.023903 accepted/tizen/mobile/20150713.013053 accepted/tizen/tv/20150713.013104 accepted/tizen/wearable/20150713.013115 submit/tizen/20150711.060122 submit/tizen_3.0_common/20161104.104000 submit/tizen_common/20151015.190624 submit/tizen_common/20151019.135620 submit/tizen_common/20151023.083358 submit/tizen_common/20151026.085049 submit/tizen_ivi/20160217.000000 submit/tizen_ivi/20160217.000003 tizen_3.0.m1_mobile_release tizen_3.0.m1_tv_release tizen_3.0.m2.a1_mobile_release tizen_3.0.m2.a1_tv_release
authorTaeyoung Kim <ty317.kim@samsung.com>
Sat, 11 Jul 2015 04:54:04 +0000 (13:54 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Sat, 11 Jul 2015 05:07:16 +0000 (22:07 -0700)
- Actions of sys-assert
  = sys-assert adds signal handlers for crash signals
    (SIGABRT, SIGSEGV, ...) by /etc/ld.so.preload
  = sys-asserts changes the path of coredump file
    for crash-worker to gather all of crash information

- This commit adds the option 'SYS_ASSERT_ENABLE' and
  sets the value to 'no'. Thus sys-assert is not preloaded,
  and the path of coredump is set (/var/lib/systemd/coredump)
  by systemd

Change-Id: Ia4423fd64380b99c3699216937c16595a77c70a0
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
packaging/sys-assert.spec
sys-assert/CMakeLists.txt

index b9f6618..240e606 100644 (file)
@@ -19,6 +19,8 @@ System Assert.
 %setup -q
 cp %{SOURCE1001} .
 
+%define SYS_ASSERT_ENABLE no
+
 %build
 export CFLAGS+=" -fPIC"
 %ifarch %{arm} aarch64
@@ -26,7 +28,8 @@ export CFLAGS+=" -fPIC"
 %endif
 
 %cmake . -DTZ_SYS_ETC=%{TZ_SYS_ETC} \
-         -DTZ_SYS_SHARE=%{TZ_SYS_SHARE}
+         -DTZ_SYS_SHARE=%{TZ_SYS_SHARE} \
+         -DSYS_ASSERT_ENABLE=%{SYS_ASSERT_ENABLE}
 make %{?_smp_mflags}
 
 %install
@@ -34,6 +37,7 @@ make %{?_smp_mflags}
 mkdir -p %{buildroot}%{TZ_SYS_SHARE}/crash/info
 
 %post
+%if %{?SYS_ASSERT_ENABLE} == yes
 if [ ! -d /.build ]; then
        orig="%{_libdir}/libsys-assert.so"
        pattern=$(echo $orig | sed -e 's|/|\\/|g')
@@ -43,12 +47,15 @@ if [ ! -d /.build ]; then
        fi
        chmod 644 %{_sysconfdir}/ld.so.preload
 fi
+%endif
 /sbin/ldconfig
 
 %postun
+%if %{?SYS_ASSERT_ENABLE} == yes
 orig="%{_libdir}/libsys-assert.so"
 pattern=$(echo $orig | sed -e 's|/|\\/|g')
 sed -i "/${pattern}/D" %{_sysconfdir}/ld.so.preload
+%endif
 /sbin/ldconfig
 
 %files
@@ -58,6 +65,9 @@ sed -i "/${pattern}/D" %{_sysconfdir}/ld.so.preload
 %license LICENSE.APLv2
 %{_bindir}/coredumpctrl.sh
 %{TZ_SYS_ETC}/.debugmode
-/usr/lib/sysctl.d/sys-assert.conf
 %{_libdir}/libsys-assert.so
 
+%if %{?SYS_ASSERT_ENABLE} == yes
+/usr/lib/sysctl.d/sys-assert.conf
+%endif
+
index 020435b..fe4d100 100644 (file)
@@ -40,8 +40,10 @@ ADD_DEFINITIONS("-DDEBUG_ON")
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -ldl)
 
-CONFIGURE_FILE( sysctl.d/sys-assert.conf.in sysctl.d/sys-assert.conf)
-
 INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/.debugmode DESTINATION ${TZ_SYS_ETC})
+
+IF("${SYS_ASSERT_ENABLE}" STREQUAL "yes")
+CONFIGURE_FILE( sysctl.d/sys-assert.conf.in sysctl.d/sys-assert.conf)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/sysctl.d/sys-assert.conf DESTINATION /usr/lib/sysctl.d)
+ENDIF("${SYS_ASSERT_ENABLE}" STREQUAL "yes")