Subversion Repositories factorylink.sapi

Rev

Blame | Last modification | View Log | Download

#!/bin/sh
#
# Master build utility for the SAPI_S7 task
#

MASTER=$PROJECTS/masters

MODULE="sapi_s7"
VER="001"

echo
echo Master build utility for $MODULE module
echo

#
# check command line parameters
#
if  [ "$MASTER" = "" ]; then
  echo No master directory specified
  exit
elif [ "$FLOS" = "" ]; then
  echo No FactoryLink build id specified
  exit
elif [ "$FLBUILD" = "" ]; then
  echo No FactoryLink build id specified
  exit
fi 

echo
echo Installing $MODULE in $MASTER/$MODULE.$VER/$FLOS$FLBUILD
#
# check if the target directory exists
#
if [ ! -d $MASTER/$MODULE.$VER ]; then
  mkdir $MASTER/$MODULE.$VER;
  mkdir $MASTER/$MODULE.$VER/$FLOS$FLBUILD;
elif [ ! -d $MASTER/$MODULE.$VER/$FLOS$FLBUILD ]; then
  mkdir $MASTER/$MODULE.$VER/$FLOS$FLBUILD;
fi

#
# copy file from build id to bin directory
#
if [ -d $FLOS$FLBUILD ]; then

  if [ ! -s $FLOS$FLBUILD/$MODULE ]; then
    echo $MODULE module does not exist
    exit
  fi

  cp $FLOS$FLBUILD/$MODULE bin/$MODULE

else
  echo Install build id directory not present
  exit
fi

#
# clear previous master 
#

rm -fr $MASTER/$MODULE.$VER/$FLOS$FLBUILD


#
# list the files which must be included in the build image
#
if [ ! -s ac/*.ac     -o   \
     ! -s bin/*       -o   \
     ! -s ctgen/*.ctg -o   \
     ! -s key/*.key   -o   \
     ! -s msg/*.hlp   -o   \
     ! -s msg/*.txt   -o   ]
then
  echo Missing files in install directory !!
  exit
else

  rm -fr *.lst
  rm -fr *.opt
  rm -fr *.ver

  $PROJECTS/$FLOS$FLBUILD/bin/version -M$MODULE -P$PROJECTS/siemens/$MODULE.$VER -B$FLOS$FLBUILD
  cat version.ver        >> option.lst

  ls ac/*.ac    >> option.lst
  ls bin/*    >> option.lst
  ls ctgen/*.ctg  >> option.lst
  ls key/*.key    >> option.lst
  ls msg/*.txt    >> option.lst
  ls msg/*.hlp    >> option.lst
  ls plc/*    >> option.lst

  if [ -s mps/$FLBUILD/*.mps ]
  then
    cp mps/$FLBUILD/*.mps mps
    ls mps/*.mps >> option.lst
  fi

fi

$FLINK/bin/flxcopy -c option.lst $MODULE.opt .
$FLINK/bin/flxcopy -m $MODULE.opt . $MASTER/$MODULE.$VER/$FLOS$FLBUILD

cp $PROJECTS/$FLOS$FLBUILD/flbuild.id $MASTER/$MODULE.$VER/$FLOS$FLBUILD
#echo 'MEDIA=1' >>  $MASTER/$MODULE.$VER/$FLOS$FLBUILD/flxmedia

#
# delete temporary generated files
#
rm -fr *.lst
rm -fr *.opt
rm -fr *.ver

#
# delete the temporary copied multiplatform file
#
if [ -s mps/*.mps ] 
then 
  rm mps/*.mps
fi

#
# Copy the option file separate to the module
#
if [ ! -s opt/*.opt ]; then
  echo No OPT files present !!
else
  if [ ! -d $MASTER/$MODULE.$VER/$FLOS$FLBUILD/opt ]; then
    mkdir $MASTER/$MODULE.$VER/$FLOS$FLBUILD/opt
  fi

  cp opt/*.opt $MASTER/$MODULE.$VER/$FLOS$FLBUILD/opt
fi

#
# Copy the install utility to the build image
#
cp install.unx $MASTER/$MODULE.$VER/$FLOS$FLBUILD/install
cp $PROJECTS/$FLOS$FLBUILD/bin/inst_seq $MASTER/$MODULE.$VER/$FLOS$FLBUILD