Modify eu-strip option to perform strip in post script of rpm package & add option...
[platform/upstream/rpm.git] / tests / rpmconfig.at
index 6bdbf39..91c03ba 100644 (file)
@@ -790,3 +790,56 @@ foo-2.0
 ],
 [])
 AT_CLEANUP
+
+---------
+# Test pre-existing and post-install config ghost survival and erasure
+AT_SETUP([install/upgrade/erase ghost config])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+cf="${RPMTEST}"/etc/my.conf
+rm -rf "${cf}" "${cf}".rpm*
+rm -rf "${TOPDIR}"
+
+for v in 1.0 2.0; do
+    runroot rpmbuild --quiet -bb \
+        --define "ver ${v}" \
+        --define "filetype file" \
+        --define "filedata buster" \
+        --define "fileattr %ghost" \
+          /data/SPECS/configtest.spec
+done
+
+# pre-existing config, install, erase
+test ! -f "${cf}" && echo OK1
+echo "keaton" > "${cf}"
+cat "${cf}"
+runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
+cat "${cf}"
+runroot rpm -e configtest
+cat "${cf}"
+rm -f "${cf}"
+
+# post-install config, upgrade, erase
+runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
+test ! -f "${cf}" && echo OK2
+echo "buster" > "${cf}"
+cat "${cf}"
+runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
+cat "${cf}"
+runroot rpm -e configtest
+cat "${cf}"
+],
+[],
+[OK1
+keaton
+keaton
+keaton
+OK2
+buster
+buster
+buster
+],
+[])
+AT_CLEANUP