--- /root/opt-sge-inst_common.sh	2013-05-17 15:01:04.000000000 +1200
+++ sge/util/install_modules/inst_common.sh	2013-07-26 14:03:21.226554799 +1200
@@ -371,6 +371,153 @@
 }
 
 #--------------------------------------------------------------------------
+# CheckBinariesExecd
+#   An attempt to seperate out the master and execd binaries
+#
+CheckBinariesExecd()
+{
+
+   BINFILES_MSTR="sge_qmaster  \
+                  sge_shadowd"
+
+   BINFILES_EXEC="sge_execd \
+                  sge_coshepherd \
+                  sge_shepherd "
+
+   BINFILES="qacct qalter qconf qdel qhold \
+             qhost qlogin qmod qresub qrls qrsh qselect qsh \
+             qstat qsub qtcsh qping qquota sgepasswd"
+
+   WARNBINFILES="qmake qmon"
+
+   WINBINFILES="sge_coshepherd sge_execd sge_shepherd  \
+                qacct qalter qconf qdel qhold qhost qlogin \
+                qmake qmod qresub qrls qrsh qselect qsh \
+                qstat qsub qtcsh qping qquota qloadsensor.exe"
+
+   # This used to insist on rsh et al, but we're likely to build without,
+   # as they involve suid and we normally have SSH and PAM.
+   UTILFILES="adminrun checkprog checkuser filestat gethostbyaddr gethostbyname \
+              gethostname getservbyname loadcheck now qrsh_starter \
+              testsuidroot authuser uidgid infotext"
+
+   WINUTILFILES="SGE_Helper_Service.exe adminrun checkprog checkuser filestat \
+                 gethostbyaddr gethostbyname gethostname getservbyname loadcheck.exe \
+                 now qrsh_starter rlogin rsh rshd testsuidroot authuser.exe uidgid \
+                 infotext SGE_Starter.exe"
+
+   #SUIDFILES="rsh rlogin testsuidroot sgepasswd"
+
+   if [ "$SGE_ARCH" = "win32-x86" ]; then
+      BINFILES="$WINBINFILES"
+      UTILFILES="$WINUTILFILES"
+   fi
+
+   missing=false
+   for f in $BINFILES; do
+      if [ ! -f $SGE_BIN/$f ]; then
+         missing=true
+         $INFOTEXT "missing program >%s< in directory >%s<" $f $SGE_BIN
+         $INFOTEXT -log "missing program >%s< in directory >%s<" $f $SGE_BIN
+      fi
+   done
+
+   for f in $WARNBINFILES; do
+      if [ ! -f $SGE_BIN/$f ]; then
+         $INFOTEXT "missing program >%s< in directory >%s<" $f $SGE_BIN
+         $INFOTEXT "install will continue but some functionality may be missing" $f $SGE_BIN
+         $INFOTEXT -log "missing program >%s< in directory >%s<" $f $SGE_BIN
+         $INFOTEXT -log "install will continue but some functionality may be missing" $f $SGE_BIN
+      fi
+   done
+
+   if [ "$1" = "execd" ]; then
+# Only check EXECD binary files
+     for f in $BINFILES_EXEC; do 
+        if [ ! -f $SGE_BIN/$f ]; then
+           missing=true
+           $INFOTEXT "missing program >%s< in directory >%s<" $f $SGE_BIN
+           $INFOTEXT -log "missing program >%s< in directory >%s<" $f $SGE_BIN
+        fi
+     done
+   else
+# Check EXECD and MSTR binary files to match original operation
+     for f in $BINFILES_MSTR; do 
+        if [ ! -f $SGE_BIN/$f ]; then
+           missing=true
+           $INFOTEXT "missing program >%s< in directory >%s<" $f $SGE_BIN
+           $INFOTEXT -log "missing program >%s< in directory >%s<" $f $SGE_BIN
+        fi
+     done
+   fi
+
+   for f in $UTILFILES; do
+      if [ ! -f $SGE_UTILBIN/$f ]; then
+         missing=true
+         $INFOTEXT "missing program >%s< in directory >%s<" $f $SGE_UTILBIN
+         $INFOTEXT -log "missing program >%s< in directory >%s<" $f $SGE_UTILBIN
+      fi
+   done
+
+   if [ $missing = true ]; then
+      if [ "$SGE_ARCH" = "win32-x86" ]; then
+         $INFOTEXT "\nMissing Grid Engine binaries!\n\n" \
+         "A complete installation needs the following binaries in >%s<:\n\n" \
+         "qacct           qlogin          qrsh            sge_shepherd\n" \
+         "qalter          qmake           qselect         sge_coshepherd\n" \
+         "qconf           qmod            qsh             sge_execd\n" \
+         "qdel            qmon            qstat           qhold\n" \
+         "qresub          qsub            qhost           qrls\n" \
+         "qtcsh           qping           qquota          sgepasswd\n" \
+         "qloadsensor.exe\n\n" \
+         "and the binaries in >%s< should be:\n\n" \
+         "adminrun        gethostbyaddr  loadcheck.exe  rlogin         uidgid\n" \
+         "authuser.exe    checkprog      gethostbyname  now            rsh\n" \
+         "infotext        checkuser      gethostname    rshd\n" \
+         "filestat        getservbyname  qrsh_starter   testsuidroot   SGE_Helper_Service.exe\n" \
+         "SGE_Starter.exe\n\n" \
+         "Installation failed. Exit.\n" $SGE_BIN $SGE_UTILBIN
+      else
+         $INFOTEXT "\nMissing Grid Engine binaries!\n\n" \
+         "A complete installation needs the following binaries in >%s<:\n\n" \
+         "qacct           qlogin          qrsh            sge_shepherd\n" \
+         "qalter          qmake           qselect         sge_coshepherd\n" \
+         "qconf           qmod            qsh             sge_execd\n" \
+         "qdel            qmon            qstat           sge_qmaster\n" \
+         "qhold           qresub          qsub            qhost\n" \
+         "qrls            qtcsh           sge_shadowd     qping\n" \
+         "qquota\n\n" \
+         "and the binaries in >%s< should be:\n\n" \
+         "adminrun       gethostbyaddr  loadcheck      rlogin         uidgid\n" \
+         "authuser       checkprog      gethostbyname  now            rsh\n" \
+         "infotext       checkuser      gethostname    rshd\n" \
+         "filestat       getservbyname  qrsh_starter   testsuidroot\n\n" \
+         "Installation failed. Exit.\n" $SGE_BIN $SGE_UTILBIN
+      fi
+
+      $INFOTEXT -log "\nMissing Grid Engine binaries!\n\n" \
+      "A complete installation needs the following binaries in >%s<:\n\n" \
+      "qacct           qlogin          qrsh            sge_shepherd\n" \
+      "qalter          qmake           qselect         sge_coshepherd\n" \
+      "qconf           qmod            qsh             sge_execd\n" \
+      "qdel            qmon            qstat           sge_qmaster\n" \
+      "qhold           qresub          qsub            qhost\n" \
+      "qrls            qtcsh           sge_shadowd     qping\n" \
+      "qquota\n\n" \
+      "and the binaries in >%s< should be:\n\n" \
+      "adminrun       gethostbyaddr  loadcheck      rlogin         uidgid\n" \
+      "authuser       checkprog      gethostbyname  now            rsh\n" \
+      "infotext       checkuser      gethostname    rshd\n" \
+      "filestat       getservbyname  qrsh_starter   testsuidroot\n\n" \
+      "Installation failed. Exit.\n" $SGE_BIN $SGE_UTILBIN
+
+      MoveLog
+      exit 2 # ToDo: documentation, do not change, exit code used for hedeby
+   fi
+}
+
+
+#--------------------------------------------------------------------------
 # CheckBinaries
 #
 CheckBinaries()
