All pastes #820033 Raw Edit

Stuff

public text v1 · immutable
·published 2007-12-17 10:24 UTC
rendered paste body
#!/bin/sh
# -*- shell-script -*-

# ----------------------------------------------------------------------------
#
#    file: disupd.sh
#    purpose: shell script / installation of cip update 
#    project: CIP
#    customer: BMW AG, VS-40
#    author: Rainer Hackl, ESG
#
#    This is the installation script for installing a service package as update
#
#    history: February, 11th 2002 - inital creation.
#    history: February, 22th 2002 - version check extended
#    history: April, 18th 2002 - sw-inventory managment
#    history: 2005-03 - changes for tpa-28130
# ----------------------------------------------------------------------------

source=/home/cd/das/cd1

BMW_INSTALL=/home

logfile=/home/dis/cipupdate.log
OK_STATUS=0

# START
SAVEDIR=`pwd`

echo ----------------------------------------------------- >>$logfile
echo Update start >>$logfile
echo Erstellungsdatum: Mon Feb 11 2002 >>$logfile
echo -n "Installationsdatum: `date`">>$logfile
date >>$logfile
echo Installationsmedium: CD >>$logfile
echo BMW_INSTALL: $BMW_INSTALL >>$logfile
EXT=`line <$BMW_INSTALL/etc/langdas`
echo Spracheextention: $EXT >>$logfile
echo --------------------- >>$logfile

# VERSION CHECK

# preceding version installed
cd $source/check

$source/upd/chkver.sh $source/check check.dat >>$logfile
RESULT=$?
if [ $RESULT != 0 ] 
then
  #expected version not found
  $source/errdlg/errdlg.sh $source/errdlg $RESULT
  echo expected version not found >> $logfile
  #exit 0
  # No Usershell Dialog
  exit 7
fi


cd $BMW_INSTALL

### pre-installation code
#

for i in $source/inst/*pre.sh
do
  echo "preinstallationscript $i started `date`" >>$logfile
  $i $logfile >> $logfile
  OK_STATUS=$?
  echo "preinstallationscript $i finished:$OK_STATUS" >>$logfile
  if [ $OK_STATUS != 0 ]  
  then
     $source/errdlg/errdlg.sh $source/errdlg 4
     rm /home/sgc/pi/pi.txt
     #exit 0
     # No Usershell Dialog
     exit 7
  fi 
done

#
# CIP-B Installation
#
echo start installation >> $logfile
cd /home

for i in $source/data/int/*.tgz $source/data/int/*.TGZ $source/data/$EXT/*.tgz $source/data/$EXT/*.TGZ
do
    pkg=`basename $i .tgz"`
    if /etc/gunzip -c $i | tar xf -    
    then
      echo "CIP package $pkg installed!" >>$logfile
    else
      echo "CIP package $pkg not installed!" >>$logfile        
      $source/errdlg/errdlg.sh $source/errdlg 4
	rm /home/sgc/pi/pi.txt
      exit 1  # disable all applications  
    fi
done
echo "installation packages extracted `date`" >> $logfile

### post-installation code
#

for i in $source/inst/*post.sh
do
  echo "postinstallationscript $i started `date`" >>$logfile
  $i $logfile >> $logfile
  OK_STATUS=$?
  echo "postinstallationscript $i finished:$OK_STATUS" >>$logfile
  if [ $OK_STATUS != 0 ]  
  then
     $source/errdlg/errdlg.sh $source/errdlg 4
     rm /home/sgc/pi/pi.txt
     exit 1    # disable all applications
  fi 
done


echo "CIP - $EXT installed !!! `date`" >>$logfile

echo installation finished >> $logfile

echo --------------------- >>$logfile
echo neue Versionsdatei: >>$logfile
cat $BMW_INSTALL/etc/version.sw >>$logfile
echo --------------------- >>$logfile
echo Update erfolgreich beendet >>$logfile

cd $SAVEDIR

exit 0