#!/bin/ksh

#
# The point of the script is to simply prevent the case where
# the clock on the HMC may be initially set into the future,
# and this could jepordize the backup of critical HMC data. 
#
# When the user's sets the date/time via either HMC GUI, this
# routine will be called. It will be valid for one time only
# since the comparison file created by the 'finalizeImage'
# script will be erased at the end of this processing.
#

#
# Just in case we have NLS troubles reading system information...
# ...and sure enough we do without this setting! awk(?) command
# returning parsed data inconsistenly
#
LANG=en_US
export LANG

DAT_FILE=/opt/hsc/com/ibm/hsc/websm/launch/hscmgt/hscbuild.dat
CURRENT_TIME=/tmp/cur_time

if [ -f /opt/hsc/data/.time_not_set ]; then
    #
    # Now ensure the file marker is not set in the future
    #
    touch $CURRENT_TIME
    if [ $DAT_FILE -nt $CURRENT_TIME ]; then
        touch $DAT_FILE
    fi
    
    # clean up
    rm -f /opt/hsc/data/.time_not_set
    rm -f $CURRENT_TIME
fi
exit 0
