Update /etc/ld.so.preload after un-installing the package 07/15007/5
authornravi <nravi.n@samsung.com>
Wed, 15 Jan 2014 04:15:18 +0000 (09:45 +0530)
committernravi <nravi.n@samsung.com>
Mon, 20 Jan 2014 11:19:10 +0000 (16:49 +0530)
Add %postun script to the spec file that removes the entry for libsys-assert.so
from the /etc/ld.so.preload file with the bash script way, using sed

Bug-Tizen: PTREL-11
Change-Id: If3c88b5c42fe9f9b66d208f63d30e8eaacc74d90
Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
packaging/sys-assert.spec

index b20d26db779468791df4df036c66bd72913d4bd1..90d22105638306aac372a7f5db6bab686aa465a2 100644 (file)
@@ -30,22 +30,18 @@ make %{?_smp_mflags}
 %make_install
 mkdir -p %{buildroot}/opt/share/crash/info
 
-%post -p <lua>
---Do not run this script inside the build environemt, it will cause issues.
-if posix.stat("/.build") == nil then
-    if arg[2] == 1 then
-        local f = assert(io.open("%{_sysconfdir}/ld.so.preload", "a"))
-        local t = f:write("%{_libdir}/libsys-assert.so")
-        f:close()
-        posix.chmod("%{_sysconfdir}/ld.so.preload", 644)
-    end
-end
-
+%post
+if [ ! -d /.build ]; then
+       echo "%{_libdir}/libsys-assert.so" >> %{_sysconfdir}/ld.so.preload
+       chmod 644 %{_sysconfdir}/ld.so.preload
+fi
+/sbin/ldconfig
 
 %postun
-# TBD: we need to remove the above, otherwise we will fail on everything
-#that tries to preload that lib
-#
+orig="%{_libdir}/libsys-assert.so"
+pattern=$(echo $orig | sed -e 's|/|\\/|g')
+sed -i "/${pattern}/D" %{_sysconfdir}/ld.so.preload
+/sbin/ldconfig
 
 %files
 %manifest %{name}.manifest