[Orca-checkins] rev 259 - in trunk/orca: . contrib/rotate_orca_graphs data_gatherers/orca_services data_gatherers/orcallator

Blair Zajac blair at orcaware.com
Mon Oct 6 21:11:15 PDT 2003


Author: blair
Date: Mon Oct  6 21:11:01 2003
New Revision: 259

Modified:
   trunk/orca/configure.in
   trunk/orca/contrib/rotate_orca_graphs/rotate_orca_graphs.sh.in
   trunk/orca/data_gatherers/orca_services/start_orca_services.sh.in
   trunk/orca/data_gatherers/orca_services/stop_orca_services.sh.in
   trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in
   trunk/orca/data_gatherers/orcallator/stop_orcallator.sh.in
Log:
Scripts that use program locations determined by configure now check
if configure did find a required program.  This is to prevent the
script from failing in the middle of its work.

* configure.in:
  No longer set set CUT to cut, EXPR to expr or UNAME to uname if the
  respective program path cannot be found.  This lets scripts know if
  a required program wasn't found on the system.

* contrib/rotate_orca_graphs/rotate_orca_graphs.sh.in
  (variable_is_set_or_exit): New utility function checks if the
    specified variable has non-zero string length or exits the program
    otherwise.
  (main):
    Check that ARCHIVE_DIR exists and is a directory.
    Use variable_is_set_or_exit to check that HTML_DIR and TAR are
      set.

* data_gatherers/orcallator/stop_orcallator.sh.in
  (variable_is_set_or_exit): New utility function.
  (main): Use variable_is_set_or_exit to check that AWK is set.

* data_gatherers/orcallator/start_orcallator.sh.in
  (variable_is_set_or_exit): New utility function.
  (main): Use variable_is_set_or_exit to check that AWK, COMPRESSOR,
    CUT, EXPR, and UNAME are set.

* data_gatherers/orca_services/start_orca_services.sh.in
  (variable_is_set_or_exit): New utility function.
  (main): Use variable_is_set_or_exit to check that AWK, CUT and UNAME
    are set.

* data_gatherers/orca_services/stop_orca_services.sh.in
  (variable_is_set_or_exit): New utility function.
  (main): Use variable_is_set_or_exit to check that AWK is set.


Modified: trunk/orca/configure.in
==============================================================================
--- trunk/orca/configure.in	(original)
+++ trunk/orca/configure.in	Mon Oct  6 21:11:01 2003
@@ -272,8 +272,8 @@
 AC_PATH_PROG(BUNZIP2, bunzip2)
 AC_PATH_PROG(CHKCONFIG, chkconfig)
 AC_PATH_PROG(COMPRESS, compress)
-AC_PATH_PROG(CUT, cut, cut)
-AC_PATH_PROG(EXPR, expr, expr)
+AC_PATH_PROG(CUT, cut)
+AC_PATH_PROG(EXPR, expr)
 AC_PATH_PROGS(TAR,gtar gnutar tar)
 AC_PATH_PROG(GZIP, gzip)
 AC_PATH_PROG(GUNZIP, gunzip)
@@ -293,8 +293,8 @@
 AC_PATH_PROG(POD2MAN,  pod2man,  :)
 AC_PATH_PROG(POD2TEXT, pod2text, :)
 
-AC_PATH_PROG(SE, se,,$PATH:/opt/RICHPse/bin)
-AC_PATH_PROG(UNAME, uname, uname)
+AC_PATH_PROG(SE, se, , $PATH:/opt/RICHPse/bin)
+AC_PATH_PROG(UNAME, uname)
 AC_PATH_PROG(UNCOMPRESS, uncompress)
 
 # Determine the correct flags to compress files depending upon the compress

Modified: trunk/orca/contrib/rotate_orca_graphs/rotate_orca_graphs.sh.in
==============================================================================
--- trunk/orca/contrib/rotate_orca_graphs/rotate_orca_graphs.sh.in	(original)
+++ trunk/orca/contrib/rotate_orca_graphs/rotate_orca_graphs.sh.in	Mon Oct  6 21:11:01 2003
@@ -12,26 +12,49 @@
 # Set this directory to archive the daily plots in.
 ARCHIVE_DIR=
 
-DATE=`date +%Y-%m-%d`
 HTML_DIR=@HTML_DIR@
 TAR=@TAR@
 
+# This utility function checks if the specified variable has non-zero
+# string length or exits the program otherwise.  This is used to make
+# sure that all required substitutions performed by 'configure' set
+# the variable.
+variable_is_set_or_exit()
+{
+  eval value="\$$1"
+  if test -z "$value"; then
+    echo "$0: configure did not set \$$1, please edit $0 and set it." 1>&2
+    exit 1
+  fi
+}
+
 if test -z "$ARCHIVE_DIR"; then
-  echo "$0: please edit $0 to set ARCHIVE_DIR" 1>&2
+  echo "$0: please edit $0 to set ARCHIVE_DIR." 1>&2
+  exit 1
+fi
+
+if test ! -d "$ARCHIVE_DIR"; then
+  echo "$0: $ARCHIVE_DIR does not exist or is not a directory." 1>&2
   exit 1
 fi
 
+variable_is_set_or_exit HTML_DIR
+variable_is_set_or_exit TAR
+
 # Make sure that the Orca and archive HTML directories are not the
 # same.
-cd $ARCHIVE_DIR
-dir2=`pwd`
 cd $HTML_DIR
 dir1=`pwd`
+cd $ARCHIVE_DIR
+dir2=`pwd`
 if test "$dir1" = "$dir2"; then
-  echo "$0: HTML_DIR $dir1 and ARCHIVE_DIR $dir2 are the same directory" 1>&2
+  echo "$0: HTML_DIR $dir1 and ARCHIVE_DIR $dir2 are the same directory." 1>&2
   exit 1
 fi
 
