Richard Allen Megginson (rmeggins) wrote:
Author: rmeggins
Update of /cvs/dirsec/ldapserver/ldap/cm/newinst
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5458
Modified Files:
ns-update
Log Message:
Bug(s) fixed: 185364
Bug Description: Can't update scripts (e.g., start-slapd) in the instance directory
Reviewed by: ???
Reviewed by: Noriko (Thanks!)
Fix Description: ns-update needs to run ds_create -r for each
instance in the server root because the start-slapd et. al. scripts that it needs to
recreate are per-instance. The install.inf passed in from setup only contains the
information in the [General] and [admin] section. We need to supply the missing
information for the [slapd] section to make both create_scripts() and
reconfigure_instance() happy.
Platforms tested: RHEL4
Flag Day: no
Doc impact: no
Index: ns-update
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/cm/newinst/ns-update,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ns-update 23 Feb 2006 19:30:41 -0000 1.11
+++ ns-update 12 Oct 2006 19:38:14 -0000 1.12
@@ -46,6 +46,42 @@
sroot=`echo $0 | sed s#/bin/slapd/admin/bin/.\*##g`
PERL=perl # just use perl from PATH
+# run_ds_create "$sroot" "$dir" "$inffile"
+run_ds_create()
+{
+ sroot="$1"
+ shift
+ dir="$1"
+ shift
+ inffile="$1"
+
+ # the inffile is incomplete - it needs the instance specific stuff
+ dseldif=$sroot/$dir/config/dse.ldif
+ port=`grep \^nsslapd-port: $dseldif | sed -e s/\^nsslapd-port:[\ \ ]*//`
+ rootdn=`grep \^nsslapd-rootdn: $dseldif | sed -e s/\^nsslapd-rootdn:[\ \ ]*//`
+ id=`echo $dir | sed -e s/^slapd-//`
+ suffix="o=NetscapeRoot"
+
+ realfile=/tmp/fds$$.inf
+ cp $inffile $realfile
+ echo "" >> $realfile
+ echo "[slapd]" >> $realfile
+ echo "ServerIdentifier= $id" >> $realfile
+ echo "ServerPort= $port" >> $realfile
+ echo "RootDN= $rootdn" >> $realfile
+ # dummy password
+ echo "RootDNPwd= password" >> $realfile
+ echo "Suffix= $suffix" >> $realfile
+
+ cwd=`pwd`
+ cd `dirname $0`
+
+ ./ds_create -r -f $realfile
+
+ rm -f $realfile
+ cd $cwd
+}
+
start_server()
{
NETSITE_ROOT=$1
@@ -60,16 +96,26 @@
cd $cwd
}
+# get the inf file name
+seenfarg=
+inffile=
+
# if the -r flag is present, this means we're doing a
# reinstall or an upgrade, so restart the servers
-for arg in $* ; do
+for arg in "$@" ; do
if [ "$arg" = "-r" ]; then
reconfig=1
fi
if [ "$arg" = "-S" ]; then
iDSISolaris=1
fi
-
+ if [ $seenfarg ]; then
+ inffile="$arg"
+ seenfarg=
+ fi
+ if [ "$arg" = "-f" ]; then
+ seenfarg=1
+ fi
done
extraflags=
@@ -114,6 +160,10 @@
echo Starting $dir . . .
start_server $sroot $dir
echo ""
+
+ # more reconfiguration
+ run_ds_create "$sroot" "$dir" "$inffile"
"$extraflags" "$@"
+
done
# fix any non-instance specific files - omit server instance argument
$PERL $sroot/bin/slapd/admin/bin/upgradeServer $sroot
@@ -124,19 +174,6 @@
# we need to make sure the alias directory is owned by the server user/group
# in order for the server to be able to create the initial key/cert db files
-# get the inf file name
-seenfarg=
-inffile=
-for arg in "$@" ; do
- if [ $seenfarg ] ; then
- inffile=$arg
- break
- fi
- if [ "$arg" = "-f" ] ; then
- seenfarg=1
- fi
-done
-
if [ ! -f "$inffile" ] ; then
echo "WARNING: Could not read the setup info file $inffile"
else
@@ -149,7 +186,10 @@
fi
rc=0
-./ds_create $* $extraflags
+# not reconfig - run ds_create as usual
+if test -z "$reconfig" ; then
+ ./ds_create $* $extraflags
+fi
rc=$?
# chown the cookie directory - bug 175098
--
Fedora-directory-commits mailing list
Fedora-directory-commits(a)redhat.com
https://www.redhat.com/mailman/listinfo/fedora-directory-commits