usr/src/cmd/openldap/install-openldap
author Jon Tibble <meths@btinternet.com>
Mon, 18 Nov 2013 20:10:04 +0000
branchoi_151a
changeset 245 a5aeb10de831
parent 154 b8fe83024c4a
permissions -rw-r--r--
Bump OpenLDAP to 2.4.38

#!/bin/ksh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
#ident	"@(#)install-openldap	1.6	10/06/02 SMI"

# VERS should be provided on command line or set in environment
if [ $# -ge 2 ]; then
    VERS=$1;
    LVERS=$2;
elif [ "${VERS}" = "" ]; then
    echo "$0: Version not specified and Enviroment variable VERS not set!" 1>&2
    exit 1
fi

if [ ! -d ${VERS} ]; then
    echo "$0: Error: \"$VERS\" not a directory!" 1>&2
    exit 1
fi

. ${SRC}/tools/install.subr

PREFIX=${ROOT}
EPREFIX=${ROOT}/usr
BINDIR=${EPREFIX}/bin
ETCDIR=${PREFIX}/etc/openldap
SCHEMADIR=${PREFIX}/etc/openldap/schema
REALCONFDIR=/etc/openldap
INCDIR=${EPREFIX}/include/openldap
LIBDIR=${EPREFIX}/lib
LIBEXECDIR=${EPREFIX}/lib
LIBOLBIN=${LIBDIR}/openldap/bin
SHARE=${EPREFIX}/share
MAN1DIR=${SHARE}/man/man1oldap
MAN3DIR=${SHARE}/man/man3oldap
MAN5DIR=${SHARE}/man/man5oldap
MAN8DIR=${SHARE}/man/man8oldap
MANTAG=oldap
DOCADMDIR=${SHARE}/doc/openldap/admin24
DOCIMGDIR=${SHARE}/doc/openldap/images
SBINDIR=${EPREFIX}/sbin
REALVARRUNDIR=/var/run/openldap
REALVARDIR=/var/openldap
CPREFIX=open

setrunpath()
{
	elfedit -e "dyn:runpath /usr/sfw/lib" $1
}

cd ${VERS}
TOP=`pwd`

## Client Tools
cd clients/tools
for i in ldapcompare ldapdelete ldapexop ldapmodify ldapmodrdn \
	ldappasswd ldapsearch ldapwhoami ldapurl
do
	setrunpath ${i}
	_install E ${i} ${BINDIR}/${CPREFIX}${i} 555
	_install L ../../../bin/${CPREFIX}${i} ${LIBOLBIN}/${i} 555
done
_install L ${CPREFIX}ldapmodify ${BINDIR}/${CPREFIX}ldapadd 555
_install L ../../../bin/${CPREFIX}ldapmodify ${LIBOLBIN}/ldapadd 555
cd $TOP

## Config files
_install N libraries/libldap/ldap.conf ${ETCDIR}/ldap.conf 444
_install N libraries/libldap/ldap.conf ${ETCDIR}/ldap.conf.default 444
cat servers/slapd/slapd.conf | \
	sed -e "s#%SYSCONFDIR%#${REALCONFDIR}#" \
	    -e "s#%LOCALSTATEDIR%/run#${REALVARRUNDIR}#" \
	    -e "s#%LOCALSTATEDIR%/openldap-data#${REALVARDIR}#" \
		> servers/slapd/slapd.conf.tmp
_install N servers/slapd/slapd.conf.tmp ${ETCDIR}/slapd.conf 400
_install N servers/slapd/DB_CONFIG ${ETCDIR}/DB_CONFIG.example 400
_install N servers/slapd/slapd.ldif ${ETCDIR}/slapd.ldif.default 400

## Server Schema
cd servers/slapd/schema
for i in *
do
	_install N ${i} ${SCHEMADIR}/${i} 444
done
cd $TOP

## Includes
cd include
for i in lber.h lber_types.h ldap_cdefs.h ldap_features.h ldap.h \
	ldap_schema.h ldap_utf8.h ldif.h slapi-plugin.h
do
	_install N ${i} ${INCDIR}/${i} 444
done
cd $TOP

## Libraries
LBERDIR=libraries/liblber/.libs
LBERLIB=liblber-2.4.so.${LVERS}
LBERSOV=liblber-2.4.so.2
LBERSO=liblber-2.4.so
setrunpath ${LBERDIR}/${LBERLIB}
_install D ${LBERDIR}/${LBERLIB} ${LIBDIR}/${LBERLIB} 555
cd ${LIBDIR}
_install L ${LBERLIB} ${LBERSOV} 555
_install L ${LBERLIB} ${LBERSO} 555
cd $TOP

#non _r version
LDAPDIR=libraries/libldap/.libs
LDAPLIB=libldap-2.4.so.${LVERS}
LDAPSOV=libldap-2.4.so.2
LDAPSO=libldap-2.4.so
setrunpath ${LDAPDIR}/${LDAPLIB}
_install D ${LDAPDIR}/${LDAPLIB} ${LIBDIR}/${LDAPLIB} 555
cd ${LIBDIR}
_install L ${LDAPLIB} ${LDAPSOV} 555
_install L ${LDAPLIB} ${LDAPSO} 555
cd $TOP

#_r version
LDAPDIR=libraries/libldap_r/.libs
LDAPLIB=libldap_r-2.4.so.${LVERS}
LDAPSOV=libldap_r-2.4.so.2
LDAPSO=libldap_r-2.4.so
setrunpath ${LDAPDIR}/${LDAPLIB}
_install D ${LDAPDIR}/${LDAPLIB} ${LIBDIR}/${LDAPLIB} 555
cd ${LIBDIR}
_install L ${LDAPLIB} ${LDAPSOV} 555
_install L ${LDAPLIB} ${LDAPSO} 555
cd $TOP

## Server in its various forms
setrunpath servers/slapd/slapd
_install E servers/slapd/slapd ${LIBEXECDIR}/slapd 555
cd ${SBINDIR}
for i in slapacl slapadd slapauth slapcat slapdn slapindex \
	slappasswd slapschema slaptest
do
	_install L ../lib/slapd ${i} 555
done
cd $TOP

## Solaris specific stuff  (SMF etc)
cd ../Solaris
i=ldap-olslapd.xml
_install N ${i} ${ROOT}/lib/svc/manifest/network/ldap/${i} 444
i=ldap-olslapd
_install N ${i} ${ROOT}/lib/svc/method/${i} 555
cd $TOP

#
# The manpages are updated by Sun to include a comment, an
# ATTRIBUTES section with stability classification, and a NOTES 
# section containing a pointer to the source package. We do this 
# automatically at install time. If the package is revised, it is
# possible that additional changes may be required.  This can be
# generally be done by updating the sunman-stability file.

MAN1SCRIPT=$TOP/../sun1man-stability
MANnSCRIPT=$TOP/../sunman-stability

for j in man1 man3 man5 man8
do
	C=
	case $j in
	man1) MANSCRIPT=$MAN1SCRIPT; DIR=$MAN1DIR; C=${CPREFIX};;
	man3) MANSCRIPT=$MANnSCRIPT; DIR=$MAN3DIR;;
	man5) MANSCRIPT=$MANnSCRIPT; DIR=$MAN5DIR;;
	man8) MANSCRIPT=$MANnSCRIPT; DIR=$MAN8DIR;;
	esac
	MD=doc/man/$j
	cd $MD
	for i in *.tmp
	do
		manpage=`basename $i .tmp`
		mmanpage=${C}`basename $i .tmp`${MANTAG}
		_install M ${i} ${DIR}/${mmanpage} 444
		if [ -f ${manpage}.links ] ; then
			for k in `cat ${manpage}.links`
			do
				[ `pwd` != ${DIR} ] && cd $DIR
				_install L ${mmanpage} ./${C}${k}${MANTAG} 444
			done
			cd $TOP/$MD
		fi
	done
	cd $TOP
done

#
# the Admin guide has been built for html by the sdf tool
# Install that as well

cd doc/guide/admin
for i in *.html *.png
do
	if [ ${i} = "index.html" ] ; then
		:	# Skip sym link afterwards
	else
		_install N ${i} ${DOCADMDIR}/${i} 444
	fi
done
_install L guide.html ${DOCADMDIR}/index.html 444
cd $TOP

_install N ../exec_attr ${ROOT}/etc/security/exec_attr.d/openldap 0444
_install N ../prof_attr ${ROOT}/etc/security/prof_attr.d/openldap 0444

cd doc/guide/images
for i in *.gif
do
	_install N ${i} ${DOCIMGDIR}/${i} 444
done
cd $TOP

exit 0