Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
99
cde/admin/BuildTools/tog/make_report_dir
Executable file
99
cde/admin/BuildTools/tog/make_report_dir
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/bin/ksh
|
||||
#
|
||||
# make_report_dir
|
||||
#
|
||||
########################################################################
|
||||
#set -x
|
||||
|
||||
##########################################################################
|
||||
#
|
||||
# Script setup: THIS NEEDS TO BE FIRST
|
||||
#
|
||||
SCRIPTS_DIR="`dirname $0`"
|
||||
if [ "" = "$SCRIPTS_DIR" ]; then
|
||||
SCRIPTS_DIR=/project/dt/scripts
|
||||
fi
|
||||
if [ ! -f $SCRIPTS_DIR/script_setup.ksh ]; then
|
||||
print -u2 "$PRG: File '$SCRIPTS_DIR/script_setup.ksh' NOT found!"
|
||||
print -u2 "$PRG: Exiting ..."
|
||||
exit 1
|
||||
fi
|
||||
. $SCRIPTS_DIR/script_setup.ksh
|
||||
|
||||
##########################################################################
|
||||
##########################################################################
|
||||
#
|
||||
# Script specific global variables
|
||||
#
|
||||
##########################################################################
|
||||
##########################################################################
|
||||
|
||||
DEBUG="False"
|
||||
LOG_PATH="/project/dt/logs/build/reports/LATEST"
|
||||
PROG_NAME="`basename $0`"
|
||||
|
||||
usage ()
|
||||
{
|
||||
cat <<eof
|
||||
USAGE: $PROG_NAME
|
||||
[-log_path <path>]
|
||||
[-h | -? | -help]
|
||||
# Print usage and exit
|
||||
#
|
||||
# '$PROG_NAME' creates a directory in the parent of the
|
||||
# specified path. The directory name is derived from the
|
||||
# current date. It then creates a link from the newly
|
||||
# created directory to the specified path in the same
|
||||
# parent directory.
|
||||
eof
|
||||
}
|
||||
|
||||
#
|
||||
# Do command-line processing
|
||||
#
|
||||
while [ $# -gt 0 ]; do
|
||||
|
||||
case $1 in
|
||||
|
||||
-debug)
|
||||
DEBUG="True"
|
||||
shift ;;
|
||||
|
||||
-h | -help | '-?')
|
||||
usage $PROG_NAME
|
||||
do_exit 1 ;;
|
||||
|
||||
-lp | -log_path )
|
||||
if [ $# -lt 2 ]; then
|
||||
print -u2 "$PROG_NAME: $1 option missing value; exiting ..."
|
||||
do_exit 1
|
||||
fi
|
||||
LOG_PATH=$2
|
||||
shift 2 ;;
|
||||
|
||||
*)
|
||||
print -u2 "$PROG_NAME: invalid option $1; exiting ..."
|
||||
do_exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
PARENT_REPORT_DIR=`dirname $LOG_PATH`
|
||||
REPORT_DIR=`basename $LOG_PATH`
|
||||
REPORT_DATE="`date +%h%d`"
|
||||
|
||||
if [ ! -d "$PARENT_REPORT_DIR/$REPORT_DATE" ]; then
|
||||
if [ -h "$PARENT_REPORT_DIR/$REPORT_DATE" ]; then
|
||||
rm "$PARENT_REPORT_DIR/$REPORT_DATE"
|
||||
fi
|
||||
mkdir -p "$PARENT_REPORT_DIR/$REPORT_DATE"
|
||||
fi
|
||||
|
||||
if [ -h "$PARENT_REPORT_DIR/$REPORT_DIR" ]; then
|
||||
rm "$PARENT_REPORT_DIR/$REPORT_DIR"
|
||||
fi
|
||||
ln -s "$REPORT_DATE" "$PARENT_REPORT_DIR/$REPORT_DIR"
|
||||
|
||||
#
|
||||
# Clean up temporary files and exit
|
||||
#
|
||||
do_exit 1
|
||||
Reference in New Issue
Block a user