diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-09-11 10:43:59 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-09-11 12:34:23 +0200 |
commit | cfd64ee48420024da9c1ce06e2c2f92a8438cfc1 (patch) | |
tree | a00afc0c5ff9266f07f0c5e5c6b65c4c179e9a9a | |
parent | c7f290e9ddb114765330632ee650b09fc16514df (diff) |
Add Debian packagingdebian/master
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 22 | ||||
-rw-r--r-- | debian/copyright | 42 | ||||
-rw-r--r-- | debian/docs | 1 | ||||
-rw-r--r-- | debian/gbp.conf | 4 | ||||
-rw-r--r-- | debian/libnss-dontstalkme.lintian-overrides | 1 | ||||
-rwxr-xr-x | debian/postinst | 47 | ||||
-rwxr-xr-x | debian/postrm | 44 | ||||
-rwxr-xr-x | debian/rules | 13 | ||||
-rw-r--r-- | debian/source/format | 1 | ||||
-rw-r--r-- | debian/tests/control | 2 | ||||
-rwxr-xr-x | debian/tests/smoke | 6 |
13 files changed, 189 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..0664b18 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +nss-dontstalkme (0.0.1-1~agx0) unstable; urgency=low + + * Initial release + + -- Guido <agx@sigxcpu.org> Thu, 11 Sep 2014 10:43:20 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..2e09b4d --- /dev/null +++ b/debian/control @@ -0,0 +1,22 @@ +Source: nss-dontstalkme +Section: net +Priority: extra +Maintainer: Guido <agx@sigxcpu.org> +Build-Depends: debhelper (>= 9), autotools-dev, + automake, + autoconf, + libtool, +Standards-Version: 3.9.5 +Homepage: https://honk.sigxcpu.org/piki/nss-dontstalkme +Vcs-Git: git://honk.sigxcpu.org/git/nss-dontstalkme.git -b debian/master +Vcs-Browser: https://honk.sigxcpu.org/gitweb/?p=nss-dontstalkme.git + +Package: libnss-dontstalkme +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: nss module to block tracking hosts + nss-dontstalk me is a nsswitch module that maps host lookups of well known web + trackers to localhost so they become uneffective. + . + While other solutions such as browser plugins only target specific + applications this affects the whole system. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..05aa6c7 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,42 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: nss-dontstalkme +Source: https://honk.sigxcpu.org/piki/nss-dontstalkme + +Files: * +Copyright: 2014 Guido Günther <agx@sigxcpu.org> +License: LGPL-2.1 + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + . + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + . + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see + <http://www.gnu.org/licenses/>. + . + On Debian systems, the complete text of the GNU Lesser General Public License + version 2.1 can be found in "/usr/share/common-licenses/LGPL-2.1". + +Files: debian/* +Copyright: 2014 Guido <agx@sigxcpu.org> +License: GPL-2+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/> + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..9678e28 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,4 @@ +[DEFAULT] +debian-branch = debian/master +upstream-tag = v%(version)s +upstream-branch = master diff --git a/debian/libnss-dontstalkme.lintian-overrides b/debian/libnss-dontstalkme.lintian-overrides new file mode 100644 index 0000000..4f97087 --- /dev/null +++ b/debian/libnss-dontstalkme.lintian-overrides @@ -0,0 +1 @@ +libnss-dontstalkme: package-name-doesnt-match-sonames libnss-dontstalkme2 diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..999fa62 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +#DEBHELPER# + +log() { + echo "$*" +} + +# try to insert donststalkme entries to the "hosts" line in /etc/nsswitch.conf to +# automatically enable nss-dontstalkme support; do not change the configuration if the +# "hosts" line already references dontstalkme lookups +insert_dontstalkme() { + log "Checking NSS setup..." + # abort if /etc/nsswitch.conf does not exist + if ! [ -e /etc/nsswitch.conf ]; then + log "Could not find /etc/nsswitch.conf." + return + fi + perl -i -pe ' + sub insert { + # this also splits on tab + my @bits=split(" ", shift); + # do not break configuration if the "hosts" line already references + # dontstalkme + if (grep { $_ eq "dontstalkme" } @bits) { + return join " ", @bits; + } + # change "dns" into "dontstalkme dns" + return join " ", map { + $_ eq "dns" ? ("dontstalkme",$_) : $_ + } @bits; + } + s/^(hosts:\s+)(.*)/$1.insert($2)/e; + ' /etc/nsswitch.conf +} + +action="$1" + +if [ configure = "$action" ]; then + if [ -z "$2" ]; then + log "First installation detected..." + # first install: setup the recommended configuration (unless + # nsswitch.conf already contains dontstalkme entries) + insert_dontstalkme + fi +fi diff --git a/debian/postrm b/debian/postrm new file mode 100755 index 0000000..f7fc630 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,44 @@ +#!/bin/sh +set -e + +#DEBHELPER# + +log() { + echo "libnss-dontstalkme: $*" +} + +remove_dontstalkme() { + log "Checking NSS setup..." + # abort if /etc/nsswitch.conf does not exist + if ! [ -e /etc/nsswitch.conf ]; then + log "Could not find /etc/nsswitch.conf." + return + fi + log "Removing dontstalkm from NSS setup" + perl -i -pe ' + my @remove=( + "dontstalkme", + ); + sub remove { + my $s=shift; + foreach my $bit (@remove) { + $s=~s/\s+\Q$bit\E//g; + } + return $s; + } + s/^(hosts:)(.*)/$1.remove($2)/e; + ' /etc/nsswitch.conf +} + +action="$1" + +if [ "$action" = remove ]; then + # as recommended by + # <https://lists.debian.org/debian-devel/2013/04/msg00656.html> + instances="$(dpkg-query -f '${db:Status-Abbrev} ${binary:Package}\n' -W libnss-dontstalkme | grep -v '^.n' | wc -l)" + if [ "$instances" = 1 ]; then + remove_dontstalkme + else + log "Not removing dontstalkme from nsswitch.conf, $(( $instances - 1 )) architecture(s) still installed" + fi +fi diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..a913053 --- /dev/null +++ b/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +include /usr/share/dpkg/default.mk + +%: + dh $@ --with autotools-dev + +override_dh_auto_configure: + ./autogen.sh + dh_auto_configure -- --prefix=/ + +override_dh_auto_install: + dh_auto_install + rm debian/libnss-dontstalkme/lib/*/*.la diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..4a74508 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,2 @@ +Tests: smoke +Depends: libc-bin, @ diff --git a/debian/tests/smoke b/debian/tests/smoke new file mode 100755 index 0000000..cd2452a --- /dev/null +++ b/debian/tests/smoke @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e +set -x + +getent ahostsv4 foo.google-analytics.com | grep -qs '^127\.0\.2\.1' |