summaryrefslogtreecommitdiffstats
path: root/debian
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 04:42:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 04:42:34 +0000
commitc5efd282371d5b199d2d96c13ea3334a42161dfb (patch)
treefb8f55cadae3b93ef210a1be5237a7834362e6d4 /debian
parentAdding upstream version 1.7. (diff)
downloaddh-nss-c5efd282371d5b199d2d96c13ea3334a42161dfb.tar.xz
dh-nss-c5efd282371d5b199d2d96c13ea3334a42161dfb.zip
Adding debian version 1.7.debian/1.7debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--debian/changelog89
-rw-r--r--debian/control27
-rw-r--r--debian/copyright36
-rw-r--r--debian/gbp.conf6
-rw-r--r--debian/gitlab-ci.yml6
-rw-r--r--debian/install3
-rw-r--r--debian/manpages1
-rwxr-xr-xdebian/rules8
-rw-r--r--debian/source/format1
-rw-r--r--debian/tests/control13
-rwxr-xr-xdebian/tests/doc-example61
-rwxr-xr-xdebian/tests/doc-example-comments52
-rwxr-xr-xdebian/tests/multiple-pkgs60
-rwxr-xr-xdebian/tests/no-nsswitch-conf26
-rwxr-xr-xdebian/tests/reproducibility49
-rw-r--r--debian/tests/shared-functions.sh96
-rwxr-xr-xdebian/tests/shellcheck36
17 files changed, 570 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..9edee81
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,89 @@
+dh-nss (1.7) unstable; urgency=medium
+
+ * dh_installnss: Add `database-add` and `database-require` to manage
+ non-standard DBs
+ * dh_installnss: Document how to deal with non-standard NSS database
+ (Closes: #1019728)
+ * dh_installnss: Fix perldoc formatting errors
+ * autoscripts/preinst-nss: Remove unused variable substitution
+ * Makefile: Add instructions on how to generate man page
+ * Makefile: Add target to update version in executable
+ * d/gbp.conf: Run `make update-version` in dch postedit hook
+ * d/gbp.conf: Use DEP-14 branch naming
+
+ -- Gioele Barabucci <gioele@svario.it> Tue, 01 Nov 2022 09:24:30 +0100
+
+dh-nss (1.6) unstable; urgency=medium
+
+ * dh_installnss: Do not generate debhelper snippets if .nss contains
+ no directives
+ * dh_installnss: Add new NSS database when `position=database`
+ * dh_installnss: Limit search for installed services to target databases only
+ (Closes: #1018001)
+ * dh_installnss: Streamline generation of regular expressions
+ * dh_installnss: Validate fields of .nss files
+ * autoscripts/postinst-nss: Do not inject services during upgrades
+
+ -- Gioele Barabucci <gioele@svario.it> Wed, 24 Aug 2022 17:30:32 +0200
+
+dh-nss (1.5) unstable; urgency=medium
+
+ * autoscripts/postinst-nss: Fix detection of previous modifications
+ (Closes: #1017101)
+ * autoscripts/postrm-nss: Do not modify comments during service removal
+ * dh_installnss: Fix uniqueness test for service names
+ * d/tests/control: Mark shellcheck test as superficial
+ * d/tests/doc-example-comments: Test also reinstallation
+ * autoscripts/postrm-nss: Match actions in a case-insensitive way
+ * autoscripts/postrm-nss: Use different labels instead of `/g` for
+ replacement loops
+
+ -- Gioele Barabucci <gioele@svario.it> Sun, 14 Aug 2022 03:44:23 +0200
+
+dh-nss (1.4) unstable; urgency=medium
+
+ * autoscripts: Use `grep -q` instead of redirecting stdout
+ * autoscripts/postrm-nss: Properly handle non-purged packages
+ * autoscripts/postinst-nss: Handle reinstallation of non purged packages
+ * d/tests/doc-example: Test package removal and reinstallation
+ * debian/tests: Add shellcheck test for generated maintscripts
+ * t/dh_installnss: Test multiple positions in different order
+ * autoscripts: Assume DPKG_ROOT is set but possibly empty
+
+ -- Gioele Barabucci <gioele@svario.it> Wed, 10 Aug 2022 18:02:07 +0200
+
+dh-nss (1.3) unstable; urgency=medium
+
+ * dh_installnss: Fix order of removal of services in postrm
+ * d/tests: Add test for binary reproducibility
+ * d/gbp.conf: Automatically update version number
+
+ -- Gioele Barabucci <gioele@svario.it> Mon, 08 Aug 2022 10:46:18 +0200
+
+dh-nss (1.2) unstable; urgency=medium
+
+ * dh_installnss: Improve reproducibility of postrm
+
+ -- Gioele Barabucci <gioele@svario.it> Mon, 08 Aug 2022 01:38:43 +0200
+
+dh-nss (1.1) unstable; urgency=medium
+
+ * dh_installnss: Properly handle comments in db lines
+ * autoscripts/postrm-nss: Remove services during `remove` or `purge`
+ * d/control: Add Enhances: debhelper
+ * d/control: Add Perl dependencies
+ * d/control: Mark package as Multi-Arch: foreign
+ * d/copyright: Change license to 0BSD
+ * d/copyright: Mark vendored t/Test/* as GPL-2+
+ * d/gitlab-ci: Add standard CI instructions
+ * d/install: wrap-and-sort -ast
+ * d/tests: Add autopkgtest tests
+ * d/watch: Remove watch for native package
+
+ -- Gioele Barabucci <gioele@svario.it> Sun, 07 Aug 2022 16:37:41 +0200
+
+dh-nss (1) unstable; urgency=medium
+
+ * Initial release (Closes: #1016100)
+
+ -- Gioele Barabucci <gioele@svario.it> Mon, 25 Jul 2022 18:48:27 +0200
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..d1ec101
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,27 @@
+Source: dh-nss
+Section: devel
+Priority: optional
+Maintainer: Gioele Barabucci <gioele@svario.it>
+Rules-Requires-Root: no
+Build-Depends:
+ debhelper-compat (= 13),
+Standards-Version: 4.6.1
+Homepage: https://salsa.debian.org/gioele/dh-nss
+Vcs-Browser: https://salsa.debian.org/gioele/dh-nss
+Vcs-Git: https://salsa.debian.org/gioele/dh-nss.git
+
+Package: dh-nss
+Architecture: all
+Multi-Arch: foreign
+Depends:
+ libdebhelper-perl,
+ ${misc:Depends},
+ ${perl:Depends},
+Enhances:
+ debhelper,
+Provides:
+ dh-sequence-installnss,
+Description: debhelper addon to inject NSS services into /etc/nsswitch.conf
+ The` dh_installnss` debhelper provides a declarative way for NSS-related
+ packages to express how the NSS services they supply should be installed
+ and in which order.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..e6d99de
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,36 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Source: https://salsa.debian.org/gioele/dh-nss
+Upstream-Name: dh-nss
+Upstream-Contact: Gioele Barabucci
+
+Files: *
+Copyright:
+ 2022 Gioele Barabucci
+License: 0BSD
+
+Files: debian/*
+Copyright:
+ 2022 Gioele Barabucci
+License: 0BSD
+
+Files: t/Test/*
+Copyright:
+ 1997-2011 Joey Hess <joeyh@debian.org>
+ 2015-2018 Niels Thykier <niels@thykier.net>
+License: GPL-2+
+
+License: 0BSD
+ Permission to use, copy, modify, and/or distribute this software for
+ any purpose with or without fee is hereby granted.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+License: GPL-2+
+ The full text of the GPL version 2 is distributed in
+ /usr/share/common-licenses/GPL-2 on Debian systems.
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..7a797ad
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,6 @@
+[DEFAULT]
+debian-branch = debian/latest
+debian-tag = v%(version)s
+
+[dch]
+postedit = make update-version
diff --git a/debian/gitlab-ci.yml b/debian/gitlab-ci.yml
new file mode 100644
index 0000000..c03788f
--- /dev/null
+++ b/debian/gitlab-ci.yml
@@ -0,0 +1,6 @@
+include:
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
+ - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
+
+variables:
+ SALSA_CI_LINTIAN_FAIL_WARNING: "true"
diff --git a/debian/install b/debian/install
new file mode 100644
index 0000000..1cc3dfc
--- /dev/null
+++ b/debian/install
@@ -0,0 +1,3 @@
+autoscripts/* usr/share/debhelper/autoscripts
+dh_installnss usr/bin
+installnss.pm usr/share/perl5/Debian/Debhelper/Sequence
diff --git a/debian/manpages b/debian/manpages
new file mode 100644
index 0000000..34ca5aa
--- /dev/null
+++ b/debian/manpages
@@ -0,0 +1 @@
+dh_installnss.1
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..466bd33
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+
+# See debhelper(7) (uncomment to enable).
+# Output every command that modifies files on the build system.
+#export DH_VERBOSE = 1
+
+%:
+ dh $@
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..d7796fe
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,13 @@
+Tests:
+ doc-example,
+ doc-example-comments,
+ multiple-pkgs,
+ no-nsswitch-conf,
+ reproducibility,
+Depends: @, debhelper-compat (= 13), build-essential
+Restrictions: allow-stderr, breaks-testbed, needs-root
+
+Tests:
+ shellcheck,
+Depends: @, debhelper-compat (= 13), build-essential, shellcheck
+Restrictions: allow-stderr, superficial
diff --git a/debian/tests/doc-example b/debian/tests/doc-example
new file mode 100755
index 0000000..184f091
--- /dev/null
+++ b/debian/tests/doc-example
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+set -eu
+
+. "$(dirname "$0")/shared-functions.sh"
+
+testname="$(basename "$0")"
+pkgname="libnss-test-$testname"
+
+nss_lines="
+hosts before=dns mdns4
+hosts before=mdns4 mdns4_minimal [NOTFOUND=return]
+hosts remove-only mdns # In case the user manually added it
+"
+
+expected_services="files mdns4_minimal [NOTFOUND=return] mdns4 dns"
+
+echo "Set up and build test packages..."
+cd "$AUTOPKGTEST_TMP"
+mkdir "$pkgname"
+cd "$pkgname"
+setup_pkg "$pkgname" "$testname"
+build_pkg "$pkgname" "1" "$nss_lines"
+build_pkg "$pkgname" "2" "$nss_lines"
+cd "$AUTOPKGTEST_TMP"
+
+echo "Set up /etc/nsswitch.conf..."
+echo "$NSSWITCH_CONF" > /etc/nsswitch.conf
+check_line "hosts" "files dns"
+
+echo "Test that installing the package installs the services..."
+dpkg --install "${pkgname}_1_all.deb"
+check_line "hosts" "$expected_services"
+
+echo "Test that updating the package does not install the services again..."
+dpkg --install "${pkgname}_2_all.deb"
+check_line "hosts" "$expected_services"
+
+echo "Test that removing the package removes the services..."
+dpkg --remove "$pkgname"
+check_line "hosts" "files dns"
+
+echo "Test that installing the package again reinstalls the services..."
+dpkg --install "${pkgname}_2_all.deb"
+check_line "hosts" "$expected_services"
+
+echo "Test that removing the package again removes the services..."
+dpkg --remove "$pkgname"
+check_line "hosts" "files dns"
+
+echo "Test that reinstalling the package injects the services..."
+dpkg --install "${pkgname}_1_all.deb"
+check_line "hosts" "$expected_services"
+
+echo "Manually remove services from /etc/nsswitch.conf..."
+echo "$NSSWITCH_CONF" > /etc/nsswitch.conf
+check_line "hosts" "files dns"
+
+echo "Test that upgrading the package after modifying nsswitch.conf does not inject the services again..."
+dpkg --install "${pkgname}_2_all.deb"
+check_line "hosts" "files dns"
diff --git a/debian/tests/doc-example-comments b/debian/tests/doc-example-comments
new file mode 100755
index 0000000..fe0351a
--- /dev/null
+++ b/debian/tests/doc-example-comments
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+set -eu
+
+. "$(dirname "$0")/shared-functions.sh"
+
+testname="$(basename "$0")"
+pkgname="libnss-test-$testname"
+
+nss_lines="
+hosts before=dns mdns4
+hosts before=mdns4 mdns4_minimal [NOTFOUND=return]
+hosts remove-only mdns # In case the user manually added it
+"
+
+expected_services="files mdns4_minimal [NOTFOUND=return] mdns4 dns"
+
+comments=" # comment mdns4 dns"
+
+echo "Set up and build test packages..."
+cd "$AUTOPKGTEST_TMP"
+mkdir "$pkgname"
+cd "$pkgname"
+setup_pkg "$pkgname" "$testname"
+build_pkg "$pkgname" "1" "$nss_lines"
+build_pkg "$pkgname" "2" "$nss_lines"
+cd "$AUTOPKGTEST_TMP"
+
+echo "Set up /etc/nsswitch.conf..."
+echo "$NSSWITCH_CONF" > /etc/nsswitch.conf
+sed -E -i /etc/nsswitch.conf -e "/^hosts:/ s/\$/$comments/"
+check_line "hosts" "files dns$comments"
+
+echo "Test that installing the package installs the services..."
+dpkg --install "${pkgname}_1_all.deb"
+check_line "hosts" "$expected_services$comments"
+
+echo "Test that updating the package does not install the services again..."
+dpkg --install "${pkgname}_2_all.deb"
+check_line "hosts" "$expected_services$comments"
+
+echo "Test that removing the package removes the services..."
+dpkg --remove "$pkgname"
+check_line "hosts" "files dns$comments"
+
+echo "Test that installing the package again reinstalls the services..."
+dpkg --install "${pkgname}_2_all.deb"
+check_line "hosts" "$expected_services$comments"
+
+echo "Test that removing the package again removes the services..."
+dpkg --remove "$pkgname"
+check_line "hosts" "files dns$comments"
diff --git a/debian/tests/multiple-pkgs b/debian/tests/multiple-pkgs
new file mode 100755
index 0000000..57ecab7
--- /dev/null
+++ b/debian/tests/multiple-pkgs
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+set -eu
+
+. "$(dirname "$0")/shared-functions.sh"
+
+testname1="$(basename "$0")-a"
+testname2="$(basename "$0")-b"
+pkgname1="libnss-test-$testname1"
+pkgname2="libnss-test-$testname2"
+
+nss_lines1="
+hosts first mynss_a1
+hosts last mynss_a2 [NOTFOUND=return]"
+
+nss_lines2="
+hosts after=mynss_a2 mynss_b1
+hosts before=dns mynss_b2"
+
+
+expected_services_initial="files dns"
+expected_services_after_inst1="mynss_a1 files dns mynss_a2 [NOTFOUND=return]"
+expected_services_after_inst2="mynss_a1 files mynss_b2 dns mynss_a2 [NOTFOUND=return] mynss_b1"
+expected_services_after_rm1="files mynss_b2 dns mynss_b1"
+expected_services_after_rm2="$expected_services_initial"
+
+echo "Set up and build test packages..."
+cd "$AUTOPKGTEST_TMP"
+mkdir "$pkgname1"
+cd "$pkgname1"
+setup_pkg "$pkgname1" "$testname1"
+build_pkg "$pkgname1" "1.1" "$nss_lines1"
+
+cd "$AUTOPKGTEST_TMP"
+mkdir "$pkgname2"
+cd "$pkgname2"
+setup_pkg "$pkgname2" "$testname2"
+build_pkg "$pkgname2" "2.2" "$nss_lines2"
+
+cd "$AUTOPKGTEST_TMP"
+
+echo "Set up /etc/nsswitch.conf..."
+echo "$NSSWITCH_CONF" > /etc/nsswitch.conf
+check_line "hosts" "$expected_services_initial"
+
+echo "Test that installing package A installs the services..."
+dpkg --install "${pkgname1}_1.1_all.deb"
+check_line "hosts" "$expected_services_after_inst1"
+
+echo "Test that installing package B installs the other services..."
+dpkg --install "${pkgname2}_2.2_all.deb"
+check_line "hosts" "$expected_services_after_inst2"
+
+echo "Test that removing package A removes its services..."
+dpkg --remove "$pkgname1"
+check_line "hosts" "$expected_services_after_rm1"
+
+echo "Test that removing package B removes its services..."
+dpkg --remove "$pkgname2"
+check_line "hosts" "$expected_services_after_rm2"
diff --git a/debian/tests/no-nsswitch-conf b/debian/tests/no-nsswitch-conf
new file mode 100755
index 0000000..2d020f3
--- /dev/null
+++ b/debian/tests/no-nsswitch-conf
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -eu
+
+. "$(dirname "$0")/shared-functions.sh"
+
+testname="$(basename "$0")"
+pkgname="libnss-test-$testname"
+
+nss_lines="hosts first mynss"
+
+echo "Set up and build test packages..."
+cd "$AUTOPKGTEST_TMP"
+mkdir "$pkgname"
+cd "$pkgname"
+setup_pkg "$pkgname" "$testname"
+build_pkg "$pkgname" "1" "$nss_lines"
+
+cd "$AUTOPKGTEST_TMP"
+
+echo "Remove /etc/nsswitch.conf..."
+rm /etc/nsswitch.conf
+
+echo "Test that installing the package does not recreate /etc/nsswitch.conf"
+dpkg --install "${pkgname}_1_all.deb"
+test ! -e /etc/nsswitch.conf && echo "OK"
diff --git a/debian/tests/reproducibility b/debian/tests/reproducibility
new file mode 100755
index 0000000..5572054
--- /dev/null
+++ b/debian/tests/reproducibility
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+set -eu
+
+. "$(dirname "$0")/shared-functions.sh"
+
+testname="$(basename "$0")"
+pkgname="libnss-test-$testname"
+
+nss_lines="
+passwd last mynss
+group last mynss
+shadow last mynss
+gshadow last mynss
+"
+
+echo "Enable fr_CH.UTF-8 locale..."
+echo "fr_CH.UTF-8 UTF-8" >> /etc/locale.gen
+locale-gen
+locale -a | grep -q "fr_CH.UTF-8" && echo "OK"
+
+echo "Set up and build test package LC_ALL=C.UTF-8..."
+cd "$AUTOPKGTEST_TMP"
+
+mkdir "$pkgname-c"
+cd "$pkgname-c"
+setup_pkg "$pkgname" "$testname"
+build_pkg "$pkgname" "1" "$nss_lines"
+cd "$AUTOPKGTEST_TMP"
+dpkg-deb -e "${pkgname}_1_all.deb" c
+dpkg-deb -x "${pkgname}_1_all.deb" c
+
+echo "Set up and build test package LC_ALL=fr_CH.UTF-8..."
+cd "$AUTOPKGTEST_TMP"
+
+mkdir "$pkgname-fr"
+cd "$pkgname-fr"
+export LC_ALL="fr_CH.UTF-8"
+export LANGUAGE="fr_CH.UTF-8:fr"
+setup_pkg "$pkgname" "$testname"
+build_pkg "$pkgname" "1" "$nss_lines"
+cd "$AUTOPKGTEST_TMP"
+dpkg-deb -e "${pkgname}_1_all.deb" fr
+dpkg-deb -x "${pkgname}_1_all.deb" fr
+
+echo "Test whether both packages are identical..."
+diff -ur c/ fr/ && echo "OK"
+
+
diff --git a/debian/tests/shared-functions.sh b/debian/tests/shared-functions.sh
new file mode 100644
index 0000000..13797d0
--- /dev/null
+++ b/debian/tests/shared-functions.sh
@@ -0,0 +1,96 @@
+# shellcheck shell=dash
+
+check_line () {
+ local db="$1"
+ local expected_services="$2"
+
+ local expected_line="$db: $expected_services"
+ local new_line
+
+ if ! new_line=$(grep "^$1:" /etc/nsswitch.conf) ; then
+ echo "ERROR: DB $db not found in /etc/nsswitch.conf" >&2
+ exit 2
+ fi
+
+ local num_db_lines
+ num_db_lines="$(echo "$new_line" | wc -l)"
+ if [ "$num_db_lines" -ne 1 ] ; then
+ echo "ERROR: Too many lines for DB $db: $num_db_lines" >&2
+ exit 3
+ fi
+
+ if [ "$new_line" != "$expected_line" ] ; then
+ echo "ERROR: Wrong db line in /etc/nsswitch.conf" >&2
+ echo " found: \`$new_line'" >&2
+ echo "expected: \`$expected_line'" >&2
+ exit 4
+ fi
+
+ echo "OK"
+}
+
+
+setup_pkg () {
+ local pkgname=$1
+ local testname=$2
+
+ mkdir debian
+
+ cat <<EOF > debian/control
+Source: $pkgname
+Section: devel
+Priority: optional
+Maintainer: Test User <test@example.org>
+Rules-Requires-Root: no
+Build-Depends: debhelper-compat (= 13), dh-sequence-installnss
+Standards-Version: 4.6.1
+
+Package: $pkgname
+Architecture: all
+Description: Test package for dh-nss ($testname)
+ Test package for dh-nss ($testname)
+EOF
+
+ cat <<EOF > debian/rules
+#!/usr/bin/make -f
+%:
+ dh \$@
+EOF
+ chmod +x debian/rules
+}
+
+build_pkg () {
+ pkgname="$1"
+ pkgversion="$2"
+ nss_lines="$3"
+
+ echo "$nss_lines" > debian/nss
+
+ cat <<EOF > debian/changelog
+$pkgname ($pkgversion) unstable; urgency=medium
+
+ * Test build
+
+ -- Test User <test@example.org> Sun, 06 Aug 2022 11:22:33 +0200
+EOF
+
+ dpkg-buildpackage --no-sign --build=binary
+}
+
+NSSWITCH_CONF="
+# /etc/nsswitch.conf
+
+passwd: files
+group: files
+shadow: files
+gshadow: files
+
+hosts: files dns
+networks: files
+
+protocols: db files
+services: db files
+ethers: db files
+rpc: db files
+
+netgroup: nis"
diff --git a/debian/tests/shellcheck b/debian/tests/shellcheck
new file mode 100755
index 0000000..e85e422
--- /dev/null
+++ b/debian/tests/shellcheck
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+set -eu
+
+. "$(dirname "$0")/shared-functions.sh"
+
+testname="$(basename "$0")"
+pkgname="libnss-test-$testname"
+
+nss_lines="
+passwd last mynss
+group before=files mynss
+shadow after=files mynss [!SUCCESS=notfound]
+gshadow first mynss [NOTFOUND=return]
+hosts remove-only mynss
+protocols after=db mynss skip-if-present=files
+"
+
+echo "Set up and build test package..."
+cd "$AUTOPKGTEST_TMP"
+mkdir "$pkgname"
+cd "$pkgname"
+setup_pkg "$pkgname" "$testname"
+build_pkg "$pkgname" "1" "$nss_lines"
+
+echo "Extract maintscripts..."
+cd "$AUTOPKGTEST_TMP"
+dpkg-deb -e "${pkgname}_1_all.deb" control
+
+echo "Check for errors and warnings..."
+cd control/
+test -s postinst
+test -s postrm
+shellcheck postinst
+shellcheck postrm
+echo "OK"