$NetBSD: patch-bd,v 1.3 2015/12/25 20:12:16 joerg Exp $

--- source/scripts/distinst.orig	2012-05-23 19:04:39.000000000 +0000
+++ source/scripts/distinst
@@ -75,13 +75,13 @@ DRMAA_SHARED_LIBRARIES="libdrmaa"
 # The last number listed here will be the verson linked from libdrmaa.so
 DRMAA_SHARED_LIB_VERSIONS="1.0"
 DRMAA_HEADER_FILES="libs/japi/drmaa.h"
-DRMAAJ_FILES="CLASSES/jdrmaa/drmaa"
+#DRMAAJ_FILES="CLASSES/jdrmaa/drmaa"
 
 JNI_SHARED_LIBRARIES="libdrmaa libjuti libjgdi"
 
-JUTIJ_FILES="CLASSES/juti/juti"
-JGDIJ_FILES="libs/jgdi/build/jgdi"
-JJSV_FILES="CLASSES/jjsv/JSV"
+#JUTIJ_FILES="CLASSES/juti/juti"
+#JGDIJ_FILES="libs/jgdi/build/jgdi"
+#JJSV_FILES="CLASSES/jjsv/JSV"
 JAVA_LIBRARIES="${DRMAAJ_FILES} ${JUTIJ_FILES} ${JGDIJ_FILES} ${JJSV_FILES}"
 
 PVMSOURCES="start_pvm.c stop_pvm.c slave.c master.c spmd.c Makefile"
@@ -430,7 +430,7 @@ instclassictargets=false
 instopenssl=true
 instbdb=true
 instarco=false
-instguiinst=true
+instguiinst=false
 instsgeinspect=false
 accept_prompts=false
 enforce_shlibpath=false
@@ -530,11 +530,11 @@ while [ $# -ge 1 ]; do
          echo Please set variable SGE_ROOT. Installation failed.
          exit 1
       fi
-      if [ ! -d $SGE_ROOT ]; then
-         echo Please create directory \"$SGE_ROOT\" first. Installation failed.
+      if [ ! -d "$DESTDIR$SGE_ROOT" ]; then
+         echo Please create directory \"$DESTDIR$SGE_ROOT\" first. Installation failed.
          exit 1
       fi
-      DEST_SGE_ROOT=$SGE_ROOT
+      DEST_SGE_ROOT=$DESTDIR$SGE_ROOT
       localinst=true
       ;;
    -mansrc)
@@ -901,13 +901,16 @@ if [ $instcommon = true ]; then
                         $DEST_SGE_ROOT/util/sgeCA/*.cnf \
                         $DEST_SGE_ROOT/util/sgeSMF/*.xml \
                         $DEST_SGE_ROOT/util/sgeSMF/sge_smf_support.sh \
-                        $DEST_SGE_ROOT/util/DetectJvmLibrary.jar \
                         $DEST_SGE_ROOT/util/resources/calendars/* \
                         $DEST_SGE_ROOT/util/resources/centry/* \
                         $DEST_SGE_ROOT/util/resources/pe/* \
                         $DEST_SGE_ROOT/util/resources/schemas/*/* \
                         $DEST_SGE_ROOT/util/resources/usersets/*
 
+      if [ -f $DEST_SGE_ROOT/util/DetectJvmLibrary.jar ] ; then
+          Execute chmod 644 $DEST_SGE_ROOT/util/DetectJvmLibrary.jar
+      fi
+
       Execute chmod 755 $DEST_SGE_ROOT/util/resources/jsv/jsv.sh \
                         $DEST_SGE_ROOT/util/resources/jsv/jjsv.sh \
                         $DEST_SGE_ROOT/util/resources/jsv/jsv.pl \
@@ -1089,9 +1092,6 @@ if [ $instcommon = true ]; then
 
       if [ -f CLASSES/herd/herd.jar ]; then
          Execute cp CLASSES/herd/herd.jar $DEST_SGE_ROOT/lib/herd.jar
-      elif [ $exit_on_error = true ]; then
-         echo "\"CLASSES/herd/herd.jar\" not found. Installation failed."
-         exit 1
       fi
    fi
 
@@ -1121,11 +1121,14 @@ if [ $instcommon = true ]; then
 
       Execute find $DEST_SGE_ROOT/man -type d | xargs chmod 755
       Execute find $DEST_SGE_ROOT/man -type f | xargs chmod 644
-
-      Execute find $DEST_SGE_ROOT/catman -type d | xargs chmod 755
-      Execute find $DEST_SGE_ROOT/catman -type f | xargs chmod 644
       
-      Cleanup man catman
+      Cleanup man
+
+      if [ -d MANSBUILD_$MANSRCDIR/ASCMAN/catman ]; then
+         Execute find $DEST_SGE_ROOT/catman -type d | xargs chmod 755
+         Execute find $DEST_SGE_ROOT/catman -type f | xargs chmod 644
+        Cleanup catman
+      fi
    fi
 
    if [ $instdoc = true ]; then
