summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--Test.mk1
-rw-r--r--t-triggers/Makefile262
-rw-r--r--t-triggers/pkg-trig-cmd/DEBIAN/control8
-rwxr-xr-xt-triggers/pkg-trig-cmd/DEBIAN/postinst14
-rwxr-xr-xt-triggers/pkg-trig-cmd/DEBIAN/postrm14
-rwxr-xr-xt-triggers/pkg-trig-cmd/DEBIAN/preinst14
-rwxr-xr-xt-triggers/pkg-trig-cmd/DEBIAN/prerm14
-rw-r--r--t-triggers/pkg-trig-explicit/DEBIAN/control8
-rw-r--r--t-triggers/pkg-trig-explicit/DEBIAN/triggers1
-rw-r--r--t-triggers/pkg-trig-file/DEBIAN/control8
-rw-r--r--t-triggers/pkg-trig-file/triggers/a-file1
-rw-r--r--t-triggers/pkg-triggers/DEBIAN/control8
-rwxr-xr-xt-triggers/pkg-triggers/DEBIAN/postinst13
-rw-r--r--t-triggers/pkg-triggers/DEBIAN/triggers2
15 files changed, 369 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 3dded48..aac717e 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,7 @@ TESTS_PASS := \
t-conflict-provide-replace-virtual \
t-conflict-provide-replace-interface \
t-predepends-no-triggers \
+ t-triggers \
t-file-replaces \
t-file-replaces-disappear \
t-conffile-normal \
diff --git a/Test.mk b/Test.mk
index 192059f..774eede 100644
--- a/Test.mk
+++ b/Test.mk
@@ -41,6 +41,7 @@ stderr_has = $(1) 2>&1 1>/dev/null | grep -q "$(2)"
pkg_is_installed = $(call stdout_is,$(PKG_STATUS) $(1),install ok installed)
pkg_is_not_installed = $(call stdout_has,$(PKG_STATUS) $(1) 2>/dev/null, ok not-installed) || ! $(PKG_STATUS) $(1) >/dev/null 2>&1
pkg_status_is = $(call stdout_is,$(PKG_STATUS) $(1),$(2))
+pkg_field_is = $(call stdout_is,$(DPKG_QUERY) -f '$${$(2)}' -W $(1),$(3))
%.deb: %
$(DPKG_BUILD_DEB) $< $@
diff --git a/t-triggers/Makefile b/t-triggers/Makefile
new file mode 100644
index 0000000..c20eeae
--- /dev/null
+++ b/t-triggers/Makefile
@@ -0,0 +1,262 @@
+TESTS_DEB := pkg-triggers pkg-trig-file \
+ pkg-trig-explicit pkg-trig-cmd
+
+include ../Test.mk
+
+TEST_CASES = test-trigger-file \
+ test-trigger-explicit \
+ test-trigger-cmd \
+ test-trigger-noawait-cmd
+
+ifeq ($(DPKG_TESTSUITE_OPTIONS),local-db)
+TEST_CASES += test-internal-db
+endif
+
+test-case: $(TEST_CASES)
+
+test-trigger-file:
+ $(DPKG_UNPACK) pkg-triggers.deb
+ $(BEROOT) rm -f /a-trigger-ok /triggers/ok
+ # When unpacked, triggers are not active
+ $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb
+ $(call pkg_is_installed,pkg-trig-file)
+ $(call pkg_status_is,pkg-triggers,install ok unpacked)
+ $(call pkg_field_is,pkg-triggers,Triggers-Pending,)
+ ! test -f /triggers/ok
+ $(DPKG_CONFIGURE) --no-triggers pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ ! test -f /triggers/ok
+ # When installed, triggers can be activated
+ $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_field_is,pkg-triggers,Triggers-Pending, /triggers)
+ $(call pkg_status_is,pkg-trig-file,install ok triggers-awaited)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ $(call pkg_is_installed,pkg-trig-file)
+ test -f /triggers/ok && $(BEROOT) rm -f /triggers/ok
+ # Try other ways to run the triggers
+ $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-file,install ok triggers-awaited)
+ $(BEROOT) $(DPKG) --triggers-only --pending
+ $(call pkg_is_installed,pkg-trig-file)
+ $(call pkg_is_installed,pkg-triggers)
+ test -f /triggers/ok && $(BEROOT) rm -f /triggers/ok
+ # Again
+ $(DPKG_INSTALL) --no-triggers pkg-trig-file.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-file,install ok triggers-awaited)
+ $(DPKG_CONFIGURE) --pending
+ $(call pkg_is_installed,pkg-trig-file)
+ $(call pkg_is_installed,pkg-triggers)
+ test -f /triggers/ok && $(BEROOT) rm -f /triggers/ok
+ # Again, but we're unpacking instead of installing
+ $(DPKG_UNPACK) --no-triggers pkg-trig-file.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-file,install ok unpacked)
+ $(DPKG_CONFIGURE) pkg-trig-file
+ # XXX: is it normal that the trigger is not run here ?
+ $(call pkg_status_is,pkg-trig-file,install ok triggers-awaited)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_is_installed,pkg-trig-file)
+ $(call pkg_is_installed,pkg-triggers)
+ test -f /triggers/ok && $(BEROOT) rm -f /triggers/ok
+ # Cleanup
+ $(DPKG_PURGE) pkg-triggers
+ $(DPKG_PURGE) pkg-trig-file
+
+test-trigger-explicit:
+ $(DPKG_UNPACK) pkg-triggers.deb
+ $(BEROOT) rm -f /a-trigger-ok /triggers/ok
+ # When unpacked, triggers are not active
+ $(DPKG_INSTALL) --no-triggers pkg-trig-explicit.deb
+ $(call pkg_is_installed,pkg-trig-explicit)
+ $(call pkg_status_is,pkg-triggers,install ok unpacked)
+ $(call pkg_field_is,pkg-triggers,Triggers-Pending,)
+ ! test -f /a-trigger-ok
+ $(DPKG_CONFIGURE) --no-triggers pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ ! test -f /a-trigger-ok
+ # When installed, triggers can be activated
+ $(DPKG_INSTALL) --no-triggers pkg-trig-explicit.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_field_is,pkg-triggers,Triggers-Pending, a-trigger)
+ $(call pkg_status_is,pkg-trig-explicit,install ok triggers-awaited)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ $(call pkg_is_installed,pkg-trig-explicit)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ # Try other ways to run the triggers
+ $(DPKG_INSTALL) --no-triggers pkg-trig-explicit.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-explicit,install ok triggers-awaited)
+ $(BEROOT) $(DPKG) --triggers-only --pending
+ $(call pkg_is_installed,pkg-trig-explicit)
+ $(call pkg_is_installed,pkg-triggers)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ # Again
+ $(DPKG_INSTALL) --no-triggers pkg-trig-explicit.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-explicit,install ok triggers-awaited)
+ $(DPKG_CONFIGURE) --pending
+ $(call pkg_is_installed,pkg-trig-explicit)
+ $(call pkg_is_installed,pkg-triggers)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ # Again, but we're unpacking instead of installing
+ $(DPKG_UNPACK) --no-triggers pkg-trig-explicit.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-explicit,install ok unpacked)
+ $(DPKG_CONFIGURE) pkg-trig-explicit
+ $(call pkg_is_installed,pkg-trig-explicit)
+ $(call pkg_is_installed,pkg-triggers)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ # Verify the trigger is activated on each status change
+ $(DPKG_UNPACK) --no-triggers pkg-trig-explicit.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-explicit,install ok unpacked)
+ $(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited, pkg-triggers)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ $(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited,)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ $(DPKG_CONFIGURE) --no-triggers pkg-trig-explicit
+ $(call pkg_status_is,pkg-trig-explicit,install ok triggers-awaited)
+ $(call pkg_field_is,pkg-trig-explicit,Triggers-Awaited, pkg-triggers)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_is_installed,pkg-trig-explicit)
+ $(call pkg_is_installed,pkg-triggers)
+ # Cleanup
+ $(DPKG_PURGE) pkg-triggers
+ $(DPKG_PURGE) pkg-trig-explicit
+
+test-trigger-cmd:
+ $(DPKG_UNPACK) pkg-triggers.deb
+ $(BEROOT) rm -f /a-trigger-ok /triggers/ok
+ # When unpacked, triggers are not active
+ $(BEROOT) touch /trigger-postinst /trigger-preinst /trigger-postrm /trigger-prerm
+ $(DPKG_INSTALL) --no-triggers pkg-trig-cmd.deb
+ $(call pkg_is_installed,pkg-trig-cmd)
+ $(call pkg_status_is,pkg-triggers,install ok unpacked)
+ $(call pkg_field_is,pkg-triggers,Triggers-Pending,)
+ ! test -f /a-trigger-ok
+ $(DPKG_CONFIGURE) --no-triggers pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ ! test -f /a-trigger-ok
+ # When installed, triggers can be activated
+ $(DPKG_INSTALL) --no-triggers pkg-trig-cmd.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_field_is,pkg-triggers,Triggers-Pending, a-trigger)
+ $(call pkg_status_is,pkg-trig-cmd,install ok triggers-awaited)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ $(call pkg_is_installed,pkg-trig-cmd)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ $(BEROOT) rm -f /trigger-postinst /trigger-preinst /trigger-postrm /trigger-prerm
+ # Call dpkg-trigger in the preinst
+ $(BEROOT) touch /trigger-preinst
+ $(DPKG_UNPACK) --no-triggers pkg-trig-cmd.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-cmd,install ok unpacked)
+ $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited, pkg-triggers)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited,)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ $(BEROOT) rm -f /trigger-preinst
+ # Call dpkg-trigger in the postinst
+ $(BEROOT) touch /trigger-postinst
+ $(DPKG_CONFIGURE) --no-triggers pkg-trig-cmd
+ $(call pkg_status_is,pkg-trig-cmd,install ok triggers-awaited)
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ $(call pkg_is_installed,pkg-trig-cmd)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ $(BEROOT) rm -f /trigger-postinst
+ # Call dpkg-trigger in the prerm
+ $(BEROOT) touch /trigger-prerm
+ $(DPKG_UNPACK) --no-triggers pkg-trig-cmd.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-cmd,install ok unpacked)
+ $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited, pkg-triggers)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited,)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ $(BEROOT) rm -f /trigger-prerm
+ # Call dpkg-trigger in the postrm
+ $(BEROOT) touch /trigger-postrm
+ $(DPKG_UNPACK) --no-triggers pkg-trig-cmd.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-cmd,install ok unpacked)
+ $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited, pkg-triggers)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited,)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ $(BEROOT) rm -f /trigger-postrm
+ # Cleanup
+ $(DPKG_PURGE) pkg-triggers
+ $(DPKG_PURGE) pkg-trig-cmd
+
+test-trigger-noawait-cmd:
+ $(BEROOT) touch /trigger-noawait
+ $(DPKG_UNPACK) pkg-triggers.deb
+ $(BEROOT) rm -f /a-trigger-ok /triggers/ok
+ # When unpacked, triggers are not active
+ $(BEROOT) touch /trigger-postinst /trigger-preinst /trigger-postrm /trigger-prerm
+ $(DPKG_INSTALL) --no-triggers pkg-trig-cmd.deb
+ $(call pkg_is_installed,pkg-trig-cmd)
+ $(call pkg_status_is,pkg-triggers,install ok unpacked)
+ $(call pkg_field_is,pkg-triggers,Triggers-Pending,)
+ ! test -f /a-trigger-ok
+ $(DPKG_CONFIGURE) --no-triggers pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ ! test -f /a-trigger-ok
+ # When installed, triggers can be activated
+ $(DPKG_INSTALL) --no-triggers pkg-trig-cmd.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_field_is,pkg-triggers,Triggers-Pending, a-trigger)
+ $(call pkg_is_installed,pkg-trig-cmd)
+ $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited,)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ $(BEROOT) rm -f /trigger-postinst /trigger-preinst /trigger-postrm /trigger-prerm
+ # Call dpkg-trigger in the preinst
+ $(BEROOT) touch /trigger-preinst
+ $(DPKG_UNPACK) --no-triggers pkg-trig-cmd.deb
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(call pkg_status_is,pkg-trig-cmd,install ok unpacked)
+ $(call pkg_field_is,pkg-trig-cmd,Triggers-Awaited,)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ $(BEROOT) rm -f /trigger-preinst
+ # Call dpkg-trigger in the postinst
+ $(BEROOT) touch /trigger-postinst
+ $(DPKG_CONFIGURE) --no-triggers pkg-trig-cmd
+ $(call pkg_is_installed,pkg-trig-cmd)
+ $(call pkg_status_is,pkg-triggers,install ok triggers-pending)
+ $(BEROOT) $(DPKG) --triggers-only pkg-triggers
+ $(call pkg_is_installed,pkg-triggers)
+ test -f /a-trigger-ok && $(BEROOT) rm -f /a-trigger-ok
+ $(BEROOT) rm -f /trigger-postinst
+ # Cleanup
+ $(BEROOT) rm -f /trigger-noawait
+ $(DPKG_PURGE) pkg-triggers
+ $(DPKG_PURGE) pkg-trig-cmd
+
+test-internal-db:
+ # test that installing triggers creates the corresponding files
+ $(DPKG_INSTALL) pkg-triggers.deb
+ $(call stdout_is,cat $(DPKG_ADMINDIR)/triggers/a-trigger,pkg-triggers)
+ grep -q "^/triggers pkg-triggers$$" $(DPKG_ADMINDIR)/triggers/File
+ # Test that removal cleans up the triggers files
+ $(DPKG_PURGE) pkg-triggers
+ ! test -e $(DPKG_ADMINDIR)/triggers/a-trigger
+ ! test -e $(DPKG_ADMINDIR)/triggers/File
+
+test-clean:
+ $(DPKG_PURGE) pkg-triggers pkg-trig-file pkg-trig-explicit pkg-trig-cmd
+ $(BEROOT) rm -f /a-trigger-ok /triggers/ok
+ $(BEROOT) rm -f /trigger-postinst /trigger-preinst /trigger-postrm /trigger-prerm
+ $(BEROOT) rm -f /trigger-noawait
+
diff --git a/t-triggers/pkg-trig-cmd/DEBIAN/control b/t-triggers/pkg-trig-cmd/DEBIAN/control
new file mode 100644
index 0000000..804dd47
--- /dev/null
+++ b/t-triggers/pkg-trig-cmd/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-trig-cmd
+Version: 0.0-1
+Section: test
+Priority: extra
+Maintainer: Raphaël Hertzog <hertzog@debian.org>
+Architecture: all
+Description: test package - running dpkg-trigger in maintainer scripts
+
diff --git a/t-triggers/pkg-trig-cmd/DEBIAN/postinst b/t-triggers/pkg-trig-cmd/DEBIAN/postinst
new file mode 100755
index 0000000..333cece
--- /dev/null
+++ b/t-triggers/pkg-trig-cmd/DEBIAN/postinst
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+if [ -e /trigger-$DPKG_MAINTSCRIPT_NAME ]; then
+ if [ -e /trigger-noawait ]; then
+ echo "Executing 'dpkg-trigger --no-await a-trigger' from '$0 $1'"
+ dpkg-trigger --no-await a-trigger
+ else
+ echo "Executing 'dpkg-trigger a-trigger' from '$0 $1'"
+ dpkg-trigger a-trigger
+ fi
+fi
+
diff --git a/t-triggers/pkg-trig-cmd/DEBIAN/postrm b/t-triggers/pkg-trig-cmd/DEBIAN/postrm
new file mode 100755
index 0000000..333cece
--- /dev/null
+++ b/t-triggers/pkg-trig-cmd/DEBIAN/postrm
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+if [ -e /trigger-$DPKG_MAINTSCRIPT_NAME ]; then
+ if [ -e /trigger-noawait ]; then
+ echo "Executing 'dpkg-trigger --no-await a-trigger' from '$0 $1'"
+ dpkg-trigger --no-await a-trigger
+ else
+ echo "Executing 'dpkg-trigger a-trigger' from '$0 $1'"
+ dpkg-trigger a-trigger
+ fi
+fi
+
diff --git a/t-triggers/pkg-trig-cmd/DEBIAN/preinst b/t-triggers/pkg-trig-cmd/DEBIAN/preinst
new file mode 100755
index 0000000..333cece
--- /dev/null
+++ b/t-triggers/pkg-trig-cmd/DEBIAN/preinst
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+if [ -e /trigger-$DPKG_MAINTSCRIPT_NAME ]; then
+ if [ -e /trigger-noawait ]; then
+ echo "Executing 'dpkg-trigger --no-await a-trigger' from '$0 $1'"
+ dpkg-trigger --no-await a-trigger
+ else
+ echo "Executing 'dpkg-trigger a-trigger' from '$0 $1'"
+ dpkg-trigger a-trigger
+ fi
+fi
+
diff --git a/t-triggers/pkg-trig-cmd/DEBIAN/prerm b/t-triggers/pkg-trig-cmd/DEBIAN/prerm
new file mode 100755
index 0000000..333cece
--- /dev/null
+++ b/t-triggers/pkg-trig-cmd/DEBIAN/prerm
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+if [ -e /trigger-$DPKG_MAINTSCRIPT_NAME ]; then
+ if [ -e /trigger-noawait ]; then
+ echo "Executing 'dpkg-trigger --no-await a-trigger' from '$0 $1'"
+ dpkg-trigger --no-await a-trigger
+ else
+ echo "Executing 'dpkg-trigger a-trigger' from '$0 $1'"
+ dpkg-trigger a-trigger
+ fi
+fi
+
diff --git a/t-triggers/pkg-trig-explicit/DEBIAN/control b/t-triggers/pkg-trig-explicit/DEBIAN/control
new file mode 100644
index 0000000..9595140
--- /dev/null
+++ b/t-triggers/pkg-trig-explicit/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-trig-explicit
+Version: 0.0-1
+Section: test
+Priority: extra
+Maintainer: Raphaël Hertzog <hertzog@debian.org>
+Architecture: all
+Description: test package - activate trigger "a-trigger"
+
diff --git a/t-triggers/pkg-trig-explicit/DEBIAN/triggers b/t-triggers/pkg-trig-explicit/DEBIAN/triggers
new file mode 100644
index 0000000..cc71459
--- /dev/null
+++ b/t-triggers/pkg-trig-explicit/DEBIAN/triggers
@@ -0,0 +1 @@
+activate a-trigger
diff --git a/t-triggers/pkg-trig-file/DEBIAN/control b/t-triggers/pkg-trig-file/DEBIAN/control
new file mode 100644
index 0000000..4458cfb
--- /dev/null
+++ b/t-triggers/pkg-trig-file/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-trig-file
+Version: 0.0-1
+Section: test
+Priority: extra
+Maintainer: Raphaël Hertzog <hertzog@debian.org>
+Architecture: all
+Description: test package - install a file in /triggers
+
diff --git a/t-triggers/pkg-trig-file/triggers/a-file b/t-triggers/pkg-trig-file/triggers/a-file
new file mode 100644
index 0000000..4dd1ef7
--- /dev/null
+++ b/t-triggers/pkg-trig-file/triggers/a-file
@@ -0,0 +1 @@
+This is a file.
diff --git a/t-triggers/pkg-triggers/DEBIAN/control b/t-triggers/pkg-triggers/DEBIAN/control
new file mode 100644
index 0000000..01f173d
--- /dev/null
+++ b/t-triggers/pkg-triggers/DEBIAN/control
@@ -0,0 +1,8 @@
+Package: pkg-triggers
+Version: 0.0-1
+Section: test
+Priority: extra
+Maintainer: Raphaël Hertzog <hertzog@debian.org>
+Architecture: all
+Description: test package - providing triggers
+
diff --git a/t-triggers/pkg-triggers/DEBIAN/postinst b/t-triggers/pkg-triggers/DEBIAN/postinst
new file mode 100755
index 0000000..8c4c98d
--- /dev/null
+++ b/t-triggers/pkg-triggers/DEBIAN/postinst
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ "$1" = "triggered" ]; then
+ case " $2 " in
+ *" a-trigger "*)
+ touch /a-trigger-ok
+ ;;
+ *" /triggers "*)
+ touch /triggers/ok
+ ;;
+ esac
+fi
+
diff --git a/t-triggers/pkg-triggers/DEBIAN/triggers b/t-triggers/pkg-triggers/DEBIAN/triggers
new file mode 100644
index 0000000..daa582c
--- /dev/null
+++ b/t-triggers/pkg-triggers/DEBIAN/triggers
@@ -0,0 +1,2 @@
+interest a-trigger
+interest /triggers