#!/bin/sh

# This script is used in MFG to preload HMC code.

if [ ! -f /sysroot/disk1.img ]; then
   echo "*** Required file disk1.img not found on server."
   exit 1
 fi
if [ ! -f /sysroot/base.img ]; then
   echo "*** Required file base.img not found on server."
   exit 1
fi

mkdir -p /base
mount -o loop /sysroot/base.img /base

/opt/hmc/bin/HmcInstall
if [ $? -ne 0 ]; then
   echo "An error has occured during the installation..."
   echo "See /tmp/HmcInstall.log for details...."
   exit 1
fi
/opt/hmc/bin/mfgSetup
if [ $? -ne 0 ]; then
   echo "An error has occured during the setup for MFG install..."
   exit 1
fi
exit 0
