[Fedora-directory-commits] ldapserver/ldap/cm/newinst setup, 1.10, 1.11

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Tue Oct 4 17:04:09 UTC 2005


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/cm/newinst
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26789/newinst

Modified Files:
	setup 
Log Message:
[167982] Service Pack framework
Ported the patch making code from Directory71RtmBranch to the trunk.



Index: setup
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/cm/newinst/setup,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- setup	2 Sep 2005 23:33:48 -0000	1.10
+++ setup	4 Oct 2005 17:03:47 -0000	1.11
@@ -130,6 +130,13 @@
 	echo $maxhost
 }
 
+getValFromAdminConf() {
+	cattr=$1
+	cfile=$2
+	rval=`grep -i $cattr $sroot/admin-serv/config/$cfile | awk '{print $2}'`
+	echo $rval
+}
+
 logfile=`doMktmp log`
 myargs=
 silent=
@@ -188,6 +195,61 @@
 	askYN "Continue?"
 fi
 
+# check whether it is an in-place installation
+if [ -f $sroot/admin-serv/config/adm.conf ]; then
+	dsinst=`getValFromAdminConf "ldapStart:" "adm.conf" | awk -F/ '{print $1}'`
+	if [ -f $sroot/$dsinst/config/dse.ldif ]; then
+		# it is an in=place installation
+		ldaphost=`getValFromAdminConf "ldapHost:" "adm.conf"`
+		ldapport=`getValFromAdminConf "ldapPort:" "adm.conf"`
+		adminport=`getValFromAdminConf "\<port:" "adm.conf"`
+		siepid=`getValFromAdminConf "siepid:" "adm.conf"`
+		sysuser=`getValFromAdminConf "nsSuiteSpotUser:" "local.conf"`
+		suitespotuser=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $3}'`
+		suitespotgroup=`ls -l $sroot/$dsinst/config/dse.ldif | awk '{print $4}'`
+		admindomain=`echo $ldaphost | awk -F. '{print $5 ? $2 "." $3 "." $4 "." $5: $4 ? $2 "." $3 "." $4 : $3 ? $2 "." $3 : $2 ? $2 : ""}'`
+		if [ "$admindomain" = "" ]; then
+    		admindomain=`domainname`
+		fi
+
+		echo "In order to reconfigure your installation, the Configuration Directory"
+		echo "Administrator password is required.  Here is your current information:"
+		echo ""
+		echo "Configuration Directory: ldap://$ldaphost:$ldapport/o=NetscapeRoot"
+		echo "Configuration Administrator ID: $siepid"
+		echo ""
+		echo "At the prompt, please enter the password for the Configuration Administrator."
+		echo ""
+		echo "administrator ID: $siepid"
+		siepasswd=""
+		while [ "$siepasswd" = "" ]; do
+    		printf "Password: "
+    		read siepasswd
+		done
+
+		inffile=$sroot/setup/myinstall.inf
+		echo "[General]" > $inffile
+		echo "FullMachineName=   $ldaphost" >> $inffile
+		echo "SuiteSpotUserID=   $suitespotuser" >> $inffile
+		echo "SuitespotGroup=   $suitespotgroup" >> $inffile
+		echo "ServerRoot=   $sroot" >> $inffile
+		echo "ConfigDirectoryLdapURL=   ldap://$ldaphost:$ldapport/o=NetscapeRoot" >> $inffile
+		echo "ConfigDirectoryAdminID=   $siepid" >> $inffile
+		echo "AdminDomain=   $admindomain" >> $inffile
+		echo "ConfigDirectoryAdminPwd=   $siepasswd" >> $inffile
+		echo "" >> $inffile
+		echo "[admin]" >> $inffile
+		echo "ServerAdminID=   $siepid" >> $inffile
+		echo "ServerAdminPwd=   $siepasswd" >> $inffile
+		echo "SysUser=   $sysuser" >> $inffile
+		echo "Port=   $adminport" >> $inffile
+		echo "ServerIpAddress=" >> $inffile
+
+		# set silent mode
+		silent=1
+	fi
+fi
+
 # dsktune
 if ! [ $silent ]; then
 	bin/slapd/server/dsktune | tee -a $logfile
@@ -251,13 +313,10 @@
 	# check if ds instance directory exists or not
 	# if it does, run ns-config with the reconfigure option
 	doreconfig=""
-	for x in `ls -d slapd-*`
-	do
-		if [ -d $x ]; then
-			doreconfig="-r"
-			break
-		fi
-	done
+	ls -d slapd-* > /dev/null 2>&1
+	if [ $? -eq 0 ]; then
+		doreconfig="-r"
+	fi
 
 	# first, run ds
 	cd bin/slapd/admin/bin
@@ -266,7 +325,7 @@
 
 	# next, run admin
 	cd bin/admin
-	./ns-config -f $inffile -l $logfile -m $installmode || doExit
+	./ns-config -f $inffile -l $logfile -m $installmode $doreconfig || doExit
 	cd ../..
 fi
 
@@ -278,7 +337,7 @@
 
 `pwd`/bin/slapd/admin/bin/ns-update $silentarg $myargs -f $inffile | tee -a $logfile || doExit
 
-`pwd`/bin/admin/ns-update $silentarg $myargs -f $inffile | tee -a $logfile || doExit
+`pwd`/bin/admin/ns-update $doreconfig $silentarg $myargs -f $inffile | tee -a $logfile || doExit
 
 echo "INFO Finished with setup, logfile is setup/setup.log" | tee -a $logfile
 if [ -f setup/setup.log ] ; then




More information about the Fedora-directory-commits mailing list