#!/bin/sh
# Copyright 09/01/00 Sun Microsystems, Inc. All Rights Reserved.
#pragma ident  "@(#)es-makeagent	1.7 02/07/11 Sun Microsystems"

#
#This part of the code does copy of scripts to tmp location
#and then calls itself from there.
#

#
#This function returns 0 if being called from installed place
#else, it returns 1.
#

firstargument="$0"
scriptdirname=`/usr/bin/dirname $firstargument` 
prev_dir=`/usr/bin/pwd`
cd $scriptdirname
l_dir=`/usr/bin/pwd`

check_if_called_from_installed_place ()
{
    echo "$l_dir" | /usr/bin/grep "SUNWsymon/sbin"  > /dev/null 2>&1
    if [ $? -eq 0 ] ; then
        return 0
    fi
    return 1
}

#
#This function returns 0 if being called from disk image
#else, it returns 1.
#

check_if_called_from_disk_image ()
{
    if [ -d "../../disk1/image" ] ; then
        return 0
    fi 
    return 1
}

#
#This function returns 0 if the users shell dir is not
#in the cdrom path. Else it returns 1.
#

check_if_userdirisin_cdromfilesystem ()
{
    mountpoint=`/usr/bin/dirname $l_dir`
    echo "$prev_dir" | /usr/bin/grep "$mountpoint" > /dev/null 2>&1
    if [ $? -eq 0 ] ; then
        return 1
    fi
    return 0
}

COPY_FLAG=0
check_if_called_from_disk_image 
if [ $? -ne 0 ] ; then
    check_if_called_from_installed_place 
    if [ $? -ne 0 ] ; then
        #
        #Assume that it is being called from CD
        #
        if [ -d "../image" ] ; then
            COPY_FLAG=1
            check_if_userdirisin_cdromfilesystem
            if [ $? -eq 0 ] ; then
                EXEC_FLAG=1
            else
                EXEC_FLAG=0
            fi
        fi
    fi
fi

prog_dirname=`/usr/bin/dirname $0`
if [ $COPY_FLAG -eq 0 ] ; then
    cd $prev_dir
