parent
							
								
									82b8ccaded
								
							
						
					
					
						commit
						40bc33f600
					
				| @ -400,14 +400,14 @@ fi | |||||||
| 
 | 
 | ||||||
| # upgrade | # upgrade | ||||||
| if [ $1 -eq 2 ]; then | if [ $1 -eq 2 ]; then | ||||||
| 	# safe way to migrate the database if minor version number changed (2.x -> 2.y) | 	# safe way to migrate the database if version number changed | ||||||
| 	# http://www.openldap.org/doc/admin24/maintenance.html | 	# http://www.openldap.org/doc/admin24/maintenance.html | ||||||
| 
 | 
 | ||||||
| 	old_version=$(rpm -q --qf=%%{version} openldap-servers | sed 's/\.[0-9]*$//') | 	old_version=$(rpm -q --qf=%%{version} openldap-servers) | ||||||
| 	new_version=$(sed 's/\.[0-9]*$//' <<< %{version}) | 	new_version=%{version} | ||||||
| 
 | 
 | ||||||
| 	if [ "$old_version" != "$new_version" ]; then | 	if [ "$old_version" != "$new_version" ]; then | ||||||
| 		pushd %{_sharedstatedir}/ldap | 		pushd %{_sharedstatedir}/ldap &>/dev/null | ||||||
| 
 | 
 | ||||||
| 		# stop the service | 		# stop the service | ||||||
| 		if service slapd status &>/dev/null; then | 		if service slapd status &>/dev/null; then | ||||||
| @ -417,7 +417,7 @@ if [ $1 -eq 2 ]; then | |||||||
| 			rm -f need_start | 			rm -f need_start | ||||||
| 		fi | 		fi | ||||||
| 
 | 
 | ||||||
| 		if ls __db.* &>/dev/null; then | 		if ls *.bdb &>/dev/null; then | ||||||
| 			# export the database | 			# export the database | ||||||
| 			if [ -f %{_sysconfdir}/openldap/slapd.conf ]; then | 			if [ -f %{_sysconfdir}/openldap/slapd.conf ]; then | ||||||
| 				slapcat -f %{_sysconfdir}/openldap/slapd.conf -l upgrade.ldif &>/dev/null | 				slapcat -f %{_sysconfdir}/openldap/slapd.conf -l upgrade.ldif &>/dev/null | ||||||
| @ -427,15 +427,21 @@ if [ $1 -eq 2 ]; then | |||||||
| 
 | 
 | ||||||
| 			# backup the old database | 			# backup the old database | ||||||
| 			if [ $? -eq 0 ]; then | 			if [ $? -eq 0 ]; then | ||||||
| 				rm -rf rpmorig | 				chown ldap:ldap upgrade.ldif | ||||||
| 				mv alock *.bdb __db.* log.* rpmorig &>/dev/null || : | 				chmod 0400 upgrade.ldif | ||||||
| 				cp -f rpmorig/DB_CONFIG . &>/dev/null || : | 
 | ||||||
|  | 				rm -rf backup | ||||||
|  | 				mkdir -m 0700 backup | ||||||
|  | 				chown 0500 backup | ||||||
|  | 
 | ||||||
|  | 				mv alock *.bdb __db.* log.* backup &>/dev/null | ||||||
|  | 				cp -f backup/DB_CONFIG DB_CONFIG &>/dev/null | ||||||
| 			else | 			else | ||||||
| 				rm -f upgrade.ldif | 				rm -f upgrade.ldif | ||||||
| 			fi | 			fi | ||||||
| 		fi | 		fi | ||||||
| 
 | 
 | ||||||
