Fix %postun being called on the end of package upgrade/reinstall making tests fail 85/319685/2
authorKrzysztof Malysa <k.malysa@samsung.com>
Fri, 14 Feb 2025 13:02:18 +0000 (14:02 +0100)
committerKrzysztof Małysa <k.malysa@samsung.com>
Fri, 14 Feb 2025 13:04:12 +0000 (13:04 +0000)
Change-Id: Id3796fbfbdd43f1e5a1dd46b42ba9546f3ef68cb

packaging/security-tests.spec

index f140987099d5fa6db63f5d4ea1dcb0a5bfd38cb0..354097e9e334560164dd42dd37e9ccb620f4816a 100644 (file)
@@ -144,4 +144,8 @@ echo "security-tests postinst done ..."
 %{sm_test_dir}
 
 %postun
-id -u security_test_user 1>/dev/null 2>&1 && gum-utils -o -d --uid=`id -u security_test_user`
+# RPM has irrational order of calling %postun during upgrade and reinstallation: first it installs
+# new version, then it uninstalls old version and calls %postun, hence the below if...
+if [ $1 = 0 ]; then
+        id -u security_test_user 1>/dev/null 2>&1 && gum-utils -o -d --uid=`id -u security_test_user`
+fi