+DATE=`date +%Y-%m-%d`
+
+# Use /bin/test instead of test which supports the -e test.
 if /bin/test ! -e $ARCHIVE_DIR/$DATE; then
   mkdir $ARCHIVE_DIR/$DATE || exit 1
 fi

Modified: trunk/orca/data_gatherers/orca_services/start_orca_services.sh.in
==============================================================================
--- trunk/orca/data_gatherers/orca_services/start_orca_services.sh.in	(original)
+++ trunk/orca/data_gatherers/orca_services/start_orca_services.sh.in	Mon Oct  6 21:11:01 2003
@@ -3,16 +3,34 @@
 # This script runs orca_services with the proper options for your
 # site.
 
-# Define program locations that will be needed.
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libexecdir=@libexecdir@
 sysconfdir=@sysconfdir@
+
+# Define program and directory locations that will be needed.
 AWK=@AWK@
 CUT=@CUT@
 UNAME=@UNAME@
 RAW_ORCA_SERVICES_DIR=@VAR_DIR@/orca_services
 
+# This utility function checks if the specified variable has non-zero
+# string length or exits the program otherwise.  This is used to make
+# sure that all required substitutions performed by 'configure' set
+# the variable.
+variable_is_set_or_exit()
+{
+  eval value="\$$1"
+  if test -z "$value"; then
+    echo "$0: configure did not set \$$1, please edit $0 and set it." 1>&2
+    exit 1
+  fi
+}
+
+variable_is_set_or_exit AWK
+variable_is_set_or_exit CUT
+variable_is_set_or_exit UNAME
+
 # Get the hostname without the fully qualified part; that is, trim off
 # anything past the first `.'.
 uname=`$UNAME -n | $CUT -d. -f1`

Modified: trunk/orca/data_gatherers/orca_services/stop_orca_services.sh.in
==============================================================================
--- trunk/orca/data_gatherers/orca_services/stop_orca_services.sh.in	(original)
+++ trunk/orca/data_gatherers/orca_services/stop_orca_services.sh.in	Mon Oct  6 21:11:01 2003
@@ -2,6 +2,21 @@
 
 AWK=@AWK@
 
+# This utility function checks if the specified variable has non-zero
+# string length or exits the program otherwise.  This is used to make
+# sure that all required substitutions performed by 'configure' set
+# the variable.
+variable_is_set_or_exit()
+{
+  eval value="\$$1"
+  if test -z "$value"; then
+    echo "$0: configure did not set \$$1, please edit $0 and set it." 1>&2
+    exit 1
+  fi
+}
+
+variable_is_set_or_exit AWK
+
 # Kill any running orca_services.
 pids=`/usr/ucb/ps auxww | $AWK '/orca_services/ && !/awk/ {print $2}'`
 if test "$pids" != ""; then

Modified: trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in
==============================================================================
--- trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in	(original)
+++ trunk/orca/data_gatherers/orcallator/start_orcallator.sh.in	Mon Oct  6 21:11:01 2003
@@ -2,10 +2,11 @@
 
 # This script runs orcallator.se with the proper options for your site.
 
-# Define program locations that will be needed.
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
+
+# Define program and directory locations that will be needed.
 AWK=@AWK@
 COMPRESSOR="@COMPRESSOR@"
 CUT=@CUT@
@@ -40,7 +41,7 @@
 #SE_PATCHES="$SE_PATCHES -DHME_PATCH"
 #SE_PATCHES="$SE_PATCHES -DHME_PATCH_IFSPEED"
 
-# Check if the SE executable was found upon configure.
+# Check if the SE executable was found from configure.
 if test -z "$SE"; then
   cat <<END 1>&2
 When you configured Orca the se executable was not found.  If you
@@ -59,6 +60,25 @@
   exit 1
 fi
 
+# This utility function checks if the specified variable has non-zero
+# string length or exits the program otherwise.  This is used to make
+# sure that all required substitutions performed by 'configure' set
+# the variable.
+variable_is_set_or_exit()
+{
+  eval value="\$$1"
+  if test -z "$value"; then
+    echo "$0: configure did not set \$$1, please edit $0 and set it." 1>&2
+    exit 1
+  fi
+}
+
+variable_is_set_or_exit AWK
+variable_is_set_or_exit COMPRESSOR
+variable_is_set_or_exit CUT
+variable_is_set_or_exit EXPR
+variable_is_set_or_exit UNAME
+
 SE_VERSION=`$SE -version | $AWK '{print $4}'`
 case "$SE_VERSION" in
   3.2.1|3.[3-9]*)

Modified: trunk/orca/data_gatherers/orcallator/stop_orcallator.sh.in
==============================================================================
--- trunk/orca/data_gatherers/orcallator/stop_orcallator.sh.in	(original)
+++ trunk/orca/data_gatherers/orcallator/stop_orcallator.sh.in	Mon Oct  6 21:11:01 2003
@@ -2,6 +2,21 @@
 
 AWK=@AWK@
 
+# This utility function checks if the specified variable has non-zero
+# string length or exits the program otherwise.  This is used to make
+# sure that all required substitutions performed by 'configure' set
+# the variable.
+variable_is_set_or_exit()
+{
+  eval value="\$$1"
+  if test -z "$value"; then
+    echo "$0: configure did not set \$$1, please edit $0 and set it." 1>&2
+    exit 1
+  fi
+}
+
+variable_is_set_or_exit AWK
+
 # Kill any running orcallators.
 pids=`/usr/ucb/ps auxww | $AWK '/orcallator.se/ && !/awk/ {print $2}'`
 if test "$pids" != ""; then



More information about the Orca-checkins mailing list