From bc54ae392b9571f7631e911555e2282d4e4a196a Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Tue, 28 Aug 2012 21:26:56 +0100 Subject: [PATCH] Debian packaging fixes. --- debian/changelog | 12 +++++++++++- debian/control | 4 ++-- debian/dnsmasq-base.postinst | 24 ++++++++++++++++++++++++ debian/dnsmasq-base.postrm | 11 +++++++++++ debian/postinst | 27 --------------------------- debian/postrm | 6 ------ debian/rules | 2 ++ 7 files changed, 50 insertions(+), 36 deletions(-) create mode 100644 debian/dnsmasq-base.postinst create mode 100644 debian/dnsmasq-base.postrm diff --git a/debian/changelog b/debian/changelog index a0cb61d..269f1d2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,17 @@ dnsmasq (2.64-1) unstable; urgency=low * New upstream. - -- Simon Kelley Fri, 17 Aug 2012 13:45:15 +0000 + -- Simon Kelley Tue, 28 Aug 2012 16:19:15 +0000 + +dnsmasq (2.63-2) unstable; urgency=low + + * Fix version script to report correct version. + * Unbotch move of dbus config file by using correct versions in + Replaces: and Breaks: lines. (closes: #685204) + * Create dnsmasq user in dnsmasq-base so that Dbus doesn't complain if + only dnsmasq-base is installed. (closes: #685987) + + -- Simon Kelley Tue, 28 Aug 2012 16:18:35 +0000 dnsmasq (2.63-1) unstable; urgency=low diff --git a/debian/control b/debian/control index 343ad7f..c885141 100644 --- a/debian/control +++ b/debian/control @@ -23,8 +23,8 @@ Description: Small caching DNS proxy and DHCP/TFTP server Package: dnsmasq-base Architecture: any Depends: ${shlibs:Depends} -Breaks: dnsmasq (<< 2.62-3) -Replaces: dnsmasq (<< 2.62-3) +Breaks: dnsmasq (<< 2.63-1~) +Replaces: dnsmasq (<< 2.63-1~) Description: Small caching DNS proxy and DHCP/TFTP server This package contains the dnsmasq executable and documentation, but not the infrastructure required to run it as a system daemon. For diff --git a/debian/dnsmasq-base.postinst b/debian/dnsmasq-base.postinst new file mode 100644 index 0000000..4f025ca --- /dev/null +++ b/debian/dnsmasq-base.postinst @@ -0,0 +1,24 @@ +#!/bin/sh +set -e + +# Create the dnsmasq user in dnsmasq-base, so that Dbus doesn't complain. + +# create a user to run as (code stolen from dovecot-common) +if [ "$1" = "configure" ]; then + if [ -z "`id -u dnsmasq 2> /dev/null`" ]; then + adduser --system --home /var/lib/misc --gecos "dnsmasq" \ + --no-create-home --disabled-password \ + --quiet dnsmasq || true + fi + + # Make the directory where we keep the pid file - this + # has to be owned by "dnsmasq" so that the file can be unlinked. + # This is only actually used by the dnsmasq binary package, not + # dnsmasq-base, but it's much easier to create it here so that + # we don't have synchronisation issues with the creation of the + # dnsmasq user. + if [ ! -d /var/run/dnsmasq ]; then + mkdir /var/run/dnsmasq + chown dnsmasq:nogroup /var/run/dnsmasq + fi +fi diff --git a/debian/dnsmasq-base.postrm b/debian/dnsmasq-base.postrm new file mode 100644 index 0000000..950a9ff --- /dev/null +++ b/debian/dnsmasq-base.postrm @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +if [ purge = "$1" ]; then + if [ -x "$(command -v deluser)" ]; then + deluser --quiet --system dnsmasq > /dev/null || true + else + echo >&2 "not removing dnsmasq system account because deluser command was not found" + fi + rm -rf /var/run/dnsmasq +fi diff --git a/debian/postinst b/debian/postinst index 156bb34..98cd5e2 100644 --- a/debian/postinst +++ b/debian/postinst @@ -1,27 +1,6 @@ #!/bin/sh set -e -# create a user to run as (code stolen from dovecot-common) -if [ "$1" = "configure" ]; then - if [ -z "`id -u dnsmasq 2> /dev/null`" ]; then - adduser --system --home /var/lib/misc --gecos "dnsmasq" \ - --no-create-home --disabled-password \ - --quiet dnsmasq || true - fi - - # Make the directory where we keep the pid file - this - # has to be owned by "dnsmasq" do that the file can be unlinked. - if [ ! -d /var/run/dnsmasq ]; then - mkdir /var/run/dnsmasq - chown dnsmasq:nogroup /var/run/dnsmasq - fi - - # handle new location of pidfile during an upgrade - if [ -e /var/run/dnsmasq.pid ]; then - mv /var/run/dnsmasq.pid /var/run/dnsmasq - fi -fi - if [ -x /etc/init.d/dnsmasq ]; then update-rc.d dnsmasq defaults 15 85 >/dev/null @@ -40,10 +19,4 @@ if [ -x /etc/init.d/dnsmasq ]; then fi fi -# dpkg can botch the change of /usr/share/doc/dnsmasq from -# directory to symlink. Fix up here. -if [ ! -h /usr/share/doc/dnsmasq ] && { rmdir /usr/share/doc/dnsmasq; }; then - cd /usr/share/doc/ - ln -s /usr/share/doc/dnsmasq-base dnsmasq -fi diff --git a/debian/postrm b/debian/postrm index 7eacce6..5e48921 100644 --- a/debian/postrm +++ b/debian/postrm @@ -3,10 +3,4 @@ set -e if [ purge = "$1" ]; then update-rc.d dnsmasq remove >/dev/null - if [ -x "$(command -v deluser)" ]; then - deluser --quiet --system dnsmasq > /dev/null || true - else - echo >&2 "not removing dnsmasq system account because deluser command was not found" - fi - rm -rf /var/run/dnsmasq fi diff --git a/debian/rules b/debian/rules index 5d68937..00028c6 100755 --- a/debian/rules +++ b/debian/rules @@ -129,6 +129,8 @@ ifeq (,$(findstring nodocs,$(DEB_BUILD_OPTIONS))) gzip -9 debian/base/usr/share/doc/$(package)/DBus-interface endif install -m 644 debian/dnsmasq-base.conffiles debian/base/DEBIAN/conffiles + install -m 755 debian/dnsmasq-base.postinst debian/base/DEBIAN/postinst + install -m 755 debian/dnsmasq-base.postrm debian/base/DEBIAN/postrm install -m 644 debian/changelog debian/base/usr/share/doc/$(package)/changelog.Debian gzip -9 debian/base/usr/share/doc/$(package)/changelog.Debian install -m 644 debian/readme debian/base/usr/share/doc/$(package)/README.Debian