From 3e16300236c102f1d7752f67728a322cdf3ec853 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Wed, 14 Jan 2009 20:29:10 -0600
Subject: Revised logic for hostname check. Fix /myth UUID for installs.

---
 abs/core-testing/LinHES-config/PKGBUILD            |  2 +-
 .../LinHES-config/install_functions.sh             |  7 ++++++
 abs/core-testing/LinHES-config/install_proxy.sh    | 29 +++++++++++-----------
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 8676d36..c25ee7e 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=1.0
-pkgrel=185
+pkgrel=191
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
 pkgdesc="Install and configure your system"
 depends=(bc libstatgrab  mysql-python expect curl dnsutils parted sg3_utils nmbscan )
diff --git a/abs/core-testing/LinHES-config/install_functions.sh b/abs/core-testing/LinHES-config/install_functions.sh
index b412663..fd84d6c 100755
--- a/abs/core-testing/LinHES-config/install_functions.sh
+++ b/abs/core-testing/LinHES-config/install_functions.sh
@@ -446,10 +446,17 @@ case $1 in
                       FOUNDUUID=""
                       if [ x$4 = x ]
                       then
+                        #upgrade
+                        find_uuid ${2}3
+                      elif [ x$5 = xFULL_INSTALL ]
+                      then
+                        #install
                         find_uuid ${2}3
                       else
+                        #upgrade with non statndard myth
                         find_uuid $4
                       fi
+
                       DATAUUID=$FOUNDUUID
 
 
diff --git a/abs/core-testing/LinHES-config/install_proxy.sh b/abs/core-testing/LinHES-config/install_proxy.sh
index b910ec4..011dfac 100755
--- a/abs/core-testing/LinHES-config/install_proxy.sh
+++ b/abs/core-testing/LinHES-config/install_proxy.sh
@@ -581,11 +581,11 @@ echo "-----------------------------------------------------------------------3--
                                             echo "network check myself"
                                             ifconfig
                                             ping -c 1 $myipdefault
-                                                    if [ ! $? = 0 ]
-                                                    then
-                                                        exit 3
-                                                        #can't ping yourself
-                                                    fi
+                                            if [ ! $? = 0 ]
+                                            then
+                                                exit 3
+                                                #can't ping yourself
+                                            fi
                                 ;;
                                 check_gw)
                                             #check gateway
@@ -623,7 +623,7 @@ echo "-----------------------------------------------------------------------3--
                                 ;;
                                 host_names)
                                             #if host is found, then check to see if it's online
-                                            #if not online, assume it's ok to use this hostname
+                                            #if hoip matchs my ip assume it's ok
                                             echo "network check my hostname $hostname"
                                             hout=`host $hostname`
                                             status=$?
@@ -631,21 +631,20 @@ echo "-----------------------------------------------------------------------3--
                                             if [ $status = 0 ]
                                             then
                                                 hoip=`echo $hout|awk  '{print $4}'`
-                                                ping -c 1 $hoip
+                                                /sbin/ifconfig -a |grep -q $hoip
                                                 if [  $? = 0 ]
                                                 then
+                                                    echo "DNS ip matches on of my ips"
                                                     status=0
                                                 else
-                                                    status=1
+                                                    echo "IP in DNS but doesn't match mine, hostname is not safe to use"
+                                                    status=7
                                                 fi
+                                            else
+                                              echo "Couldn't find hostname in DNS, must be safe to use"
+                                              status=0
                                             fi
-
-                                            if [  $status = 0 ]
-                                            then
-                                                exit 7
-                                            fi
-
-
+                                            exit $status
                                 ;;
 
                             esac
-- 
cgit v0.12

