- Added schema2ldif tool to openldap2-client subpackage

(bnc#541819)

OBS-URL: https://build.opensuse.org/package/show/network:ldap/openldap2?expand=0&rev=18
This commit is contained in:
Ralf Haferkamp 2009-09-28 14:00:48 +00:00 committed by Git OBS Bridge
parent e24962d1d0
commit 04c9eb4bdf
5 changed files with 94 additions and 2 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Sep 28 13:59:18 UTC 2009 - rhafer@novell.com
- Added schema2ldif tool to openldap2-client subpackage
(bnc#541819)
-------------------------------------------------------------------
Wed Sep 23 15:35:13 UTC 2009 - rhafer@novell.com

View File

@ -1,5 +1,5 @@
#
# spec file for package openldap2-client (Version 2.4.17)
# spec file for package openldap2 (Version 2.4.17)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -18,7 +18,7 @@
# norootforbuild
Name: openldap2-client
Name: openldap2-client
BuildRequires: cyrus-sasl-devel db-devel libopenssl-devel openslp-devel tcpd-devel
%if %sles_version == 9
BuildRequires: -db-devel -libopenssl-devel -pwdutils libdb-4_5-devel openssl-devel
@ -50,6 +50,7 @@ Source2: addonschema.tar.gz
Source3: DB_CONFIG
Source4: sasl-slapd.conf
Source5: README.update
Source6: schema2ldif.pl
Source100: openldap-2.3.37.tar.bz2
Patch: openldap2.dif
Patch2: slapd_conf.dif
@ -287,6 +288,7 @@ install -m 755 -d $RPM_BUILD_ROOT/var/lib/ldap
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/liblber.so*
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap_r.so*
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap.so*
install -m 755 %{SOURCE6} $RPM_BUILD_ROOT/usr/sbin/schema2ldif
%if "%{name}" == "openldap2"
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 sysconfig.openldap $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.openldap
@ -367,6 +369,7 @@ cat > openldap2-client.filelist <<EOF
/usr/bin/ldappasswd
/usr/bin/ldapurl
/usr/bin/ldapwhoami
/usr/sbin/schema2ldif
%doc %{_mandir}/man1/ldap*
%doc %{_mandir}/man5/ldap.conf*
%doc %{_mandir}/man5/ldif.*

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Sep 28 13:59:18 UTC 2009 - rhafer@novell.com
- Added schema2ldif tool to openldap2-client subpackage
(bnc#541819)
-------------------------------------------------------------------
Wed Sep 23 15:35:13 UTC 2009 - rhafer@novell.com

View File

@ -50,6 +50,7 @@ Source2: addonschema.tar.gz
Source3: DB_CONFIG
Source4: sasl-slapd.conf
Source5: README.update
Source6: schema2ldif.pl
Source100: openldap-2.3.37.tar.bz2
Patch: openldap2.dif
Patch2: slapd_conf.dif
@ -287,6 +288,7 @@ install -m 755 -d $RPM_BUILD_ROOT/var/lib/ldap
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/liblber.so*
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap_r.so*
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap.so*
install -m 755 %{SOURCE6} $RPM_BUILD_ROOT/usr/sbin/schema2ldif
%if "%{name}" == "openldap2"
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 sysconfig.openldap $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.openldap
@ -367,6 +369,7 @@ cat > openldap2-client.filelist <<EOF
/usr/bin/ldappasswd
/usr/bin/ldapurl
/usr/bin/ldapwhoami
/usr/sbin/schema2ldif
%doc %{_mandir}/man1/ldap*
%doc %{_mandir}/man5/ldap.conf*
%doc %{_mandir}/man5/ldif.*

74
schema2ldif.pl Normal file
View File

@ -0,0 +1,74 @@
#!/usr/bin/perl -w
#
# This is a simple tool to convert OpenLDAP Schema files to
# LDIF suitable for usage with OpenLDAP's dynamic configuration
# backend (cn=config)
#
# usage:
# schema2ldif.pl <input file>
#
# The generated LDIF is printed to stdout.
#
use strict;
use File::Basename;
use Text::Wrap;
my $infile = $ARGV[0] || print_usage();
sub print_usage
{
print STDERR "usage: schema2ldif.pl <input file>\n";
exit(1);
}
open( SCHEMA, "< $infile");
my $schemaline = "";
$Text::Wrap::columns=78;
$Text::Wrap::separator="\n ";
my $cn = basename($infile, ".schema");
print STDOUT "dn: cn=$cn,cn=schema,cn=config\n";
print STDOUT "objectClass: olcSchemaConfig\n";
print STDOUT "cn: $cn\n";
while ( <SCHEMA> )
{
my $line = $_;
if ( $line =~ /^\s+(.+)$/ )
{
$schemaline .= " $1";
next;
}
elsif ( $schemaline ne "" )
{
print STDOUT wrap(""," ", $schemaline);
print STDOUT "\n";
$schemaline = "";
}
if ( $line =~ /^#/ )
{
print STDOUT $line;
}
elsif ( $line =~ /^\s*$/ )
{
print STDOUT "#\n";
}
elsif ( $line =~ /^(objectclass|attributetype|objectidentifier)\s+(.+)$/i )
{
if ( lc($1) eq "objectidentifier" )
{
$schemaline .= "olcObjectIdentifier: ";
}
elsif ( lc($1) eq "objectclass" )
{
$schemaline .= "olcObjectClasses: ";
}
elsif ( lc($1) eq "attributetype" )
{
$schemaline .= "olcAttributeTypes: ";
}
$schemaline .= $2;
}
}