@@ -380,9 +527,11 @@
              sge_execd sge_qmaster  \
              sge_shadowd \
              sge_shepherd qacct qalter qconf qdel qhold \
-             qhost qlogin qmake qmod qmon qresub qrls qrsh qselect qsh \
+             qhost qlogin qmod qresub qrls qrsh qselect qsh \
              qstat qsub qtcsh qping qquota sgepasswd"
 
+   WARNBINFILES="qmake qmon"
+
    WINBINFILES="sge_coshepherd sge_execd sge_shepherd  \
                 qacct qalter qconf qdel qhold qhost qlogin \
                 qmake qmod qresub qrls qrsh qselect qsh \
@@ -415,6 +564,15 @@
       fi
    done
 
+   for f in $WARNBINFILES; do
+      if [ ! -f $SGE_BIN/$f ]; then
+         $INFOTEXT "missing program >%s< in directory >%s<" $f $SGE_BIN
+         $INFOTEXT "install will continue but some functionality may be missing" $f $SGE_BIN
+         $INFOTEXT -log "missing program >%s< in directory >%s<" $f $SGE_BIN
+         $INFOTEXT -log "install will continue but some functionality may be missing" $f $SGE_BIN
+      fi
+   done
+
    for f in $UTILFILES; do
       if [ ! -f $SGE_UTILBIN/$f ]; then
          missing=true
