dh_installnss - enable NSS services
Contents
Caveats
Non-standardNSSdatabases
Directives in a package.nss file can reference a non-standard NSS database only if that database has been
first declared with a "database-add" or "database-require" directive in the same file.
Non-standard NSS databases are all databases that are not defined in /etc/nsswitch.conf as shipped by the
package base-files.
If a directive references an undeclared non-standard NSS database (e.g., "somedb"), dh_installnss will
exit with the error message "Unknown NSS database 'somedb'".
A non-standard NSS database can be declared by at most one installed package. In other words, if the
directives in the nss files of two packages A and B reference the same non-standard NSS database "somedb"
and both packages can be installed at the same time, one of the following two solutions must be
implemented:
1. Package A supplies the "somedb database-add" directive, package B Pre-Depends on A and uses a "somedb
database-require" directive.
2. The shared package C supplies the "somedb database-add" directive, both package A and B Pre-Depend on
C and use a "somedb database-require" directive.
Description
dh_installnss is a debhelper program that is responsible for injecting NSS (Name Service Switch) services
into /etc/nsswitch.conf.
Examples
An example debian/nss file could look like this:
hosts before=dns mdns4
hosts before=mdns4 mdns4_minimal [NOTFOUND=return]
hosts remove-only mdns # In case the user manually added it
After the installation of this package, the original configuration of the hosts database in
/etc/nsswitch.conf will change from:
hosts: files dns
to:
hosts: files mdns4_minimal [NOTFOUND=return] mdns4 dns
Files
debian/package.nss
Lists the services to inject into /etc/nsswitch.conf when a package is configured and to remove when
a package is removed or purged.
Each line in that file (a directive) should be of the form
dbpositionserviceactioncondition
where the fields contain the following pieces of information:
db The NSS database in which the service will be added. Usually "hosts".
position
Where to add the NSS service.
Possible values are "first", "last", "before=service", "after=service", plus the pseudo-positions
"remove-only", "database-add" and "database-require".
The pseudo-position "remove-only" is used to mark services that are not going to be added during
the installation of the package, but that will be removed during its deinstallation (e.g., legacy
services).
The pseudo-position "database-add" is used to request the addition of a non-standard NSS database
to /etc/nsswitch.conf during the installation of the package and its removal during the
deinstallation of the package. When "database-add" is used, all other fields in the directive
should be left empty.
The pseudo-position "database-require" is used to announce that one or more services in the nss
file will be installed under a non-standard NSS database added by another package. When
"database-require" is used, all other fields in the directive should be left empty.
service
The name of the NSS service to add.
action
Optional action specification "[STATE=ACTION]".
condition
Optional set of conditions to better define when a service should (or should not) be installed.
Only one kind of condition is currently defined: "skip-if-present=service,service,...".
Additionally, text between a "#" character and the end of line is ignored.
Name
dh_installnss - enable NSS services
See Also
debhelper(7)
This program is a debhelper addon.
Synopsis
dh_installnss [debhelperoptions]
