summaryrefslogtreecommitdiffstats
path: root/tests/t-triggers-path
diff options
context:
space:
mode:
Diffstat (limited to 'tests/t-triggers-path')
-rw-r--r--tests/t-triggers-path/Makefile26
-rw-r--r--tests/t-triggers-path/pkg-interest/DEBIAN/control7
-rwxr-xr-xtests/t-triggers-path/pkg-interest/DEBIAN/postinst14
-rw-r--r--tests/t-triggers-path/pkg-interest/DEBIAN/triggers1
-rw-r--r--tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/control7
-rwxr-xr-xtests/t-triggers-path/pkg-trigger-cmd/DEBIAN/postinst5
-rw-r--r--tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/conffiles1
-rw-r--r--tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/control7
-rw-r--r--tests/t-triggers-path/pkg-trigger-conffile/test/trigger/test-file1
9 files changed, 69 insertions, 0 deletions
diff --git a/tests/t-triggers-path/Makefile b/tests/t-triggers-path/Makefile
new file mode 100644
index 0000000..c211204
--- /dev/null
+++ b/tests/t-triggers-path/Makefile
@@ -0,0 +1,26 @@
+TESTS_DEB := pkg-interest pkg-trigger-conffile pkg-trigger-cmd
+
+include ../Test.mk
+
+test-case:
+ $(DPKG_INSTALL) pkg-interest.deb
+
+ # Test that the trigger gets activated on conffile installation
+ $(DPKG_UNPACK) pkg-trigger-conffile.deb
+ test -e "$(DPKG_INSTDIR)/test-triggered-cmd" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/test-triggered-cmd"
+ $(DPKG_CONFIGURE) pkg-trigger-conffile
+ test -e "$(DPKG_INSTDIR)/test-triggered-file" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/test-triggered-file"
+ $(DPKG_PURGE) pkg-trigger-conffile
+
+ # Test that the trigger gets activated on explicit file request
+ $(DPKG_INSTALL) pkg-trigger-cmd.deb
+ test -e "$(DPKG_INSTDIR)/test-triggered-cmd" && $(BEROOT) rm -f "$(DPKG_INSTDIR)/test-triggered-cmd"
+ $(DPKG_PURGE) pkg-trigger-cmd
+
+ # Cleanup.
+ $(DPKG_PURGE) pkg-interest
+
+test-clean:
+ $(BEROOT) rm -f "$(DPKG_INSTDIR)/test-triggered-cmd" "$(DPKG_INSTDIR)/test-triggered-file"
+ -$(DPKG_PURGE) pkg-interest
+ -$(DPKG_PURGE) pkg-trigger-conffile pkg-trigger-cmd
diff --git a/tests/t-triggers-path/pkg-interest/DEBIAN/control b/tests/t-triggers-path/pkg-interest/DEBIAN/control
new file mode 100644
index 0000000..e5a1833
--- /dev/null
+++ b/tests/t-triggers-path/pkg-interest/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-interest
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - interested in files under /test/
diff --git a/tests/t-triggers-path/pkg-interest/DEBIAN/postinst b/tests/t-triggers-path/pkg-interest/DEBIAN/postinst
new file mode 100755
index 0000000..3968b80
--- /dev/null
+++ b/tests/t-triggers-path/pkg-interest/DEBIAN/postinst
@@ -0,0 +1,14 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ triggered)
+ if [ -e "$DPKG_ROOT/test/trigger/test-file" ]; then
+ touch "$DPKG_ROOT/test-triggered-file"
+ else
+ touch "$DPKG_ROOT/test-triggered-cmd"
+ fi
+ ;;
+esac
+
+exit 0
diff --git a/tests/t-triggers-path/pkg-interest/DEBIAN/triggers b/tests/t-triggers-path/pkg-interest/DEBIAN/triggers
new file mode 100644
index 0000000..b88b9d1
--- /dev/null
+++ b/tests/t-triggers-path/pkg-interest/DEBIAN/triggers
@@ -0,0 +1 @@
+interest /test
diff --git a/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/control b/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/control
new file mode 100644
index 0000000..de4f335
--- /dev/null
+++ b/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-trigger-cmd
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - package to be configured
diff --git a/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/postinst b/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/postinst
new file mode 100755
index 0000000..8ee3e60
--- /dev/null
+++ b/tests/t-triggers-path/pkg-trigger-cmd/DEBIAN/postinst
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+dpkg-trigger /test/trigger/trig-cmd
diff --git a/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/conffiles b/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/conffiles
new file mode 100644
index 0000000..2b0ad40
--- /dev/null
+++ b/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/conffiles
@@ -0,0 +1 @@
+/test/trigger/test-file
diff --git a/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/control b/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/control
new file mode 100644
index 0000000..23b2840
--- /dev/null
+++ b/tests/t-triggers-path/pkg-trigger-conffile/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: pkg-trigger-conffile
+Version: 0
+Section: test
+Priority: extra
+Maintainer: Dpkg Developers <debian-dpkg@lists.debian.org>
+Architecture: all
+Description: test package - provides a conffile under /test/trigger/
diff --git a/tests/t-triggers-path/pkg-trigger-conffile/test/trigger/test-file b/tests/t-triggers-path/pkg-trigger-conffile/test/trigger/test-file
new file mode 100644
index 0000000..fb67027
--- /dev/null
+++ b/tests/t-triggers-path/pkg-trigger-conffile/test/trigger/test-file
@@ -0,0 +1 @@
+sample file