| 		popd | 		popd &>/dev/null | ||||||
| 	fi | 	fi | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| @ -475,24 +481,24 @@ if ! ls -d %{_sysconfdir}/openldap/slapd.d/* &>/dev/null; then | |||||||
| 		cp %{_datadir}/openldap-servers/slapd.conf.obsolete %{_sysconfdir}/openldap/slapd.conf | 		cp %{_datadir}/openldap-servers/slapd.conf.obsolete %{_sysconfdir}/openldap/slapd.conf | ||||||
| 
 | 
 | ||||||
| 	# convert from old style config slapd.conf | 	# convert from old style config slapd.conf | ||||||
|     mv %{_sysconfdir}/openldap/slapd.conf %{_sysconfdir}/openldap/slapd.conf.bak | 	mv %{_sysconfdir}/openldap/slapd.conf %{_sysconfdir}/openldap/slapd.conf.bak | ||||||
|     mkdir -p %{_sysconfdir}/openldap/slapd.d/ | 	mkdir -p %{_sysconfdir}/openldap/slapd.d/ | ||||||
|     lines=$(egrep -n '^(database|backend)' %{_sysconfdir}/openldap/slapd.conf.bak | cut -d: -f1 | head -n 1) | 	lines=$(egrep -n '^(database|backend)' %{_sysconfdir}/openldap/slapd.conf.bak | cut -d: -f1 | head -n 1) | ||||||
|     lines=$(($lines-1)) | 	lines=$(($lines-1)) | ||||||
|     head -n $lines %{_sysconfdir}/openldap/slapd.conf.bak > %{_sysconfdir}/openldap/slapd.conf | 	head -n $lines %{_sysconfdir}/openldap/slapd.conf.bak > %{_sysconfdir}/openldap/slapd.conf | ||||||
|     cat >> %{_sysconfdir}/openldap/slapd.conf << EOF | 	cat >> %{_sysconfdir}/openldap/slapd.conf << EOF | ||||||
| database config | database config | ||||||
| rootdn   "cn=admin,cn=config" | rootdn   "cn=admin,cn=config" | ||||||
| #rootpw   secret | #rootpw   secret | ||||||
| EOF | EOF | ||||||
|     lines_r=$(wc --lines %{_sysconfdir}/openldap/slapd.conf.bak | cut -f1 -d" ") | 	lines_r=$(wc --lines %{_sysconfdir}/openldap/slapd.conf.bak | cut -f1 -d" ") | ||||||
|     lines_r=$(($lines_r-$lines)) | 	lines_r=$(($lines_r-$lines)) | ||||||
|     tail -n $lines_r %{_sysconfdir}/openldap/slapd.conf.bak >> %{_sysconfdir}/openldap/slapd.conf | 	tail -n $lines_r %{_sysconfdir}/openldap/slapd.conf.bak >> %{_sysconfdir}/openldap/slapd.conf | ||||||
|     slaptest -f %{_sysconfdir}/openldap/slapd.conf -F %{_sysconfdir}/openldap/slapd.d > /dev/null 2> /dev/null | 	slaptest -f %{_sysconfdir}/openldap/slapd.conf -F %{_sysconfdir}/openldap/slapd.d > /dev/null 2> /dev/null | ||||||
|     chown -R ldap:ldap %{_sysconfdir}/openldap/slapd.d | 	chown -R ldap:ldap %{_sysconfdir}/openldap/slapd.d | ||||||
|     chmod -R 000 %{_sysconfdir}/openldap/slapd.d | 	chmod -R 000 %{_sysconfdir}/openldap/slapd.d | ||||||
|     chmod -R u+rwX %{_sysconfdir}/openldap/slapd.d | 	chmod -R u+rwX %{_sysconfdir}/openldap/slapd.d | ||||||
|     rm -f %{_sysconfdir}/openldap/slapd.conf | 	rm -f %{_sysconfdir}/openldap/slapd.conf | ||||||
| 	rm -f %{_sharedstatedir}/ldap/__db* %{_sharedstatedir}/ldap/alock | 	rm -f %{_sharedstatedir}/ldap/__db* %{_sharedstatedir}/ldap/alock | ||||||
| 
 | 
 | ||||||
| 	[ $fresh_install -eq 0 ] && rm -f %{_sysconfdir}/openldap/slapd.conf.bak | 	[ $fresh_install -eq 0 ] && rm -f %{_sysconfdir}/openldap/slapd.conf.bak | ||||||
| @ -500,8 +506,8 @@ fi | |||||||
| 
 | 
 | ||||||
| # finish database migration (see %pre) | # finish database migration (see %pre) | ||||||
| if [ -f %{_sharedstatedir}/ldap/upgrade.ldif ]; then | if [ -f %{_sharedstatedir}/ldap/upgrade.ldif ]; then | ||||||
| 	runuser -m -s /usr/sbin/slapadd -- ldap -l %{_sharedstatedir}/ldap/upgrade.ldif &>/dev/null | 	runuser -m -s /usr/sbin/slapadd -- ldap -q -l %{_sharedstatedir}/ldap/upgrade.ldif >/dev/null | ||||||
| 	rm -f %{_sharedstatedir}/ldap/upgrade.ldif | 	mv -f %{_sharedstatedir}/ldap/upgrade.ldif %{_sharedstatedir}/ldap/backup.ldif | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # restart after upgrade | # restart after upgrade | ||||||
| @ -536,7 +542,7 @@ fi | |||||||
| 
 | 
 | ||||||
| # db4 upgrade (see %triggerun) | # db4 upgrade (see %triggerun) | ||||||
| if [ $2 -eq 2 ]; then | if [ $2 -eq 2 ]; then | ||||||
| 	pushd %{_sharedstatedir}/ldap | 	pushd %{_sharedstatedir}/ldap &>/dev/null | ||||||
| 
 | 
 | ||||||
| 	# we are interested in minor version changes (both versions of db4 are installed at this moment) | 	# we are interested in minor version changes (both versions of db4 are installed at this moment) | ||||||
| 	if [ "$(rpm -q --qf="%%{version}\n" db4 | sed 's/\.[0-9]*$//' | sort -u | wc -l)" != "1" ]; then | 	if [ "$(rpm -q --qf="%%{version}\n" db4 | sed 's/\.[0-9]*$//' | sort -u | wc -l)" != "1" ]; then | ||||||
| @ -555,7 +561,7 @@ if [ $2 -eq 2 ]; then | |||||||
| 		rm -f upgrade_db4 | 		rm -f upgrade_db4 | ||||||
| 	fi | 	fi | ||||||
| 
 | 
 | ||||||
| 	popd | 	popd &>/dev/null | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| exit 0 | exit 0 | ||||||
| @ -564,7 +570,7 @@ exit 0 | |||||||
| 
 | 
 | ||||||
| # db4 upgrade (see %triggerin) | # db4 upgrade (see %triggerin) | ||||||
| if [ -f %{_sharedstatedir}/ldap/upgrade_db4 ]; then | if [ -f %{_sharedstatedir}/ldap/upgrade_db4 ]; then | ||||||
| 	pushd %{_sharedstatedir}/ldap | 	pushd %{_sharedstatedir}/ldap &>/dev/null | ||||||
| 
 | 
 | ||||||
| 	# perform the upgrade | 	# perform the upgrade | ||||||
| 	if ls *.bdb &>/dev/null; then | 	if ls *.bdb &>/dev/null; then | ||||||
| @ -579,7 +585,7 @@ if [ -f %{_sharedstatedir}/ldap/upgrade_db4 ]; then | |||||||
| 	fi | 	fi | ||||||
| 
 | 
 | ||||||
| 	rm -f upgrade_db4 | 	rm -f upgrade_db4 | ||||||
| 	popd | 	popd &>/dev/null | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| exit 0 | exit 0 | ||||||
| @ -658,6 +664,7 @@ exit 0 | |||||||
| - Mozilla NSS - implement full non-blocking semantics | - Mozilla NSS - implement full non-blocking semantics | ||||||
|   ldapsearch -Z hangs server if starttls fails (#652822) |   ldapsearch -Z hangs server if starttls fails (#652822) | ||||||
| - updated list of all overlays in slapd.conf (#655899) | - updated list of all overlays in slapd.conf (#655899) | ||||||
|  | - fix database upgrade process (#656257) | ||||||
| 
 | 
 | ||||||
| * Thu Nov 18 2010 Jan Vcelak <jvcelak@redhat.com> 2.4.23-3 | * Thu Nov 18 2010 Jan Vcelak <jvcelak@redhat.com> 2.4.23-3 | ||||||
| - add support for multiple prefixed Mozilla NSS database files in TLS_CACERTDIR | - add support for multiple prefixed Mozilla NSS database files in TLS_CACERTDIR | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user