mirror of
https://git.proxmox.com/git/systemd
synced 2026-01-08 20:07:19 +00:00
Add libnss-resolve package
Protect nss removal with a refcount, to not disable nss module until all instances have been removed. Closes: #798905
This commit is contained in:
parent
c31c64bdb9
commit
bd6d88d0eb
3
debian/changelog
vendored
3
debian/changelog
vendored
@ -32,6 +32,9 @@ systemd (227-3) UNRELEASED; urgency=medium
|
||||
* Re-add bits which call SELinux in systemd-user pam service.
|
||||
(Closes: #804565)
|
||||
|
||||
[ Felipe Sateler ]
|
||||
* Add libnss-resolve package. (Closes: #798905)
|
||||
|
||||
-- Martin Pitt <mpitt@debian.org> Tue, 13 Oct 2015 11:03:21 +0200
|
||||
|
||||
systemd (227-2) unstable; urgency=medium
|
||||
|
||||
16
debian/control
vendored
16
debian/control
vendored
@ -204,6 +204,22 @@ Description: nss module to resolve hostnames for local container instances
|
||||
.
|
||||
Installing this package automatically adds mymachines to /etc/nsswitch.conf.
|
||||
|
||||
Package: libnss-resolve
|
||||
Architecture: linux-any
|
||||
Multi-Arch: same
|
||||
Replaces: systemd (<< 227-3)
|
||||
Breaks: systemd (<< 227-3)
|
||||
Section: admin
|
||||
Priority: extra
|
||||
Pre-Depends: ${misc:Pre-Depends}
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, systemd
|
||||
Description: nss module to resolve names via systemd-resolved
|
||||
nss-resolve is a plugin for the GNU Name Service Switch (NSS) functionality
|
||||
of the GNU C Library (glibc) providing DNS and LLMNR resolution to programs via
|
||||
the systemd-resolved daemon (provided in the systemd package).
|
||||
.
|
||||
Installing this package automatically adds resolve to /etc/nsswitch.conf.
|
||||
|
||||
Package: libsystemd0
|
||||
Architecture: linux-any
|
||||
Multi-Arch: same
|
||||
|
||||
3
debian/libnss-resolve.install
vendored
Normal file
3
debian/libnss-resolve.install
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
lib/*/libnss_resolve*.so.*
|
||||
usr/share/man/man8/libnss_resolve.so.2.8
|
||||
usr/share/man/man8/nss-resolve.8
|
||||
42
debian/libnss-resolve.postinst
vendored
Normal file
42
debian/libnss-resolve.postinst
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# This code was taken from libnss-myhostname
|
||||
|
||||
# try to insert resolve entries to the "hosts" line in /etc/nsswitch.conf to
|
||||
# automatically enable libnss-resolve support; do not change the
|
||||
# configuration if the "hosts" line already references some resolve lookups
|
||||
insert_nss_entry() {
|
||||
echo "Checking NSS setup..."
|
||||
# abort if /etc/nsswitch.conf does not exist
|
||||
if ! [ -e /etc/nsswitch.conf ]; then
|
||||
echo "Could not find /etc/nsswitch.conf."
|
||||
return
|
||||
fi
|
||||
perl -i -pe '
|
||||
sub insert {
|
||||
my $line = shift;
|
||||
# this also splits on tab
|
||||
my @bits=split(" ", $line);
|
||||
# do not break configuration if the "hosts" line already references
|
||||
# resolve
|
||||
if (grep { $_ eq "resolve"} @bits) {
|
||||
return $line;
|
||||
}
|
||||
# add resolve before dns
|
||||
return join " ", map {
|
||||
$_ eq "dns" ? ("resolve", "$_") : $_
|
||||
} @bits;
|
||||
}
|
||||
s/^(hosts:\s+)(.*)/$1.insert($2)/e;
|
||||
' /etc/nsswitch.conf
|
||||
}
|
||||
|
||||
if [ "$1" = configure ] && [ -z "$2" ]; then
|
||||
echo "First installation detected..."
|
||||
# first install: setup the recommended configuration (unless
|
||||
# nsswitch.conf already contains resolve entries)
|
||||
insert_nss_entry
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
32
debian/libnss-resolve.postrm
vendored
Normal file
32
debian/libnss-resolve.postrm
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# This code was taken from libnss-myhostname
|
||||
remove_nss_entry() {
|
||||
refcount=$(dpkg-query -f '${db:Status-Abbrev} ${binary:Package}\n' \
|
||||
-W libnss-resolve | grep '^i' | wc -l)
|
||||
if [ "$refcount" -gt 0 ] ; then
|
||||
# there are other instances, do nothing
|
||||
return
|
||||
fi
|
||||
echo "Checking NSS setup..."
|
||||
# abort if /etc/nsswitch.conf does not exist
|
||||
if ! [ -e /etc/nsswitch.conf ]; then
|
||||
echo "Could not find /etc/nsswitch.conf."
|
||||
return
|
||||
fi
|
||||
perl -i -pe '
|
||||
sub remove {
|
||||
my $s=shift;
|
||||
$s=~s/\s+\Qresolve\E//g;
|
||||
return $s;
|
||||
}
|
||||
s/^(hosts:)(.*)/$1.remove($2)/e;
|
||||
' /etc/nsswitch.conf
|
||||
}
|
||||
|
||||
if [ "$1" = remove ]; then
|
||||
remove_nss_entry
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
3
debian/rules
vendored
3
debian/rules
vendored
@ -168,9 +168,6 @@ override_dh_install:
|
||||
ifeq (, $(filter noudeb, $(DEB_BUILD_PROFILES)))
|
||||
dh_install -pudev-udeb -plibudev1-udeb --sourcedir=debian/install/udeb
|
||||
endif
|
||||
# still needs to mature a bit, and packaging
|
||||
rm -f debian/install/*/usr/lib/*/libnss_resolve*
|
||||
|
||||
# fix location of NSS modules
|
||||
cd debian/install/deb/; for f in usr/lib/*/libnss_*; do mv $$f $${f#usr/}; done
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user