else
    OPTION=""
    SRC_DIR=""
    SRC_OPTION_FOUND=0
    while getopts vS:T: OPT
    do
	case $OPT in
	    S)  SRC_DIR="$OPTARG"
		OPTION="$OPTION -S $SRC_DIR"
		SRC_OPTION_FOUND=1
		;;
	    T)
		OPTION="$OPTION -T $OPTARG"
		;;
	    v)
		OPTION="$OPTION -v"
		;;
	esac
    done

    CD_SBIN_DIR="$l_dir"
    cd $CD_SBIN_DIR
    cd ..
    POSSIBLE_SRC_DIR=`/usr/bin/pwd`/image
    if [ $SRC_OPTION_FOUND -eq 0 ] ; then
	cd $CD_SBIN_DIR
	if [ -d "$POSSIBLE_SRC_DIR" ] ; then
	    OPTION="$OPTION -S $POSSIBLE_SRC_DIR"
	fi
    fi

    if [ -d /tmp/SunMC30Install ] ; then

	 /usr/bin/rm -Rf /tmp/SunMC30Install
	 if [ $? -ne 0 ] ; then
	     echolog "Can not remove the directory /tmp/SunMC30Install"
	     exit 1
	 fi
    fi

    /usr/bin/mkdir -p /tmp/SunMC30Install/sbin
    if [ $? -ne 0 ] ; then
	echolog "Can not create the directory /tmp/SunMC30Install/sbin"
	exit 1
    fi
    /usr/bin/cp -Rf $CD_SBIN_DIR/* /tmp/SunMC30Install/sbin/
    if [ $? -ne 0 ] ; then
	echolog "Can not copy the required files to /tmp/SunMC30Install"
	exit 1
    fi
    cd /tmp/SunMC30Install/sbin
    if [ $EXEC_FLAG -eq 1 ] ; then
        commandline=`echo "exec /tmp/SunMC30Install/sbin/es-makeagent $OPTION"`
        $commandline
    else
        /usr/openwin/bin/xhost > /dev/null 2>&1
        if [ $? -eq 0 ] ; then
	    commandline=`echo "/usr/openwin/bin/cmdtool /tmp/SunMC30Install/sbin/es-makeagent $OPTION"`
	    $commandline &
        else
            echolog "Can not open the display. Either X server is not allowing"
            echolog "the connection or you are running it from console login."
            echolog "Please read Sun Management Center installation Readme and"
            echolog "run installation as mentioned."
        fi
    fi
    exit 0

fi

echolog() {
    eval echo "`/usr/bin/gettext "$1"`"
    if [ "$LOGFILE" != "" ] ; then
        eval echo "`/usr/bin/gettext "$1"`" >> "$LOGFILE"
    fi
}

get_input_from_user() {
    question="$1"
    if [ "$LOGFILE" != "" ]; then
        eval echo `/usr/bin/gettext "$question"` " \\\c" >> "$LOGFILE"
    fi
    eval echo  `/usr/bin/gettext "$question"`  " \\\c"

    read answer

    if [ "$LOGFILE" != "" ]; then
        echo "$answer" >> "$LOGFILE"
    fi

}

ask_user() {
    question="$1"
    answer=""
    while [ "$answer" = "" ]
    do
        if [ "$LOGFILE" != "" ] ; then
            eval echo `/usr/bin/gettext "$question"` " \\\c" >> "$LOGFILE"
            eval echo `/usr/bin/gettext '[y\\\|n\\\|q]'` " \\\c" >> "$LOGFILE"
        fi
        eval echo `/usr/bin/gettext "$question"` " \\\c"
        eval echo `/usr/bin/gettext '[y\\\|n\\\|q]'` " \\\c"

        read user_answer

        case "$user_answer" in
                y*) answer=1
                    break
                    ;;
                n*) answer=0
                    break
                    ;;
                q*) answer=2
                    break
                    ;;
                Y*) answer=1
                    break
                    ;;
                N*) answer=0
                    break
                    ;;
                Q*) answer=2
                    break
                    ;;
                *)  echolog ''
                    echo "  \c"
                    echolog 'Enter \\\"y\\\" or \\\"n\\\" or \\\"q\\\"'
                    user_answer=""
                    ;;
        esac
    done
    if [ "$LOGFILE" != "" ] ; then
        echo "$user_answer" >> "$LOGFILE"
    fi


    if [ $answer -eq 2 ]; then
        echolog ''
        echolog 'Exiting at user request'
        echolog ''
        exit 2
    fi
}



# Gets the source directory.
getSourceDirectory() {
    if [ -z "$SRC_DIR" ] ; then
        if [ -d "../image/Addons" ] ; then # Default directory
            currdir=`/usr/bin/pwd`
            cd ../image
            SRC_DIR=`/usr/bin/pwd`
            cd $currdir
            currdir=""
            return
        fi
        echolog 'This version of es-makeagent script will only work for SunMC 3.0 PU4 source image.'
        echolog 'Please ensure the correct image as source image. '
        while get_input_from_user 'Please enter the source directory for SunMC 3.0 PU4 :'
        do
            [ "$answer" = "" ] && continue
            if [ ! -d "$answer/Addons" ] ; then
                echolog "Invalid source directory"
                continue
            fi
            SRC_DIR="$answer"
            break
        done
    else
	if [ ! -d "$SRC_DIR/Addons" ] ; then
	    echolog "Invalid source directory."
	    sleep 5
	    exit 1
	fi
    fi
}

getTargetDirectory() {
    if [ -z "$TARGET_DIR" ] ; then
        while get_input_from_user 'Please enter the target directory:'
        do
            [ "$answer" = "" ] && continue
            if [ ! -d "$answer" ] ; then
                echolog 'Directory $2 does not exist' "$answer"
		TARGET_DIR="$answer"
                ask_user "Do you want to create it"
                if [ $answer -eq 0 ]; then
                    sleep 5
                    exit 1
                fi
                /usr/bin/mkdir -p "$TARGET_DIR" > /dev/null 2>&1
                if [ $? -ne 0 ] ; then
                    echolog 'Could not create the directory $2' "$TARGET_DIR"
                    sleep 5
                    exit 1
                fi
            else
		TARGET_DIR="$answer"
            fi
            break
        done
    else
	if [ ! -d "$TARGET_DIR" ] ; then
	    echolog 'Directory $2 does not exist' "$TARGET_DIR"
	    ask_user "Do you want to create it"
	    if [ $answer -eq 0 ]; then
		sleep 5
		exit 1
	    fi
	    /usr/bin/mkdir -p "$TARGET_DIR" > /dev/null 2>&1
	    if [ $? -ne 0 ] ; then
		echolog 'Could not create the directory $2' "$TARGET_DIR"
		sleep 5
		exit 1
	    fi
	fi
    fi
}

copyCoreProduct () 
{
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/PE/Common 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/PE/Solaris_2.5.1/
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/PE/Solaris_2.6/
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/PE/Solaris_7/
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/PE/Solaris_8/

    #
    # These directories are to comply with es-inst script.
    #

    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/DE/Common 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/DE/Solaris_2.5.1/
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/DE/Solaris_2.6/
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/DE/Solaris_7/
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/DE/Solaris_8/

    echolog "OS directory creation done"
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_2.5.1/locale "$TARGET_DIR"/disk1/image/PE/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_2.6/locale "$TARGET_DIR"/disk1/image/PE/Solaris_2.6/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_7/locale "$TARGET_DIR"/disk1/image/PE/Solaris_7/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_8/locale "$TARGET_DIR"/disk1/image/PE/Solaris_8/
    echolog "locale file copied"

    /usr/bin/cp -f $SRC_DIR/PE/Solaris_2.5.1/installation* "$TARGET_DIR"/disk1/image/PE/Solaris_2.5.1/
    /usr/bin/cp -f $SRC_DIR/PE/Solaris_2.6/installation* "$TARGET_DIR"/disk1/image/PE/Solaris_2.6/
    /usr/bin/cp -f $SRC_DIR/PE/Solaris_7/installation* "$TARGET_DIR"/disk1/image/PE/Solaris_7/
    /usr/bin/cp -f $SRC_DIR/PE/Solaris_8/installation* "$TARGET_DIR"/disk1/image/PE/Solaris_8/

    #
    #These files are to comply with es-inst script.
    #

    /usr/bin/cp -f $SRC_DIR/DE/Solaris_2.5.1/installation* "$TARGET_DIR"/disk1/image/DE/Solaris_2.5.1/
    /usr/bin/cp -f $SRC_DIR/DE/Solaris_2.6/installation* "$TARGET_DIR"/disk1/image/DE/Solaris_2.6/
    /usr/bin/cp -f $SRC_DIR/DE/Solaris_7/installation* "$TARGET_DIR"/disk1/image/DE/Solaris_7/
    /usr/bin/cp -f $SRC_DIR/DE/Solaris_8/installation* "$TARGET_DIR"/disk1/image/DE/Solaris_8/
   
    cd "$TARGET_DIR"/disk1/image/DE
    /usr/bin/ln -s Solaris_8 Solaris_9

    echolog "info files copied"

    /usr/bin/cp -Rf "$SRC_DIR/PE/Solaris_2.5.1/Basic/" "$TARGET_DIR"/disk1/image/PE/Solaris_2.5.1/
    echolog "2.5.1 done"

    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/PE/Solaris_2.6/Basic 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/PE/Solaris_7/Basic 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/PE/Solaris_8/Basic 
    echolog "Basic directory created"

    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_2.6/Basic/SUNWescom $TARGET_DIR/disk1/image/PE/Solaris_2.6/Basic/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_2.6/Basic/SUNWesagt $TARGET_DIR/disk1/image/PE/Solaris_2.6/Basic/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_2.6/Basic/SUNWesmod $TARGET_DIR/disk1/image/PE/Solaris_2.6/Basic/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_2.6/Basic/SUNWesae  $TARGET_DIR/disk1/image/PE/Solaris_2.6/Basic/

    echolog "2.6 done"

    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_7/Basic/SUNWescom $TARGET_DIR/disk1/image/PE/Solaris_7/Basic/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_7/Basic/SUNWesagt $TARGET_DIR/disk1/image/PE/Solaris_7/Basic/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_7/Basic/SUNWesmod $TARGET_DIR/disk1/image/PE/Solaris_7/Basic/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_7/Basic/SUNWesae  $TARGET_DIR/disk1/image/PE/Solaris_7/Basic/
    echolog "2.7 done"

    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_8/Basic/SUNWescom $TARGET_DIR/disk1/image/PE/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_8/Basic/SUNWesagt $TARGET_DIR/disk1/image/PE/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_8/Basic/SUNWesmod $TARGET_DIR/disk1/image/PE/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_8/Basic/SUNWesae  $TARGET_DIR/disk1/image/PE/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/PE/Solaris_8/Basic/SUNWesaem  $TARGET_DIR/disk1/image/PE/Solaris_8/Basic/
    echolog "2.8 done"
    cd "$TARGET_DIR"/disk1/image/PE/
    /usr/bin/ln -s Solaris_8 Solaris_9
   
    echolog "2.9 done"
}

copyAddonProduct ()
{
    #
    #Copy from disk1 
    #

    copyAddonProductDisk1

    #
    #Get the src dir from cd #2
    #

    while [ 1 -eq 1 ]
    do
        if [ -d "${SRC_DIR}/../../disk2/image" ]; then 
            curr_dir=`pwd`
            cd "${SRC_DIR}/../../disk2/image"
            answer=`pwd`
            cd $curr_dir
        else
            cd /
            eject cd
	    tmp_auto="/cdrom/cdrom0/image"
            get_input_from_user 'Please insert the second CD or enter the source directory from disk 2 \\\[$2\\\]' "$tmp_auto"
        fi
        if [ -z "$answer" ] ; then
            answer="/cdrom/cdrom0/image"
        fi

        cd_count=0
        while [ 1 ]
        do
            sleep 1
            if [ -d "$answer" ] ; then
                break
            fi
            cd_count=`/usr/bin/expr $cd_count + 1`
            if [ $cd_count -ge 10 ] ; then
                echolog 'Invalid directory $2' "$answer"
                break
            fi
        done
        if [ ! -d "$answer" ]; then
            echolog 'Invalid directory.'
            echolog ''
            continue
        fi
        SRC_DIR="$answer"
        break
    done
    
    #
    #Copy from disk2
    #

    copyAddonProductDisk2
}

copyAddonProductDisk1 ()
{
   
   
   
#AdvancedMonitoring/#
#AdvancedServices/#
#Desktop/
#EServices/
#Netra/
#SerengetiDomAdmin/
#SerengetiDomDR/
#SerengetiPltAdmin/
#Starfire/#
#Storage/#
#Sun-Fire-15000/
#SunfireDR/#
#SunfireSun4dConfigReader/#
#SystemManagement/
#TNG/#
#Tivoli/
#Visa/
#WorkgroupServer/#

    /usr/bin/mkdir -p "$TARGET_DIR"/disk1/image/Addons/

    echolog "Copying AdvancedMonitoring from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying AdvancedServices from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedServices "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying Desktop from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Desktop "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying EServices from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/EServices "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying Netra from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Netra "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying SerengetiDomAdmin from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomAdmin "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying SerengetiDomDR from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomDR "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying SerengetiPltAdmin from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiPltAdmin "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying Starfire from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying Storage from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."
    
    echolog "Copying Sun-Fire-15000 from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000 "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."
     
    echolog "Copying SunfireDR from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireDR "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying SunfireSun4dConfigReader from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireSun4dConfigReader "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying SystemManagement from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/SystemManagement "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying TNG from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/TNG "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying Tivoli from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Tivoli "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying Visa from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Visa "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

    echolog "Copying WorkgroupServer from disk1 ..." 
    /usr/bin/cp -Rf $SRC_DIR/Addons/WorkgroupServer "$TARGET_DIR"/disk1/image/Addons/.
    echolog "done."

}





copyAddonProductDisk2 ()
{



#AdvancedMonitoring/#
#AdvancedServices/#
#Desktop/
#EServices/
#Netra/
#SerengetiDomAdmin/
#SerengetiDomDR/
#SerengetiPltAdmin/
#Starfire/#
#Storage/#
#Sun-Fire-15000/
#SunfireDR/#
#SunfireSun4dConfigReader/#
#SystemManagement/
#TNG/#
#Tivoli/
#Visa/

#WorkgroupServer/#
    #-----------------------------------------------------------------------------------------------
    echolog "Copying AdvancedMonitoring from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Common/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Common/Basic/SUNWedcom/ "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Common/Basic/. 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_2.6/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_2.6/Basic/SUNWesamn "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_2.6/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_2.6/Basic/SUNWedag "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/AdvancedMonitoring/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_2.6/ 
    if [ -d "$SRC_DIR/Addons/AdvancedMonitoring/Solaris_2.6/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_2.6/ 
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_7/Basic/SUNWesamn "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_7/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_7/Basic/SUNWedag "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_7/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_7/Basic/SUNWedagx "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/AdvancedMonitoring/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_7/ 
    if [ -d "$SRC_DIR/Addons/AdvancedMonitoring/Solaris_7/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_7/ 
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_8/Basic/SUNWesamn "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_8/Basic/SUNWedag "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_8/Basic/SUNWedagx "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/AdvancedMonitoring/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_8/ 
    if [ -d "$SRC_DIR/Addons/AdvancedMonitoring/Solaris_8/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedMonitoring/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/Solaris_8/ 
    fi
 
    cd "$TARGET_DIR"/disk2/image/Addons/AdvancedMonitoring/
    /usr/bin/ln -s Solaris_8 Solaris_9
   
    echolog "done."

    #-----------------------------------------------------------------------------------------------
    echolog "Copying AdvancedServices from disk2 ..." 
    
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Common
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedServices/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_2.6/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedServices/Solaris_2.6/Basic/SUNWesmcp "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/AdvancedServices/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_2.6/
    if [ -d "$SRC_DIR/Addons/AdvancedServices/Solaris_2.6/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedServices/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_2.6/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedServices/Solaris_7/Basic/SUNWesmcp "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/AdvancedServices/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_7/
    if [ -d "$SRC_DIR/Addons/AdvancedServices/Solaris_7/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedServices/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_7/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedServices/Solaris_8/Basic/SUNWesmcp "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/AdvancedServices/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_8/
    if [ -d "$SRC_DIR/Addons/AdvancedServices/Solaris_8/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/AdvancedServices/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/Solaris_8/
    fi
    
    cd  "$TARGET_DIR"/disk2/image/Addons/AdvancedServices/
    /usr/bin/ln -s Solaris_8 Solaris_9
    
    echolog "done."
    
    #--- Desktop -------------------------------------------------------------------------------------
    echolog "Copying Desktop from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Desktop/Common
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Desktop/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/Desktop/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_2.6/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Desktop/Solaris_2.6/Basic/SUNWeswsa "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Desktop/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_2.6/
    if [ -d "$SRC_DIR/Addons/Desktop/Solaris_2.6/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/Desktop/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_2.6/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Desktop/Solaris_7/Basic/SUNWeswsa "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Desktop/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_7/
    if [ -d "$SRC_DIR/Addons/Desktop/Solaris_7/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/Desktop/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_7/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Desktop/Solaris_8/Basic/SUNWeswsa "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Desktop/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_8/
    if [ -d "$SRC_DIR/Addons/Desktop/Solaris_8/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/Desktop/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/Desktop/Solaris_8/
    fi
    cd "$TARGET_DIR"/disk2/image/Addons/Desktop/
    /usr/bin/ln -s Solaris_8 Solaris_9
  
    echolog "done."


    #-----------------------------------------------------------------------------------------------

    #--EServices -------------------------------------------------------------------------------------
    echolog "Copying EServices from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/EServices/Common
    
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/EServices/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/EServices/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_2.6/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/EServices/Solaris_2.6/Basic/SUNWesaes "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/EServices/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_2.6/
    if [ -d "$SRC_DIR/Addons/EServices/Solaris_2.6/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/EServices/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_2.6/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/EServices/Solaris_7/Basic/SUNWesaes "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/EServices/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_7/
    if [ -d "$SRC_DIR/Addons/EServices/Solaris_7/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/EServices/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_7/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/EServices/Solaris_8/Basic/SUNWesaes "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/EServices/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_8/
    if [ -d "$SRC_DIR/Addons/EServices/Solaris_8/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/EServices/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/EServices/Solaris_8/
    fi
    cd "$TARGET_DIR"/disk2/image/Addons/EServices/
    /usr/bin/ln -s Solaris_8 Solaris_9
    
    echolog "done."
  
    #-----------------------------------------------------------------------------------------------

    #-- Netra -------------------------------------------------------------------------------------
    echolog "Copying Netra from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Netra/Common
    
    # No 2.5.1 component for netra available
    #/usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_2.5.1/
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Netra/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/Netra/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_2.6/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Netra/Solaris_2.6/Basic/SUNWesnta "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Netra/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_2.6/
    if [ -d "$SRC_DIR/Addons/Netra/Solaris_2.6/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/Netra/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_2.6/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Netra/Solaris_7/Basic/SUNWesnta "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Netra/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_7/
    if [ -d "$SRC_DIR/Addons/Netra/Solaris_7/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/Netra/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_7/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Netra/Solaris_8/Basic/SUNWesnta "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Netra/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_8/
    if [ -d "$SRC_DIR/Addons/Netra/Solaris_8/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/Netra/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/Netra/Solaris_8/
    fi
    cd "$TARGET_DIR"/disk2/image/Addons/Netra/
    /usr/bin/ln -s Solaris_8 Solaris_9
    echolog "done."

    #-----------------------------------------------------------------------------------------------

    #-- SerengetiDomAdmin -------------------------------------------------------------------------------------
    
    # This agent is only availabel on solaris 8 and 9
    
    echolog "Copying SerengetiDomAdmin from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Common
    
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomAdmin/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_2.6/Basic
    #/usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomAdmin/Solaris_2.6/Basic/SUNWessda "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SerengetiDomAdmin/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_2.6/
    if [ -d "$SRC_DIR/Addons/SerengetiDomAdmin/Solaris_2.6/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomAdmin/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_2.6/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_7/Basic
    #/usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomAdmin/Solaris_7/Basic/SUNWessda "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SerengetiDomAdmin/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_7/
    if [ -d "$SRC_DIR/Addons/SerengetiDomAdmin/Solaris_7/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomAdmin/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_7/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomAdmin/Solaris_8/Basic/SUNWessda "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SerengetiDomAdmin/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_8/
    if [ -d "$SRC_DIR/Addons/SerengetiDomAdmin/Solaris_8/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomAdmin/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/Solaris_8/
    fi

    cd  "$TARGET_DIR"/disk2/image/Addons/SerengetiDomAdmin/
    /usr/bin/ln -s Solaris_8 Solaris_9
  
    echolog "done."

    #-----------------------------------------------------------------------------------------------


    #-- SerengetiDomDR -------------------------------------------------------------------------------------
    echolog "Copying SerengetiDomDR from disk2 ..." 
   
    
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Common
    
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomDR/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_2.6/Basic
    #/usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomDR/Solaris_2.6/Basic/SUNWessda "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SerengetiDomDR/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_2.6/
    if [ -d "$SRC_DIR/Addons/SerengetiDomDR/Solaris_2.6/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomDR/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_2.6/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_7/Basic
    #/usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomDR/Solaris_7/Basic/SUNWessda "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SerengetiDomDR/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_7/
    if [ -d "$SRC_DIR/Addons/SerengetiDomDR/Solaris_7/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomDR/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_7/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomDR/Solaris_8/Basic/SUNWesadf "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SerengetiDomDR/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_8/
    if [ -d "$SRC_DIR/Addons/SerengetiDomDR/Solaris_8/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiDomDR/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR/Solaris_8/
    fi

    cd "$TARGET_DIR"/disk2/image/Addons/SerengetiDomDR
    /usr/bin/ln -s Solaris_8 Solaris_9
    echolog "done."

    #-----------------------------------------------------------------------------------------------




    #-- SerengetiPltAdmin -------------------------------------------------------------------------------------
 
    echolog "Copying SerengetiPltAdmin from disk2 ..." 
    #  SUNWesspa => only one agent package for all OS 
    #
    
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Common
    
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiPltAdmin/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_2.6/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiPltAdmin/Solaris_2.6/Basic/SUNWesspa "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SerengetiPltAdmin/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_2.6/
    if [ -d "$SRC_DIR/Addons/SerengetiPltAdmin/Solaris_2.6/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiPltAdmin/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_2.6/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiPltAdmin/Solaris_7/Basic/SUNWesspa "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SerengetiPltAdmin/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_7/
    if [ -d "$SRC_DIR/Addons/SerengetiPltAdmin/Solaris_7/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiPltAdmin/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_7/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiPltAdmin/Solaris_8/Basic/SUNWesspa "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SerengetiPltAdmin/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_8/
    if [ -d "$SRC_DIR/Addons/SerengetiPltAdmin/Solaris_8/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SerengetiPltAdmin/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin/Solaris_8/
    fi

    cd "$TARGET_DIR"/disk2/image/Addons/SerengetiPltAdmin
    /usr/bin/ln -s Solaris_8 Solaris_9
   
    echolog "done."

    #-----------------------------------------------------------------------------------------------

    #-- Starfire -------------------------------------------------------------------------------------
    
    echolog "Copying Starfire from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/Starfire/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_2.6/Basic
    /usr/bin/cp -f $SRC_DIR/Addons/Starfire/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_2.6/ 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_2.6/ 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire/Solaris_2.6/Basic/SUNWessfd "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_2.6/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire/Solaris_2.6/Basic/SUNWessfp "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Starfire/Solaris_2.6/Basic/domain_checkinstall.sh "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Starfire/Solaris_2.6/Basic/platform_checkinstall.sh "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_2.6/Basic/

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_7/Basic
    /usr/bin/cp -f $SRC_DIR/Addons/Starfire/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_7/ 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_7/ 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire/Solaris_7/Basic/SUNWessfd "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_7/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire/Solaris_7/Basic/SUNWessfp "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Starfire/Solaris_7/Basic/domain_checkinstall.sh "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Starfire/Solaris_7/Basic/platform_checkinstall.sh "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_7/Basic/
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_8/Basic

    /usr/bin/cp -f $SRC_DIR/Addons/Starfire/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_8/ 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_8/ 
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire/Solaris_8/Basic/SUNWessfd "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Starfire/Solaris_8/Basic/SUNWessfp "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Starfire/Solaris_8/Basic/domain_checkinstall.sh "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Starfire/Solaris_8/Basic/platform_checkinstall.sh "$TARGET_DIR"/disk2/image/Addons/Starfire/Solaris_8/Basic/
  
    cd  "$TARGET_DIR"/disk2/image/Addons/Starfire
    /usr/bin/ln -s Solaris_8 Solaris_9
   
    echolog "done."
    #-----------------------------------------------------------------------------------------------


    #-- Storage -------------------------------------------------------------------------------------
    
    echolog "Copying Storage from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Storage/Common
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/Storage/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_2.6/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage/Solaris_2.6/Basic/SUNWessta "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_2.6/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage/Solaris_2.6/Basic/Patches "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_2.6/Basic/
    #/usr/bin/cp -f $SRC_DIR/Addons/Storage/Solaris_2.6/Basic/install-a5x00-patch.sh "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Storage/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_2.6/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_2.6/

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage/Solaris_7/Basic/SUNWessta "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_7/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage/Solaris_7/Basic/Patches "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_7/Basic/
    #/usr/bin/cp -f $SRC_DIR/Addons/Storage/Solaris_7/Basic/install-a5x00-patch.sh "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Storage/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_7/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_7/

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage/Solaris_8/Basic/SUNWessta "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage/Solaris_8/Basic/Patches "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_8/Basic/
    #/usr/bin/cp -f $SRC_DIR/Addons/Storage/Solaris_8/Basic/install-a5x00-patch.sh "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Storage/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_8/
   
    /usr/bin/cp -Rf $SRC_DIR/Addons/Storage/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/Storage/Solaris_8/

    echolog "Done."

    cd "$TARGET_DIR"/disk2/image/Addons/Storage
    /usr/bin/ln -s Solaris_8 Solaris_9
   
    echolog "done."

    #-----------------------------------------------------------------------------------------------


 #-- Sun-Fire-15000 -------------------------------------------------------------------------------------
    
    echolog "Copying Sun-Fire-15000 from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Common
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_2.6/Basic
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_2.6/Basic/SUNWesscd "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_2.6/Basic/
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_2.6/Basic/SUNWesscp "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_2.6/Basic/
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_2.6/Basic/SUNWscsca "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_2.6/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_2.6/Basic/*.sh "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Sun-Fire-15000/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_2.6/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_2.6/


    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_7/Basic
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_7/Basic/SUNWesscd "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_7/Basic/
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_7/Basic/SUNWesscp "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_7/Basic/
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_7/Basic/SUNWscsca "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_7/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_7/Basic/*.sh "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Sun-Fire-15000/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_7/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_7/


    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_8/Basic/SUNWesscd "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_8/Basic/SUNWesscp "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_8/Basic/SUNWscsca "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_8/Basic/*.sh "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Sun-Fire-15000/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_8/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Sun-Fire-15000/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000/Solaris_8/

    cd "$TARGET_DIR"/disk2/image/Addons/Sun-Fire-15000
    /usr/bin/ln -s Solaris_8 Solaris_9
    echolog "done."

    #---- SunfireDR -------------------------------------------------------------------------------------
    
    echolog "Copying SunfireDR from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Common

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_2.6/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireDR/Solaris_2.6/Basic/SUNWesadr "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SunfireDR/Solaris_2.6/dr-availabilty.sh "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_2.6/
    /usr/bin/cp -f $SRC_DIR/Addons/SunfireDR/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_2.6/
    if [ -d "$SRC_DIR/Addons/SunfireDR/Solaris_2.6/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireDR/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_2.6/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireDR/Solaris_7/Basic/SUNWesadr "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SunfireDR/Solaris_7/dr-availabilty.sh "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_7/
    /usr/bin/cp -f $SRC_DIR/Addons/SunfireDR/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_7/
    if [ -d "$SRC_DIR/Addons/SunfireDR/Solaris_7/locale" ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireDR/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_7/
    fi

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireDR/Solaris_8/Basic/SUNWesadr "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SunfireDR/Solaris_8/dr-availabilty.sh "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_8/
    /usr/bin/cp -f $SRC_DIR/Addons/SunfireDR/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_8/
    if [ -d $SRC_DIR/Addons/SunfireDR/Solaris_8/locale ] ; then
       /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireDR/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/SunfireDR/Solaris_8/
    fi
    cd "$TARGET_DIR"/disk2/image/Addons/SunfireDR
    /usr/bin/ln -s Solaris_8 Solaris_9
    
    echolog "Done."

    #------- SunfireSun4dConfigReader --------------------------------------------------------------------------------------
    echolog "Copying SunfireSun4dConfigReader from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Common
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireSun4dConfigReader/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_2.6/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireSun4dConfigReader/Solaris_2.6/Basic/SUNWsycfd "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SunfireSun4dConfigReader/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_2.6/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireSun4dConfigReader/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_2.6/

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireSun4dConfigReader/Solaris_7/Basic/SUNWsycfd "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SunfireSun4dConfigReader/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_7/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireSun4dConfigReader/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_7/

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireSun4dConfigReader/Solaris_8/Basic/SUNWsycfd "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SunfireSun4dConfigReader/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_8/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SunfireSun4dConfigReader/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader/Solaris_8/
    cd "$TARGET_DIR"/disk2/image/Addons/SunfireSun4dConfigReader
    /usr/bin/ln -s Solaris_8 Solaris_9
    
    
    # No locale for this addon
    echolog "Done."   
   
   #-----------------------------------------------------------------------------------------------



    #------- SystemManagement --------------------------------------------------------------------------------------
    echolog "Copying SystemManagement from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Common
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SystemManagement/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/SystemManagement/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_2.6/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SystemManagement/Solaris_2.6/Basic/SUNWesasm "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SystemManagement/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_2.6/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SystemManagement/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_2.6/

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SystemManagement/Solaris_7/Basic/SUNWesasm "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SystemManagement/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_7/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SystemManagement/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_7/

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/SystemManagement/Solaris_8/Basic/SUNWesasm "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/SystemManagement/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_8/
    /usr/bin/cp -Rf $SRC_DIR/Addons/SystemManagement/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/SystemManagement/Solaris_8/
 
    cd "$TARGET_DIR"/disk2/image/Addons/SystemManagement
    /usr/bin/ln -s Solaris_8 Solaris_9

    # No locale for this addon
    echolog "Done."   
   
   #----- TNG ------------------------------------------------------------------------------------------
    echolog "Copying TNG from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/TNG/Common
    /usr/bin/cp -Rf $SRC_DIR/Addons/TNG/Common/Basic/SUNWescad "$TARGET_DIR"/disk2/image/Addons/TNG/Common/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/TNG/Common/Basic/SUNWescas "$TARGET_DIR"/disk2/image/Addons/TNG/Common/Basic/
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_2.5.1/
    /usr/bin/cp -Rf $SRC_DIR/Addons/TNG/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/TNG/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_2.6/
    /usr/bin/cp -f $SRC_DIR/Addons/TNG/Solaris_2.6/Basic/check-remote-install.sh "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_2.6/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/TNG/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_2.6/ 
    /usr/bin/cp -Rf $SRC_DIR/Addons/TNG/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_2.6/ 
   
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_7/
    /usr/bin/cp -f $SRC_DIR/Addons/TNG/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_7/ 
    /usr/bin/cp -f $SRC_DIR/Addons/TNG/Solaris_7/Basic/check-remote-install.sh "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_7/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/TNG/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_7/ 
   
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_8/
    /usr/bin/cp -f $SRC_DIR/Addons/TNG/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_8/ 
    /usr/bin/cp -f $SRC_DIR/Addons/TNG/Solaris_8/Basic/check-remote-install.sh "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/TNG/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/TNG/Solaris_8/ 
    cd "$TARGET_DIR"/disk2/image/Addons/TNG
    /usr/bin/ln -s Solaris_8 Solaris_9

    echolog "Done."
   #-----------------------------------------------------------------------------------------------

   #----- Tivoli ------------------------------------------------------------------------------------------
    echolog "Copying TNG from disk2 ...no agent component" 
    echolog "Done."
   #-----------------------------------------------------------------------------------------------


   #------- Visa --------------------------------------------------------------------------------------
    echolog "Copying Visa from disk2 ..." 
    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Visa/Common
    
    # No 2.5.1 / 2.6 support for visa
    #/usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_2.5.1/
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Visa/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/Visa/ 

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_7/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Visa/Solaris_7/Basic/SUNWvisad "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_7/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Visa/Solaris_7/Basic/SUNWesvig "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_7/Basic/
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Visa/Solaris_7/Basic/Patches "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_7/Basic/
    #/usr/bin/cp -f $SRC_DIR/Addons/Visa/Solaris_7/Basic/platform_check.sh "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_7/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Visa/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_7/
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Visa/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_7/

    /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_8/Basic
    /usr/bin/cp -Rf $SRC_DIR/Addons/Visa/Solaris_8/Basic/SUNWvisad "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_8/Basic/
    /usr/bin/cp -Rf $SRC_DIR/Addons/Visa/Solaris_8/Basic/SUNWesvig "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_8/Basic/
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Visa/Solaris_8/Basic/Patches "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_8/Basic/
    /usr/bin/cp -f $SRC_DIR/Addons/Visa/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_8/
    #/usr/bin/cp -f $SRC_DIR/Addons/Visa/Solaris_8/Basic/platform_check.sh "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_8/Basic/
    #/usr/bin/cp -Rf $SRC_DIR/Addons/Visa/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/Visa/Solaris_8/

    cd "$TARGET_DIR"/disk2/image/Addons/Visa
    /usr/bin/ln -s Solaris_8 Solaris_9
    
    echolog "Done."   
   
   #-----------------------------------------------------------------------------------------------

   #------- WorkgroupServer --------------------------------------------------------------------------------------
 
   echolog "Copying WorkgroupServer from disk2 ..."
   /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_2.5.1/
   /usr/bin/cp -Rf $SRC_DIR/Addons/WorkgroupServer/Solaris_2.5.1/ "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/

   /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_2.6/Basic
   /usr/bin/cp -f $SRC_DIR/Addons/WorkgroupServer/Solaris_2.6/installation* "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_2.6/
   /usr/bin/cp -Rf $SRC_DIR/Addons/WorkgroupServer/Solaris_2.6/locale "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_2.6/
   /usr/bin/cp -Rf $SRC_DIR/Addons/WorkgroupServer/Solaris_2.6/Basic/SUNWeswga "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_2.6/Basic/
   
   /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_7/Basic
   /usr/bin/cp -f $SRC_DIR/Addons/WorkgroupServer/Solaris_7/installation* "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_7/
   /usr/bin/cp -Rf $SRC_DIR/Addons/WorkgroupServer/Solaris_7/locale "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_7/
   /usr/bin/cp -Rf $SRC_DIR/Addons/WorkgroupServer/Solaris_7/Basic/SUNWeswga "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_7/Basic/
   
   /usr/bin/mkdir -p "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_8/Basic
   /usr/bin/cp -f $SRC_DIR/Addons/WorkgroupServer/Solaris_8/installation* "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_8/
   /usr/bin/cp -Rf $SRC_DIR/Addons/WorkgroupServer/Solaris_8/locale "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_8/
   /usr/bin/cp -Rf $SRC_DIR/Addons/WorkgroupServer/Solaris_8/Basic/SUNWeswga "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer/Solaris_8/Basic/
  
    cd "$TARGET_DIR"/disk2/image/Addons/WorkgroupServer
    /usr/bin/ln -s Solaris_8 Solaris_9
    
   echolog "Done."   
   
   #-----------------------------------------------------------------------------------------------
  
   


}

makeTarFile () 
{
    echolog "Creating tar file, please wait..." 
    /usr/bin/tar -cf "$TARGET_DIR"/SunMC30.tar "$TARGET_DIR"/disk1 "$TARGET_DIR"/disk2
    echolog "Done."
}

##############################
#
# Start Main Here
#
##############################

prog_base=`/usr/bin/basename $0`
#common_cmd=`echo $0 | /usr/bin/sed s/$prog_base/es-common.sh/`
#. $common_cmd

# Get command line parameters
SRC_DIR=""
TARGET_DIR=""
while getopts S:T:v ARG
do
    case $ARG in
        S)  SRC_DIR="$OPTARG"
            if [ ! -d "$SRC_DIR" ]; then
                echo ''
                echolog 'Invalid directory: $2' "$SRC_DIR"
                exit 1
            fi
            ;;
        T)  
            TARGET_DIR="$OPTARG"
            ;;
        v)  VERBOSE=ON
            ;;
    esac
done
#set_commondirs ""
#check_for_l10n
#LOCALE_CODE="$L10N_CODE"
#[ "$LOCALE_CODE" = "en" ] && LOCALE_CODE="C"

#setup_textdomain
#check_root
LOGFILE=""

echo ''
getSourceDirectory
echo ''
getTargetDirectory

#SRC_DIR and TARGET_DIR is set

#
#Remove disk1 and disk2 directory is already present
#

/usr/bin/rm -Rf "$TARGET_DIR"/disk1
/usr/bin/rm -Rf "$TARGET_DIR"/disk2

#
#Creeate disk1 directory
#

/usr/bin/mkdir -p "$TARGET_DIR"/disk1/image 
/usr/bin/mkdir -p "$TARGET_DIR"/disk2/image 
/usr/bin/mkdir -p "$TARGET_DIR"/disk1/sbin 
/usr/bin/cp -Rf "$SRC_DIR"/../sbin "$TARGET_DIR"/disk1/

copyCoreProduct
copyAddonProduct

makeTarFile
echolog 'Agent only product is ready in $2' "$TARGET_DIR"