@@ -767,7 +925,7 @@
 CheckConfigFile()
 {
    CONFIG_FILE=$1
-   KNOWN_CONFIG_FILE_ENTRIES_INSTALL="SGE_ROOT SGE_QMASTER_PORT SGE_EXECD_PORT CELL_NAME ADMIN_USER QMASTER_SPOOL_DIR EXECD_SPOOL_DIR GID_RANGE SPOOLING_METHOD DB_SPOOLING_DIR PAR_EXECD_INST_COUNT ADMIN_HOST_LIST SUBMIT_HOST_LIST EXEC_HOST_LIST EXECD_SPOOL_DIR_LOCAL HOSTNAME_RESOLVING SHELL_NAME COPY_COMMAND DEFAULT_DOMAIN ADMIN_MAIL ADD_TO_RC SET_FILE_PERMS RESCHEDULE_JOBS SCHEDD_CONF SHADOW_HOST EXEC_HOST_LIST_RM REMOVE_RC WINDOWS_SUPPORT WIN_ADMIN_NAME WIN_DOMAIN_ACCESS CSP_RECREATE CSP_COPY_CERTS CSP_COUNTRY_CODE CSP_STATE CSP_LOCATION CSP_ORGA CSP_ORGA_UNIT CSP_MAIL_ADDRESS SGE_ENABLE_SMF SGE_CLUSTER_NAME SGE_ENABLE_JMX SGE_JMX_PORT SGE_JVM_LIB_PATH SGE_ADDITIONAL_JVM_ARGS SGE_JMX_SSL SGE_JMX_SSL_CLIENT SGE_JMX_SSL_KEYSTORE SGE_JMX_SSL_KEYSTORE_PW"
+   KNOWN_CONFIG_FILE_ENTRIES_INSTALL="SGE_ROOT SGE_QMASTER_PORT SGE_EXECD_PORT CELL_NAME ADMIN_USER QMASTER_SPOOL_DIR EXECD_SPOOL_DIR GID_RANGE SPOOLING_METHOD DB_SPOOLING_DIR PAR_EXECD_INST_COUNT ADMIN_HOST_LIST SUBMIT_HOST_LIST EXEC_HOST_LIST EXECD_SPOOL_DIR_LOCAL HOSTNAME_RESOLVING SHELL_NAME COPY_COMMAND DEFAULT_DOMAIN ADMIN_MAIL ADD_TO_RC SET_FILE_PERMS RESCHEDULE_JOBS SCHEDD_CONF SHADOW_HOST EXEC_HOST_LIST_RM REMOVE_RC WINDOWS_SUPPORT WIN_ADMIN_NAME WIN_DOMAIN_ACCESS CSP_RECREATE CSP_COPY_CERTS CSP_COUNTRY_CODE CSP_STATE CSP_LOCATION CSP_ORGA CSP_ORGA_UNIT CSP_MAIL_ADDRESS SGE_ENABLE_SMF SGE_CLUSTER_NAME SGE_ENABLE_JMX SGE_JMX_PORT SGE_JVM_LIB_PATH SGE_ADDITIONAL_JVM_ARGS SGE_JMX_SSL SGE_JMX_SSL_CLIENT SGE_JMX_SSL_KEYSTORE SGE_JMX_SSL_KEYSTORE_PW QMASTER_HOSTNAME"
    KNOWN_CONFIG_FILE_ENTRIES_BACKUP="SGE_ROOT SGE_CELL BACKUP_DIR TAR BACKUP_FILE"
    MAX_GID=2147483647 #unsigned int = 32bit - 1
    MIN_GID=100        #from 0 - 100 may be reserved GIDs
@@ -4010,6 +4168,17 @@
    fi
 }
 
+PreInstallCheckExecd()
+{
+   if [ "$SGE_CHECK_BINARIES" != false ]; then
+      if [ $AUTO = "true" -a $QMASTER = "undef" -a $EXECD = "install" ]; then
+         CheckBinariesExecd execd
+      else
+         CheckBinariesExecd
+      fi
+   fi
+}
+
 RemoveHostFromList()
 {
    source_list=$1
