#!/bin/sh
#
# $Header: gitools/src/asm/asru/1.0/ASRU /main/2 2011/08/08 18:46:49 pvenkatr Exp $
#
# ASRU
#
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 
#
#    NAME
#      ASRU - Script to release space to the storage subsystem
#
#    DESCRIPTION
#      Wrapper script to invoke commands to make a given diskgroup
#      thin provisioing friendly. This scripts involves the perl script
#      that drives the execution of other related scripts.
#
#    USAGE
#       ASRU [--delta percent] <dg_name>
#
#    NOTES
#      <other useful comments, qualifications, etc.>
#
#    MODIFIED   (MM/DD/YY)
#    canuprem    06/20/11 - 12658856: Fix the pl file path
#    pbagal      03/08/10 - More comments
#    canuprem    03/01/10 - Creation
#

ECHO=/bin/echo 

if [ "${ORACLE_HOME}" = "" ] ; then

  ${ECHO} "ORACLE_HOME is not set."
  exit -1
fi

LD_LIBRARY_PATH="${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}"
LD_LIBRARY_PATH="${ORACLE_HOME}/lib32:${LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH

PERLBIN="${ORACLE_HOME}/perl/bin/perl"

PERLV=`${PERLBIN} -e 'printf "%vd", $^V'`

PERLINC="-I ${ORACLE_HOME}/perl/lib/${PERLV}"
PERLINC="${PERLINC} -I ${ORACLE_HOME}/perl/lib/site_perl/${PERLV}"

# Look in the current dir for the pl file. if not present, look 
# in the same dir as this file.

if [ -e "${PWD}/ASRU.pl" ]; then
   RUNTHIS="${PERLBIN} -w ${PERLINC} ${PWD}/ASRU.pl"
else
   RUNTHIS="${PERLBIN} -w  ${PERLINC} $0.pl"
fi

exec ${RUNTHIS} "$@"
