forked from jengelh/openldap2
Accepting request 49498 from network:ldap
Copy from network:ldap/openldap2 based on submit request 49498 from user rhafer OBS-URL: https://build.opensuse.org/request/show/49498 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/openldap2?expand=0&rev=68
This commit is contained in:
commit
0e3b3107a5
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 29 09:21:52 UTC 2010 - rhafer@novell.com
|
||||
|
||||
- Don't build 2.3 slapcat anymore for 11.3 and newer. We switch to
|
||||
2.4 long ago.
|
||||
- Removed automatic 2.3->2.4 migration in %post
|
||||
- moved back-sql examples to make rpmlint happy
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 26 14:04:06 UTC 2010 - rhafer@novell.com
|
||||
|
||||
|
@ -25,7 +25,7 @@ BuildRequires: cyrus-sasl-devel libopenssl-devel
|
||||
BuildRequires: -libopenssl-devel -pwdutils openssl-devel
|
||||
%endif
|
||||
Version: 2.4.23
|
||||
Release: 1
|
||||
Release: 2
|
||||
Url: http://www.openldap.org
|
||||
License: BSD3c(or similar) ; openldap 2.8
|
||||
%if "%{name}" == "openldap2"
|
||||
@ -239,6 +239,7 @@ export STRIP=""
|
||||
make depend
|
||||
make %{?jobs:-j%jobs}
|
||||
%if "%{name}" == "openldap2"
|
||||
%if %suse_version < 1130
|
||||
# build a static slapcat binary from the OpenLDAP 2.3 release
|
||||
# to be able to update existing databases
|
||||
cd ../openldap-2.3.37
|
||||
@ -257,6 +258,7 @@ export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -DLDAP_DEPRECATED"
|
||||
make depend
|
||||
make %{?jobs:-j%jobs}
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%check
|
||||
%if %run_test_suite
|
||||
@ -310,9 +312,12 @@ rm -rf doc/guide/release
|
||||
rm -f $RPM_BUILD_ROOT/etc/openldap/DB_CONFIG.example
|
||||
rm -f $RPM_BUILD_ROOT/etc/openldap/schema/README
|
||||
rm -f $RPM_BUILD_ROOT/var/run/slapd/openldap-data/DB_CONFIG.example
|
||||
mv servers/slapd/back-sql/rdbms_depend servers/slapd/back-sql/examples
|
||||
%if %suse_version < 1130
|
||||
# install 2.3 slapcat
|
||||
install -m 755 ../openldap-2.3.37/servers/slapd/slapcat $RPM_BUILD_ROOT/usr/sbin/openldap-2.3-slapcat
|
||||
%endif
|
||||
%endif
|
||||
rm -f $RPM_BUILD_ROOT/usr/lib/openldap/modules/*.a
|
||||
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-dnssrv.5
|
||||
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-ndb.5
|
||||
@ -331,7 +336,6 @@ cat >openldap2.filelist <<EOF
|
||||
%config /etc/sysconfig/SuSEfirewall2.d/services/openldap
|
||||
/usr/sbin/rcldap
|
||||
/usr/sbin/slap*
|
||||
/usr/sbin/openldap-2.3-slapcat
|
||||
%dir /etc/openldap
|
||||
%dir %attr(0770, ldap, ldap) /etc/openldap/slapd.d
|
||||
%dir /etc/openldap/schema
|
||||
@ -362,6 +366,11 @@ cat >openldap2.filelist <<EOF
|
||||
%doc doc/drafts doc/guide
|
||||
%doc README.update
|
||||
EOF
|
||||
%if %suse_version < 1130
|
||||
cat >>openldap2.filelist <<EOF
|
||||
/usr/sbin/openldap-2.3-slapcat
|
||||
EOF
|
||||
%endif
|
||||
#
|
||||
cat > openldap2-client.filelist <<EOF
|
||||
%dir /etc/openldap
|
||||
@ -411,7 +420,7 @@ EOF
|
||||
cat > openldap2-back-sql.filelist <<EOF
|
||||
/usr/lib/openldap/modules/back_sql*
|
||||
%doc %{_mandir}/man5/slapd-sql.*
|
||||
%doc servers/slapd/back-sql/rdbms_depend
|
||||
%doc servers/slapd/back-sql/examples
|
||||
%doc servers/slapd/back-sql/docs/bugs
|
||||
%doc servers/slapd/back-sql/docs/install
|
||||
EOF
|
||||
@ -450,91 +459,6 @@ if [ ${1:-0} -gt 1 ] && [ -f %{_libdir}/sasl2/slapd.conf ] ; then
|
||||
fi
|
||||
%{fillup_and_insserv -n openldap ldap}
|
||||
%{remove_and_set -n openldap OPENLDAP_RUN_DB_RECOVER}
|
||||
# convert database if needed
|
||||
if [ -f /etc/openldap/UPDATE_NEEDED ] ; then
|
||||
read SCHEMA_BACKUP < /etc/openldap/UPDATE_NEEDED
|
||||
SLAPD_CONF=/etc/openldap/slapd.conf
|
||||
sed -e "s;/etc/openldap/schema/;$SCHEMA_BACKUP/;g" \
|
||||
< $SLAPD_CONF > $SCHEMA_BACKUP/slapd.conf.update
|
||||
LOGFILE="slaptool.log"
|
||||
BACKENDS=`grep ^database $SLAPD_CONF | awk '{print $2}'`
|
||||
DIRECTORIES=(`grep ^directory $SLAPD_CONF | awk '{print $2}'`)
|
||||
MSG=""
|
||||
db_num=0
|
||||
dir_num=0
|
||||
restart=""
|
||||
/etc/init.d/ldap status 2&>1 > /dev/null
|
||||
if [ "$?" = "0" ]; then
|
||||
/etc/init.d/ldap stop
|
||||
restart="1"
|
||||
fi
|
||||
for i in $BACKENDS; do
|
||||
db_num=$((db_num+1));
|
||||
if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then
|
||||
db_dir=${DIRECTORIES[$dir_num]};
|
||||
if [ -f $db_dir/id2entry.bdb ] || [ -f $db_dir/id2entry.dbb ] ; then
|
||||
rm $db_dir/__db* ;
|
||||
mkdir $db_dir/db_bak ;
|
||||
echo "Dumping database to: $db_dir/ldapbak.ldif.$db_num" ;
|
||||
/usr/sbin/openldap-2.3-slapcat -T c \
|
||||
-f $SCHEMA_BACKUP/slapd.conf.update \
|
||||
-n $db_num -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE;
|
||||
if [ "x$i" = "xldbm" ] ; then
|
||||
mv $db_dir/*.dbb $db_dir/db_bak/ ;
|
||||
else
|
||||
mv $db_dir/*.bdb $db_dir/db_bak/ ;
|
||||
mv $db_dir/log.* $db_dir/db_bak/ ;
|
||||
fi
|
||||
mv $db_dir/alock $db_dir/db_bak/ ;
|
||||
rm -f $db_dir/__db* ;
|
||||
fi
|
||||
dir_num=$((dir_num+1));
|
||||
fi
|
||||
done
|
||||
db_num=0
|
||||
dir_num=0
|
||||
sed -i -e "s;ldbm;bdb;g" $SLAPD_CONF
|
||||
for i in $BACKENDS; do
|
||||
db_num=$((db_num+1));
|
||||
if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then
|
||||
db_dir=${DIRECTORIES[$dir_num]};
|
||||
if [ -s $db_dir/ldapbak.ldif.$db_num ] ; then
|
||||
if [ `wc -l $db_dir/ldapbak.ldif.$db_num | awk '{print $1}'` -lt 2500000 ]; then
|
||||
if [ "x$i" = "xldbm" ] ; then
|
||||
echo "Converting $i database to bdb in $db_dir" ;
|
||||
# Create default DB_CONFIG for better performance
|
||||
echo "set_cachesize 0 15000000 1" > $db_dir/DB_CONFIG
|
||||
echo "set_lg_regionmax 262144" >> $db_dir/DB_CONFIG
|
||||
echo "set_lg_bsize 2097152" >> $db_dir/DB_CONFIG
|
||||
echo "set_flags DB_LOG_AUTOREMOVE" >> $db_dir/DB_CONFIG
|
||||
else
|
||||
echo "Restoring $i database in $db_dir" ;
|
||||
fi
|
||||
slapadd -q -n $db_num -f $SLAPD_CONF -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE ;
|
||||
if [ $? -ne 0 ]; then
|
||||
MSG="$MSG\nFailed to restore database in $db_dir";
|
||||
MSG="$MSG\nPlease restore manually from the LDIF dump $db_dir/ldapbak.ldif.$db_num\n";
|
||||
else
|
||||
rm -f $db_dir/ldapbak.ldif.$db_num
|
||||
rm -rf $db_dir/db_bak/
|
||||
fi
|
||||
else
|
||||
MSG="$MSG\nPlease restore the database in $db_dir manually by using";
|
||||
MSG="$MSG\nslapadd with the LDIF dump $db_dir/ldapbak.ldif.$db_num\n";
|
||||
fi
|
||||
fi
|
||||
dir_num=$((dir_num+1));
|
||||
fi
|
||||
done
|
||||
if [ "$MSG" ] ; then
|
||||
echo -e "$MSG";
|
||||
else
|
||||
rm -f /etc/openldap/UPDATE_NEEDED ;
|
||||
if [ $restart ]; then
|
||||
/etc/init.d/ldap start
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
%preun
|
||||
%stop_on_removal ldap
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 29 09:21:52 UTC 2010 - rhafer@novell.com
|
||||
|
||||
- Don't build 2.3 slapcat anymore for 11.3 and newer. We switch to
|
||||
2.4 long ago.
|
||||
- Removed automatic 2.3->2.4 migration in %post
|
||||
- moved back-sql examples to make rpmlint happy
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 26 14:04:06 UTC 2010 - rhafer@novell.com
|
||||
|
||||
|
100
openldap2.spec
100
openldap2.spec
@ -25,7 +25,7 @@ BuildRequires: cyrus-sasl-devel libopenssl-devel
|
||||
BuildRequires: -libopenssl-devel -pwdutils openssl-devel
|
||||
%endif
|
||||
Version: 2.4.23
|
||||
Release: 1
|
||||
Release: 2
|
||||
Url: http://www.openldap.org
|
||||
License: BSD3c(or similar) ; openldap 2.8
|
||||
%if "%{name}" == "openldap2"
|
||||
@ -239,6 +239,7 @@ export STRIP=""
|
||||
make depend
|
||||
make %{?jobs:-j%jobs}
|
||||
%if "%{name}" == "openldap2"
|
||||
%if %suse_version < 1130
|
||||
# build a static slapcat binary from the OpenLDAP 2.3 release
|
||||
# to be able to update existing databases
|
||||
cd ../openldap-2.3.37
|
||||
@ -257,6 +258,7 @@ export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -DLDAP_DEPRECATED"
|
||||
make depend
|
||||
make %{?jobs:-j%jobs}
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%check
|
||||
%if %run_test_suite
|
||||
@ -310,9 +312,12 @@ rm -rf doc/guide/release
|
||||
rm -f $RPM_BUILD_ROOT/etc/openldap/DB_CONFIG.example
|
||||
rm -f $RPM_BUILD_ROOT/etc/openldap/schema/README
|
||||
rm -f $RPM_BUILD_ROOT/var/run/slapd/openldap-data/DB_CONFIG.example
|
||||
mv servers/slapd/back-sql/rdbms_depend servers/slapd/back-sql/examples
|
||||
%if %suse_version < 1130
|
||||
# install 2.3 slapcat
|
||||
install -m 755 ../openldap-2.3.37/servers/slapd/slapcat $RPM_BUILD_ROOT/usr/sbin/openldap-2.3-slapcat
|
||||
%endif
|
||||
%endif
|
||||
rm -f $RPM_BUILD_ROOT/usr/lib/openldap/modules/*.a
|
||||
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-dnssrv.5
|
||||
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-ndb.5
|
||||
@ -331,7 +336,6 @@ cat >openldap2.filelist <<EOF
|
||||
%config /etc/sysconfig/SuSEfirewall2.d/services/openldap
|
||||
/usr/sbin/rcldap
|
||||
/usr/sbin/slap*
|
||||
/usr/sbin/openldap-2.3-slapcat
|
||||
%dir /etc/openldap
|
||||
%dir %attr(0770, ldap, ldap) /etc/openldap/slapd.d
|
||||
%dir /etc/openldap/schema
|
||||
@ -362,6 +366,11 @@ cat >openldap2.filelist <<EOF
|
||||
%doc doc/drafts doc/guide
|
||||
%doc README.update
|
||||
EOF
|
||||
%if %suse_version < 1130
|
||||
cat >>openldap2.filelist <<EOF
|
||||
/usr/sbin/openldap-2.3-slapcat
|
||||
EOF
|
||||
%endif
|
||||
#
|
||||
cat > openldap2-client.filelist <<EOF
|
||||
%dir /etc/openldap
|
||||
@ -411,7 +420,7 @@ EOF
|
||||
cat > openldap2-back-sql.filelist <<EOF
|
||||
/usr/lib/openldap/modules/back_sql*
|
||||
%doc %{_mandir}/man5/slapd-sql.*
|
||||
%doc servers/slapd/back-sql/rdbms_depend
|
||||
%doc servers/slapd/back-sql/examples
|
||||
%doc servers/slapd/back-sql/docs/bugs
|
||||
%doc servers/slapd/back-sql/docs/install
|
||||
EOF
|
||||
@ -450,91 +459,6 @@ if [ ${1:-0} -gt 1 ] && [ -f %{_libdir}/sasl2/slapd.conf ] ; then
|
||||
fi
|
||||
%{fillup_and_insserv -n openldap ldap}
|
||||
%{remove_and_set -n openldap OPENLDAP_RUN_DB_RECOVER}
|
||||
# convert database if needed
|
||||
if [ -f /etc/openldap/UPDATE_NEEDED ] ; then
|
||||
read SCHEMA_BACKUP < /etc/openldap/UPDATE_NEEDED
|
||||
SLAPD_CONF=/etc/openldap/slapd.conf
|
||||
sed -e "s;/etc/openldap/schema/;$SCHEMA_BACKUP/;g" \
|
||||
< $SLAPD_CONF > $SCHEMA_BACKUP/slapd.conf.update
|
||||
LOGFILE="slaptool.log"
|
||||
BACKENDS=`grep ^database $SLAPD_CONF | awk '{print $2}'`
|
||||
DIRECTORIES=(`grep ^directory $SLAPD_CONF | awk '{print $2}'`)
|
||||
MSG=""
|
||||
db_num=0
|
||||
dir_num=0
|
||||
restart=""
|
||||
/etc/init.d/ldap status 2&>1 > /dev/null
|
||||
if [ "$?" = "0" ]; then
|
||||
/etc/init.d/ldap stop
|
||||
restart="1"
|
||||
fi
|
||||
for i in $BACKENDS; do
|
||||
db_num=$((db_num+1));
|
||||
if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then
|
||||
db_dir=${DIRECTORIES[$dir_num]};
|
||||
if [ -f $db_dir/id2entry.bdb ] || [ -f $db_dir/id2entry.dbb ] ; then
|
||||
rm $db_dir/__db* ;
|
||||
mkdir $db_dir/db_bak ;
|
||||
echo "Dumping database to: $db_dir/ldapbak.ldif.$db_num" ;
|
||||
/usr/sbin/openldap-2.3-slapcat -T c \
|
||||
-f $SCHEMA_BACKUP/slapd.conf.update \
|
||||
-n $db_num -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE;
|
||||
if [ "x$i" = "xldbm" ] ; then
|
||||
mv $db_dir/*.dbb $db_dir/db_bak/ ;
|
||||
else
|
||||
mv $db_dir/*.bdb $db_dir/db_bak/ ;
|
||||
mv $db_dir/log.* $db_dir/db_bak/ ;
|
||||
fi
|
||||
mv $db_dir/alock $db_dir/db_bak/ ;
|
||||
rm -f $db_dir/__db* ;
|
||||
fi
|
||||
dir_num=$((dir_num+1));
|
||||
fi
|
||||
done
|
||||
db_num=0
|
||||
dir_num=0
|
||||
sed -i -e "s;ldbm;bdb;g" $SLAPD_CONF
|
||||
for i in $BACKENDS; do
|
||||
db_num=$((db_num+1));
|
||||
if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then
|
||||
db_dir=${DIRECTORIES[$dir_num]};
|
||||
if [ -s $db_dir/ldapbak.ldif.$db_num ] ; then
|
||||
if [ `wc -l $db_dir/ldapbak.ldif.$db_num | awk '{print $1}'` -lt 2500000 ]; then
|
||||
if [ "x$i" = "xldbm" ] ; then
|
||||
echo "Converting $i database to bdb in $db_dir" ;
|
||||
# Create default DB_CONFIG for better performance
|
||||
echo "set_cachesize 0 15000000 1" > $db_dir/DB_CONFIG
|
||||
echo "set_lg_regionmax 262144" >> $db_dir/DB_CONFIG
|
||||
echo "set_lg_bsize 2097152" >> $db_dir/DB_CONFIG
|
||||
echo "set_flags DB_LOG_AUTOREMOVE" >> $db_dir/DB_CONFIG
|
||||
else
|
||||
echo "Restoring $i database in $db_dir" ;
|
||||
fi
|
||||
slapadd -q -n $db_num -f $SLAPD_CONF -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE ;
|
||||
if [ $? -ne 0 ]; then
|
||||
MSG="$MSG\nFailed to restore database in $db_dir";
|
||||
MSG="$MSG\nPlease restore manually from the LDIF dump $db_dir/ldapbak.ldif.$db_num\n";
|
||||
else
|
||||
rm -f $db_dir/ldapbak.ldif.$db_num
|
||||
rm -rf $db_dir/db_bak/
|
||||
fi
|
||||
else
|
||||
MSG="$MSG\nPlease restore the database in $db_dir manually by using";
|
||||
MSG="$MSG\nslapadd with the LDIF dump $db_dir/ldapbak.ldif.$db_num\n";
|
||||
fi
|
||||
fi
|
||||
dir_num=$((dir_num+1));
|
||||
fi
|
||||
done
|
||||
if [ "$MSG" ] ; then
|
||||
echo -e "$MSG";
|
||||
else
|
||||
rm -f /etc/openldap/UPDATE_NEEDED ;
|
||||
if [ $restart ]; then
|
||||
/etc/init.d/ldap start
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
%preun
|
||||
%stop_on_removal ldap
|
||||
|
Loading…
Reference in New Issue
Block a user