scriptlet: convert sysconfig/ldap to sysconfig/slapd
This commit is contained in:
parent
62f9c65cff
commit
33514c3f00
@ -457,27 +457,51 @@ if [ ! -f %{_sysconfdir}/openldap/slapd.d/cn=config.ldif ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
start_slapd=0
|
||||||
|
|
||||||
# upgrade the database
|
# upgrade the database
|
||||||
if [ -f %{_sharedstatedir}/ldap/rpm_upgrade_openldap ]; then
|
if [ -f %{_sharedstatedir}/ldap/rpm_upgrade_openldap ]; then
|
||||||
if /bin/systemctl --quiet is-active slapd.service; then
|
if /bin/systemctl --quiet is-active slapd.service; then
|
||||||
/bin/systemctl stop slapd.service
|
/bin/systemctl stop slapd.service
|
||||||
start=1
|
start_slapd=1
|
||||||
else
|
|
||||||
start=0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%{_libexecdir}/slapd/upgrade-db.sh &>/dev/null
|
%{_libexecdir}/slapd/upgrade-db.sh &>/dev/null
|
||||||
rm -f %{_sharedstatedir}/ldap/rpm_upgrade_openldap
|
rm -f %{_sharedstatedir}/ldap/rpm_upgrade_openldap
|
||||||
|
fi
|
||||||
|
|
||||||
[ $start -eq 1 ] && /bin/systemctl start slapd.service &>/dev/null
|
# conversion from /etc/sysconfig/ldap to /etc/sysconfig/slapd
|
||||||
skip_restart=1
|
if [ $1 -eq 2 ]; then
|
||||||
else
|
# we expect that 'ldap' will be renamed to 'ldap.rpmsave' after removing the old package
|
||||||
skip_restart=0
|
[ -r %{_sysconfdir}/sysconfig/ldap ] || exit 0
|
||||||
|
source %{_sysconfdir}/sysconfig/ldap &>/dev/null
|
||||||
|
|
||||||
|
new_urls=
|
||||||
|
[ "$SLAPD_LDAP" != "no" ] && new_urls="$new_urls ldap:///"
|
||||||
|
[ "$SLAPD_LDAPI" != "no" ] && new_urls="$new_urls ldapi:///"
|
||||||
|
[ "$SLAPD_LDAPS" == "yes" ] && new_urls="$new_urls ldaps:///"
|
||||||
|
[ -n "$SLAPD_URLS" ] && new_urls="$new_urls $SLAPD_URLS"
|
||||||
|
|
||||||
|
failure=0
|
||||||
|
cp -f %{_sysconfdir}/sysconfig/slapd %{_sysconfdir}/sysconfig/slapd.rpmconvert
|
||||||
|
sed -i '/^#\?SLAPD_URLS=/s@.*@SLAPD_URLS="'"$new_urls"'"@' %{_sysconfdir}/sysconfig/slapd.rpmconvert &>/dev/null || failure=1
|
||||||
|
[ -n "$SLAPD_OPTIONS" ] && \
|
||||||
|
sed -i '/^#\?SLAPD_OPTIONS=/s@.*$@SLAPD_OPTIONS="'"$SLAPD_OPTIONS"'"@' %{_sysconfdir}/sysconfig/slapd.rpmconvert &>/dev/null || failure=1
|
||||||
|
|
||||||
|
if [ $failure -eq 0 ]; then
|
||||||
|
mv -f %{_sysconfdir}/sysconfig/slapd.rpmconvert %{_sysconfdir}/sysconfig/slapd
|
||||||
|
else
|
||||||
|
rm -f %{_sysconfdir}/sysconfig/slapd.rpmconvert
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# restart after upgrade
|
# restart after upgrade
|
||||||
if [ $1 -ge 1 -a $skip_restart -ne 1 ]; then
|
if [ $1 -ge 1 ]; then
|
||||||
|
if [ $start_slapd -eq 1 ]; then
|
||||||
|
/bin/systemctl start slapd.service &>/dev/null || :
|
||||||
|
else
|
||||||
/bin/systemctl condrestart slapd.service &>/dev/null || :
|
/bin/systemctl condrestart slapd.service &>/dev/null || :
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user