From 7afb9bcb18e31d5188aa29adc08c59cb13602c34 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Thu, 7 Dec 2006 12:18:20 +0000 Subject: initial step to get working Debian packaging git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@142 ef36b2f9-881f-0410-afb5-c4e39611909c --- debian/README.Debian | 2 +- debian/changelog | 6 ++ debian/control | 11 +-- debian/libnss-ldap.dirs | 2 - debian/libnss-ldap.init | 12 --- debian/libnss-ldap.install | 7 -- debian/libnss-ldap.links | 1 - debian/libnss-ldap.postinst | 185 ------------------------------------------- debian/libnss-ldap.postrm | 12 --- debian/libnss-ldapd.docs | 4 + debian/libnss-ldapd.postinst | 185 +++++++++++++++++++++++++++++++++++++++++++ debian/libnss-ldapd.postrm | 12 +++ debian/rules | 99 +++++++++++++++++++---- 13 files changed, 299 insertions(+), 239 deletions(-) delete mode 100644 debian/libnss-ldap.dirs delete mode 100644 debian/libnss-ldap.init delete mode 100644 debian/libnss-ldap.install delete mode 100644 debian/libnss-ldap.links delete mode 100644 debian/libnss-ldap.postinst delete mode 100644 debian/libnss-ldap.postrm create mode 100644 debian/libnss-ldapd.docs create mode 100644 debian/libnss-ldapd.postinst create mode 100644 debian/libnss-ldapd.postrm (limited to 'debian') diff --git a/debian/README.Debian b/debian/README.Debian index 18b11e0..dc9a0fc 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -4,7 +4,7 @@ libnss-ldap for Debian This package was compiled against OpenLDAP and provides an excellent way of merging LDAP into an NIS network. An example for /etc/nsswitch.conf is installed in -/usr/share/doc/libnss-ldap/examples/nsswitch.ldap. +/usr/share/doc/libnss-ldapd/examples/nsswitch.ldap. -- Configuration files -- diff --git a/debian/changelog b/debian/changelog index 7886d1e..4e9475c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libnss-ldapd (0.1.0) unstable; urgency=low + + * This is a fork from the libnss-ldap package. + + -- Arthur de Jong Thu, 7 Dec 2006 12:04:11 +0100 + libnss-ldap (251-5.2) unstable; urgency=high * Non-maintainer upload. diff --git a/debian/control b/debian/control index 2d73326..e8ef071 100644 --- a/debian/control +++ b/debian/control @@ -1,19 +1,20 @@ -Source: libnss-ldap +Source: libnss-ldapd Section: net Priority: extra -Maintainer: Stephen Frost +Maintainer: Arthur de Jong Standards-Version: 3.5.9.0 -Build-Depends: cdbs, debhelper (>= 4.1.13), libkrb5-dev, libldap2-dev, libsasl2-dev, autoconf, automake1.9, po-debconf (>= 0.5.0) +Build-Depends: cdbs, debhelper (>= 4.1.13), libkrb5-dev, libldap2-dev, libsasl2-dev, po-debconf (>= 0.5.0) -Package: libnss-ldap +Package: libnss-ldapd Architecture: any Depends: ${shlibs:Depends}, debconf | debconf-2.0 Recommends: nscd, libpam-ldap +Conflicts: libnss-ldap Description: NSS module for using LDAP as a naming service This package provides a Name Service Switch that allows your LDAP server act as a name service. This means providing user account information, group id's, host information, aliases, netgroups, and basically anything else that you would normally get from /etc flat files or NIS. . - If used with glibc 2.1's nscd (Name Service Cache Daemon) it will help + If used with glibc's nscd (Name Service Cache Daemon) it will help reduce your network traffic and speed up lookups for entries. diff --git a/debian/libnss-ldap.dirs b/debian/libnss-ldap.dirs deleted file mode 100644 index a46f92d..0000000 --- a/debian/libnss-ldap.dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/share/libnss-ldap -usr/share/doc/libnss-ldap diff --git a/debian/libnss-ldap.init b/debian/libnss-ldap.init deleted file mode 100644 index 36c41ee..0000000 --- a/debian/libnss-ldap.init +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh - -case "$1" in - start|restart|force-reload) - touch /lib/init/rw/libnss-ldap.bind_policy_soft ;; - stop) - rm -f /lib/init/rw/libnss-ldap.bind_policy_soft ;; - *) - echo "Usage: $0 {start|stop|restart|force-reload}" - exit 1 - ;; -esac diff --git a/debian/libnss-ldap.install b/debian/libnss-ldap.install deleted file mode 100644 index 51d0be1..0000000 --- a/debian/libnss-ldap.install +++ /dev/null @@ -1,7 +0,0 @@ -debian/tmp/usr/lib/* lib -nss_ldap.5 usr/share/man/man5 -ldap.conf usr/share/libnss-ldap -debian/examples usr/share/doc/libnss-ldap -ldap.conf usr/share/doc/libnss-ldap/examples -nsswitch.ldap usr/share/doc/libnss-ldap/examples -debian/LDAP-Permissions.txt usr/share/doc/libnss-ldap diff --git a/debian/libnss-ldap.links b/debian/libnss-ldap.links deleted file mode 100644 index edb7ba2..0000000 --- a/debian/libnss-ldap.links +++ /dev/null @@ -1 +0,0 @@ -/lib/libnss_ldap.so.2 usr/lib/libnss_ldap.so diff --git a/debian/libnss-ldap.postinst b/debian/libnss-ldap.postinst deleted file mode 100644 index 25f55e6..0000000 --- a/debian/libnss-ldap.postinst +++ /dev/null @@ -1,185 +0,0 @@ -#!/bin/sh -e - -PACKAGE=libnss-ldap -CONFFILE="/etc/libnss-ldap.conf" -PASSWDFILE="/etc/libnss-ldap.secret" - -add_missing() -{ - # FIXME: it would be nice to get the prototype from a template. - - parameter=$1 - value=$2 - echo "$parameter $value" >> $CONFFILE -} - -change_value() -{ - parameter=$1 - value=$2 - commented=0 ; notthere=0 - - egrep -i -q "^$parameter " $CONFFILE || notthere=1 - if [ "$notthere" = "1" ]; then - if ( egrep -i -q "^# *$parameter" $CONFFILE ); then - notthere=0 - commented=1 - fi - fi - - if [ "$notthere" = "1" ]; then - add_missing $parameter $value - else - replacestring="^$parameter .*" - if [ "$commented" = "1" ]; then - replacestring="^# *$parameter .*" - fi - # i really need a better way to do this... - # currently we replace only the first match, we need a better - # way of dealing with multiple hits. - value=$value parameter=$parameter perl -i -p -e 's/^# *\Q$ENV{"parameter"}\E .*/$ENV{"parameter"} $ENV{"value"}/i - and $match=1 unless ($match)' $CONFFILE - fi -} - -disable_param() -{ - parameter=$1 - enabled=0 - egrep -q "^$parameter " $CONFFILE && enabled=1 - if [ "$enabled" = "1" ]; then - perl -i -p -e "s/^($parameter .*)/#\$1/i" $CONFFILE - fi -} - -# Real functions begin here. -case "$1" in - configure) - # ok, lets get to business.. - . /usr/share/debconf/confmodule - - # lets create the configuration from example if it's not there. - examplefile=/usr/share/$PACKAGE/ldap.conf - if [ ! -e $CONFFILE -a -e $examplefile ]; then - cat > $CONFFILE << EOM -###DEBCONF### -# the configuration of this file will be done by debconf as long as the -# first line of the file says '###DEBCONF###' -# -# you should use dpkg-reconfigure libnss-ldap to configure this file. -# -EOM - cat $examplefile >> $CONFFILE - chmod 0644 $CONFFILE - db_set libnss-ldap/override true - fi - - db_get libnss-ldap/override - if [ "$RET" = "true" ]; then - if ( head -1 $CONFFILE | grep -q -v '^###DEBCONF###$' ); then - mv $CONFFILE $CONFFILE.tmp - cat > $CONFFILE << EOM -###DEBCONF### -EOM - cat $CONFFILE.tmp >> $CONFFILE - rm -f $CONFFILE.tmp - chmod 0644 $CONFFILE - fi - - db_get shared/ldapns/ldap-server - if echo $RET | egrep -q '^ldaps?://'; then - disable_param host - change_value uri "$RET" - else - disable_param uri - change_value host "$RET" - fi - - db_get shared/ldapns/base-dn - change_value base "$RET" - - db_get shared/ldapns/ldap_version - change_value ldap_version "$RET" - - db_get libnss-ldap/dbrootlogin - if [ "$RET" = "true" ]; then - # user wants to log in to the database, so be it. - db_get libnss-ldap/rootbinddn - change_value rootbinddn "$RET" - - db_get libnss-ldap/rootbindpw - if [ "$RET" != "" ]; then - rm -f $PASSWDFILE - echo $RET > $PASSWDFILE - chmod 0600 $PASSWDFILE - db_set libnss-ldap/rootbindpw '' - fi - else - # ok, so the user refused to use this feature, better make - # sure it's really off. - disable_param rootbinddn - rm -f $PASSWDFILE - fi - - db_get libnss-ldap/dblogin - if [ "$RET" = "true" ]; then - # user wants to log in to the database, so be it. - db_get libnss-ldap/binddn - change_value binddn "$RET" - - db_get libnss-ldap/bindpw - if [ "$RET" != "" ]; then - change_value bindpw "$RET" - db_set libnss-ldap/bindpw '' - fi - else - # once again, user didn't.. lets make sure we dont. - disable_param binddn - disable_param bindpw - fi - - db_get libnss-ldap/confperm - if [ "$RET" = "true" ]; then - # FIXME: we need a way to check if the file - # was 0700 and we removed the flag. - chmod 0600 $CONFFILE - else - # ICK! ugly hack, but i didn't get anything - # better to work. - find $CONFFILE -perm 0600 -exec chmod 0644 {} \; - fi - fi - db_stop - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - exit 0 - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -if [ -e /etc/ldap.secret -a ! -e /etc/libnss-ldap.secret ]; then - cp -p /etc/ldap.secret /etc/libnss-ldap.secret -fi - -if [ -s /usr/sbin/nscd ]; then - if [ `pidof -s nscd` ]; then - if which invoke-rc.d >/dev/null 2>&1; then - invoke-rc.d nscd restart - else - /etc/init.d/nscd restart - fi - fi -fi - -# This directory was used earlier, and should no longer have any -# function (we use /lib/init/rw instead). -if [ -d /var/lib/libnss-ldap ]; then - rm -rf /var/lib/libnss-ldap -fi - -#DEBHELPER# diff --git a/debian/libnss-ldap.postrm b/debian/libnss-ldap.postrm deleted file mode 100644 index 204289b..0000000 --- a/debian/libnss-ldap.postrm +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -CONFFILE="/etc/libnss-ldap.conf" -PASSWDFILE="/etc/libnss-ldap.secret" - -action=$1 - -if [ "$action" = "purge" ]; then - rm -f $CONFFILE $PASSWDFILE -fi - -#DEBHELPER# diff --git a/debian/libnss-ldapd.docs b/debian/libnss-ldapd.docs new file mode 100644 index 0000000..f9a53d8 --- /dev/null +++ b/debian/libnss-ldapd.docs @@ -0,0 +1,4 @@ +debian/LDAP-Permissions.txt +README +AUTHORS +NEWS diff --git a/debian/libnss-ldapd.postinst b/debian/libnss-ldapd.postinst new file mode 100644 index 0000000..db7c0e9 --- /dev/null +++ b/debian/libnss-ldapd.postinst @@ -0,0 +1,185 @@ +#!/bin/sh -e + +PACKAGE=libnss-ldapd +CONFFILE="/etc/libnss-ldap.conf" +PASSWDFILE="/etc/libnss-ldap.secret" + +add_missing() +{ + # FIXME: it would be nice to get the prototype from a template. + + parameter=$1 + value=$2 + echo "$parameter $value" >> $CONFFILE +} + +change_value() +{ + parameter=$1 + value=$2 + commented=0 ; notthere=0 + + egrep -i -q "^$parameter " $CONFFILE || notthere=1 + if [ "$notthere" = "1" ]; then + if ( egrep -i -q "^# *$parameter" $CONFFILE ); then + notthere=0 + commented=1 + fi + fi + + if [ "$notthere" = "1" ]; then + add_missing $parameter $value + else + replacestring="^$parameter .*" + if [ "$commented" = "1" ]; then + replacestring="^# *$parameter .*" + fi + # i really need a better way to do this... + # currently we replace only the first match, we need a better + # way of dealing with multiple hits. + value=$value parameter=$parameter perl -i -p -e 's/^# *\Q$ENV{"parameter"}\E .*/$ENV{"parameter"} $ENV{"value"}/i + and $match=1 unless ($match)' $CONFFILE + fi +} + +disable_param() +{ + parameter=$1 + enabled=0 + egrep -q "^$parameter " $CONFFILE && enabled=1 + if [ "$enabled" = "1" ]; then + perl -i -p -e "s/^($parameter .*)/#\$1/i" $CONFFILE + fi +} + +# Real functions begin here. +case "$1" in + configure) + # ok, lets get to business.. + . /usr/share/debconf/confmodule + + # lets create the configuration from example if it's not there. + examplefile=/usr/share/$PACKAGE/ldap.conf + if [ ! -e $CONFFILE -a -e $examplefile ]; then + cat > $CONFFILE << EOM +###DEBCONF### +# the configuration of this file will be done by debconf as long as the +# first line of the file says '###DEBCONF###' +# +# you should use dpkg-reconfigure libnss-ldap to configure this file. +# +EOM + cat $examplefile >> $CONFFILE + chmod 0644 $CONFFILE + db_set libnss-ldap/override true + fi + + db_get libnss-ldap/override + if [ "$RET" = "true" ]; then + if ( head -1 $CONFFILE | grep -q -v '^###DEBCONF###$' ); then + mv $CONFFILE $CONFFILE.tmp + cat > $CONFFILE << EOM +###DEBCONF### +EOM + cat $CONFFILE.tmp >> $CONFFILE + rm -f $CONFFILE.tmp + chmod 0644 $CONFFILE + fi + + db_get shared/ldapns/ldap-server + if echo $RET | egrep -q '^ldaps?://'; then + disable_param host + change_value uri "$RET" + else + disable_param uri + change_value host "$RET" + fi + + db_get shared/ldapns/base-dn + change_value base "$RET" + + db_get shared/ldapns/ldap_version + change_value ldap_version "$RET" + + db_get libnss-ldap/dbrootlogin + if [ "$RET" = "true" ]; then + # user wants to log in to the database, so be it. + db_get libnss-ldap/rootbinddn + change_value rootbinddn "$RET" + + db_get libnss-ldap/rootbindpw + if [ "$RET" != "" ]; then + rm -f $PASSWDFILE + echo $RET > $PASSWDFILE + chmod 0600 $PASSWDFILE + db_set libnss-ldap/rootbindpw '' + fi + else + # ok, so the user refused to use this feature, better make + # sure it's really off. + disable_param rootbinddn + rm -f $PASSWDFILE + fi + + db_get libnss-ldap/dblogin + if [ "$RET" = "true" ]; then + # user wants to log in to the database, so be it. + db_get libnss-ldap/binddn + change_value binddn "$RET" + + db_get libnss-ldap/bindpw + if [ "$RET" != "" ]; then + change_value bindpw "$RET" + db_set libnss-ldap/bindpw '' + fi + else + # once again, user didn't.. lets make sure we dont. + disable_param binddn + disable_param bindpw + fi + + db_get libnss-ldap/confperm + if [ "$RET" = "true" ]; then + # FIXME: we need a way to check if the file + # was 0700 and we removed the flag. + chmod 0600 $CONFFILE + else + # ICK! ugly hack, but i didn't get anything + # better to work. + find $CONFFILE -perm 0600 -exec chmod 0644 {} \; + fi + fi + db_stop + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +if [ -e /etc/ldap.secret -a ! -e /etc/libnss-ldap.secret ]; then + cp -p /etc/ldap.secret /etc/libnss-ldap.secret +fi + +if [ -s /usr/sbin/nscd ]; then + if [ `pidof -s nscd` ]; then + if which invoke-rc.d >/dev/null 2>&1; then + invoke-rc.d nscd restart + else + /etc/init.d/nscd restart + fi + fi +fi + +# This directory was used earlier, and should no longer have any +# function (we use /lib/init/rw instead). +if [ -d /var/lib/libnss-ldap ]; then + rm -rf /var/lib/libnss-ldap +fi + +#DEBHELPER# diff --git a/debian/libnss-ldapd.postrm b/debian/libnss-ldapd.postrm new file mode 100644 index 0000000..204289b --- /dev/null +++ b/debian/libnss-ldapd.postrm @@ -0,0 +1,12 @@ +#!/bin/sh + +CONFFILE="/etc/libnss-ldap.conf" +PASSWDFILE="/etc/libnss-ldap.secret" + +action=$1 + +if [ "$action" = "purge" ]; then + rm -f $CONFFILE $PASSWDFILE +fi + +#DEBHELPER# diff --git a/debian/rules b/debian/rules index 0c0fd44..2b41df9 100755 --- a/debian/rules +++ b/debian/rules @@ -1,24 +1,95 @@ #!/usr/bin/make -f -export DH_COMPAT=4 -export LIBS=-lpthread +export DH_VERBOSE=1 -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/autotools.mk +# code for passing host/build options to configure +export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + confflags += --build $(DEB_HOST_GNU_TYPE) +else + confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) +endif -DEB_CONFIGURE_EXTRA_FLAGS += --enable-rfc2307bis --with-ldap-lib=openldap --with-ldap-conf-file=/etc/libnss-ldap.conf --with-ldap-secret-file=/etc/libnss-ldap.secret --enable-schema-mapping --enable-paged-results --enable-configurable-krb5-ccname-gssapi -DEB_DESTDIR = $(CURDIR)/debian/tmp -DEB_OPT_FLAG += -fPIC -DEB_DH_INSTALLINIT_ARGS = --no-start -- start 03 S . start 01 0 . stop 01 2 . stop 01 3 . stop 01 4 . stop 01 5 . start 01 6 . +configure: configure-stamp +configure-stamp: + dh_testdir + ./configure $(confflags) \ + --prefix=/usr \ + --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --enable-warnings \ + --disable-maintainer-mode \ + --disable-dependency-tracking \ + --enable-rfc2307bis \ + --with-ldap-lib=openldap \ + --with-ldap-conf-file=/etc/libnss-ldap.conf \ + --with-ldap-secret-file=/etc/libnss-ldap.secret \ + --enable-schema-mapping \ + --enable-paged-results \ + --enable-configurable-krb5-ccname-gssapi + touch configure-stamp -MY_INST_DIR = $(CURDIR)/debian/libnss-ldap/usr/share +build: configure-stamp build-stamp +build-stamp: + dh_testdir + $(MAKE) + touch build-stamp -binary-post-install/libnss-ldap:: +clean: + -test -r /usr/share/misc/config.sub && \ + cp -f /usr/share/misc/config.sub config.sub + -test -r /usr/share/misc/config.guess && \ + cp -f /usr/share/misc/config.guess config.guess + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + -$(MAKE) distclean + dh_clean + debconf-updatepo --verbose + +install: build + dh_testdir + dh_testroot + dh_clean -k + $(MAKE) install DESTDIR=$(CURDIR)/debian/libnss-ldapd + # make configfile fully generated + rm -f $(CURDIR)/debian/libnss-ldapd/etc/libnss-ldap.conf + rm -f $(CURDIR)/debian/libnss-ldapd/etc/libnss-ldap.secret # rename man page - mv $(MY_INST_DIR)/man/man5/nss_ldap.5 $(MY_INST_DIR)/man/man5/libnss-ldap.conf.5 + mv $(CURDIR)/debian/libnss-ldapd/usr/share/man/man5/nss_ldap.5 $(CURDIR)/debian/libnss-ldapd/usr/share/man/man5/libnss-ldap.conf.5 # change all references from /etc/ldap.conf to /etc/libnss-ldap.conf - for file in $(MY_INST_DIR)/man/man5/libnss-ldap.conf.5 \ - $(MY_INST_DIR)/libnss-ldap/ldap.conf ; do \ + for file in $(CURDIR)/debian/libnss-ldapd/usr/share/man/man5/libnss-ldap.conf.5 \ + ; \ + do \ sed -i -e 's:/etc/ldap.conf:/etc/libnss-ldap.conf:g' \ - -e 's:/etc/ldap.secret:/etc/libnss-ldap.secret:g' $$file; \ + -e 's:/etc/ldap.secret:/etc/libnss-ldap.secret:g' $$file; \ done + +# build architecture-independent files +binary-indep: build install +# we have nothing to do by default + +# build architecture-dependent files +binary-arch: build install + dh_testdir + dh_testroot + dh_installdebconf + dh_installdocs + dh_installexamples + dh_installinit + dh_installman + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch -- cgit v1.2.3