summaryrefslogtreecommitdiffstats
path: root/tests/t-conffile-obsolete
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/t-conffile-obsolete/Makefile42
-rw-r--r--tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/conffiles1
-rw-r--r--tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/control8
-rw-r--r--tests/t-conffile-obsolete/pkg-conff-obsolete-0/test-conffile1
-rw-r--r--tests/t-conffile-obsolete/pkg-conff-obsolete-1/DEBIAN/control8
-rw-r--r--tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/control8
-rwxr-xr-xtests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postinst4
-rwxr-xr-xtests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postrm4
-rwxr-xr-xtests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/preinst9
9 files changed, 85 insertions, 0 deletions
diff --git a/tests/t-conffile-obsolete/Makefile b/tests/t-conffile-obsolete/Makefile
new file mode 100644
index 0000000..55d9477
--- /dev/null
+++ b/tests/t-conffile-obsolete/Makefile
@@ -0,0 +1,42 @@
+TESTS_DEB := pkg-conff-obsolete-0 pkg-conff-obsolete-1 pkg-conff-obsolete-2
+
+include ../Test.mk
+
+test-case:
+ $(DPKG_INSTALL) pkg-conff-obsolete-0.deb
+ $(DPKG_INSTALL) pkg-conff-obsolete-1.deb
+ test -f '$(DPKG_INSTDIR)/test-conffile'
+ $(DPKG_PURGE) pkg-conff-obsolete
+ test ! -f '$(DPKG_INSTDIR)/test-conffile'
+ # Unmodified conffile is autoremoved for the user
+ $(DPKG_INSTALL) pkg-conff-obsolete-0.deb
+ $(DPKG_UNPACK) pkg-conff-obsolete-2.deb
+ test -f '$(DPKG_INSTDIR)/test-conffile.dpkg-remove'
+ test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-backup'
+ $(DPKG_CONFIGURE) pkg-conff-obsolete
+ test ! -f '$(DPKG_INSTDIR)/test-conffile'
+ test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-bak'
+ test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-backup'
+ test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-remove'
+ $(DPKG_PURGE) pkg-conff-obsolete
+ # Modified conffile is moved away in .dpkg-bak for the user
+ $(DPKG_INSTALL) pkg-conff-obsolete-0.deb
+ $(BEROOT) sh -c "echo foo >>'$(DPKG_INSTDIR)/test-conffile'"
+ $(DPKG_INSTALL) pkg-conff-obsolete-2.deb
+ test ! -f '$(DPKG_INSTDIR)/test-conffile'
+ test -f '$(DPKG_INSTDIR)/test-conffile.dpkg-bak'
+ $(DPKG_PURGE) pkg-conff-obsolete
+ test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-bak'
+ # Abort-upgrade restores the to-be-removed conffile
+ $(DPKG_INSTALL) pkg-conff-obsolete-0.deb
+ $(BEROOT) touch '$(DPKG_INSTDIR)/fail-preinst'
+ $(DPKG_INSTALL) pkg-conff-obsolete-2.deb || true
+ $(BEROOT) rm -f '$(DPKG_INSTDIR)/fail-preinst'
+ test -f '$(DPKG_INSTDIR)/test-conffile'
+ test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-remove'
+ test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-bak'
+ test ! -f '$(DPKG_INSTDIR)/test-conffile.dpkg-backup'
+
+test-clean:
+ $(DPKG_PURGE) pkg-conff-obsolete
+
diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/conffiles b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/conffiles
new file mode 100644
index 0000000..4fad7e9
--- /dev/null
+++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/conffiles
@@ -0,0 +1 @@
+/test-conffile
diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/control b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/control
new file mode 100644
index 0000000..664592c
--- /dev/null
+++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-conff-obsolete
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - conffile obsolete
+
diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-0/test-conffile b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/test-conffile
new file mode 100644
index 0000000..6fbc8b5
--- /dev/null
+++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-0/test-conffile
@@ -0,0 +1 @@
+test init
diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-1/DEBIAN/control b/tests/t-conffile-obsolete/pkg-conff-obsolete-1/DEBIAN/control
new file mode 100644
index 0000000..b7e111e
--- /dev/null
+++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-1/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-conff-obsolete
+Version: 1
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - conffile obsolete
+
diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/control b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/control
new file mode 100644
index 0000000..b7e111e
--- /dev/null
+++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-conff-obsolete
+Version: 1
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - conffile obsolete
+
diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postinst b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postinst
new file mode 100755
index 0000000..c6b0782
--- /dev/null
+++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postinst
@@ -0,0 +1,4 @@
+#!/bin/sh
+if dpkg-maintscript-helper supports rm_conffile; then
+ dpkg-maintscript-helper rm_conffile /test-conffile 0 -- "$@"
+fi
diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postrm b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postrm
new file mode 100755
index 0000000..c6b0782
--- /dev/null
+++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/postrm
@@ -0,0 +1,4 @@
+#!/bin/sh
+if dpkg-maintscript-helper supports rm_conffile; then
+ dpkg-maintscript-helper rm_conffile /test-conffile 0 -- "$@"
+fi
diff --git a/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/preinst b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/preinst
new file mode 100755
index 0000000..c0e592b
--- /dev/null
+++ b/tests/t-conffile-obsolete/pkg-conff-obsolete-2/DEBIAN/preinst
@@ -0,0 +1,9 @@
+#!/bin/sh
+if dpkg-maintscript-helper supports rm_conffile; then
+ dpkg-maintscript-helper rm_conffile /test-conffile 0 -- "$@"
+fi
+
+if [ -e "$DPKG_ROOT/fail-preinst" ]; then
+ exit 1
+fi
+