summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2005-04-19 03:28:37 +0000
committerRich Megginson <rmeggins@redhat.com>2005-04-19 03:28:37 +0000
commit0f8ad07feef269f4c87fcd570593ae432cddc711 (patch)
treebb4415af429b1cc2f3530afa1144061298a329de
parent23d52597d11b1ba094335d20608c9d0b774e0b92 (diff)
downloadds-0f8ad07feef269f4c87fcd570593ae432cddc711.tar.gz
ds-0f8ad07feef269f4c87fcd570593ae432cddc711.tar.xz
ds-0f8ad07feef269f4c87fcd570593ae432cddc711.zip
Bug(s) fixed: 153955
Bug Description: RPM install: A suffix must be a valid DN Reviewed by: Noriko (Thanks!) Fix Description: Rob found that the setup script did not work on his box. It seems that there is no canonical way to get the FQDN. So, this fix uses various different ways - hostname, hostname -f, hostname -a, and host `hostname` - and just uses the longest one, assuming it is the FQDN. Platforms tested: RHEL3 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: none
-rwxr-xr-xldap/cm/newinst/setup25
1 files changed, 20 insertions, 5 deletions
diff --git a/ldap/cm/newinst/setup b/ldap/cm/newinst/setup
index 8523b7be..e0c2402e 100755
--- a/ldap/cm/newinst/setup
+++ b/ldap/cm/newinst/setup
@@ -109,6 +109,25 @@ ask123() {
return $ans
}
+getFQDN() {
+ max=0
+ maxhost=
+ defhost=`hostname`
+ echo "getFQDN: hostname = $defhost" >> $logfile
+ hosthost=`host $defhost | grep -v "not found" | awk '{print $1}'`
+ echo "getFQDN: host $defhost = $hosthost" >> $logfile
+ for host in $defhost $hosthost `hostname -f` `hostname -a` ; do
+ len=`echo $host | wc -c`
+ echo "getFQDN: host $host has length $len" >> $logfile
+ if [ $len -gt $max ]; then
+ max=$len
+ maxhost=$host
+ echo "getFQDN: new max host $host has length $max" >> $logfile
+ fi
+ done
+ echo $maxhost
+}
+
logfile=`doMktmp log`
myargs=
silent=
@@ -192,11 +211,7 @@ if ! [ $silent ]; then
tmpinffile=1
# put some common answers in the file
- hostname=`hostname -f`
- tryhost=`host $hostname | grep -v "not found" | awk '{print $1}'`
- if [ "$tryhost" ] ; then
- hostname=$tryhost
- fi
+ hostname=`getFQDN`
if ! [ $hostname ] ; then
hostname=localhost.localdomain
fi