#
# Crystal Chips BootManager Installer PBAT Script v1.1
#
# (c) 2005 Crystal Chips - http://www.crystal-chips.com/
#
# For use only with Crystal Chips hardware and software.
#
# Modification Info:
# This file is unmodified.  If you modify this script and distribute it,
#   please edit this text.  Please do not change the copyright information.
#
# Description:
#
# This script is used by BootManager(BM) to install itself.
# You can modify this script to install additional modules, graphics, etc.
#

SET "SRC_BOOT" "$PWD$/BOOT"
SET "DST_BOOT" "mc0:/BOOT"

SET "SRC_BM" "$SRC_BOOT$/BM"
SET "DST_BM" "$DST_BOOT$/BM"

# Make the directories
MKDIR "$DST_BOOT$"
MKDIR "$DST_BOOT$/APPS"
MKDIR "$DST_BOOT$/SHARED"
MKDIR "$DST_BM$"
MKDIR "$DST_BM$/MEDIA"

# Copy user-specified background image, if available
COPY "$SRC_BM$/BMBG.IIF" "$DST_BM$/BMBG.IIF"

# Copy files needed by BM
IF FAIL COPY "$SRC_BOOT$/BOOT.ELF" "$DST_BOOT$/BOOT.ELF"
    RETURN "-1"
ELSEIF FAIL COPY "$SRC_BM$/BMINIT.PBT" "$DST_BM$/BMINIT.PBT"
    RETURN "-1"
ELSEIF FAIL COPY "$SRC_BOOT$/REDIR.IRX" "$DST_BOOT$/REDIR.IRX"
    RETURN "-1"
ELSEIF FAIL COPY "$SRC_BOOT$/ICON.SYS" "$DST_BOOT$/ICON.SYS"
    RETURN "-1"
ELSEIF FAIL COPY "$SRC_BOOT$/BMAN.ICN" "$DST_BOOT$/BMAN.ICN"
    RETURN "-1"
ELSEIF FAIL COPY "$SRC_BM$/LOADEXEC.PBT" "$DST_BM$/LOADEXEC.PBT"
    RETURN "-1"
ELSEIF FAIL COPY "$SRC_BM$/BOOTMENU.PBT" "$DST_BM$/BOOTMENU.PBT"
    RETURN "-1"
ELSEIF FAIL COPY "$SRC_BM$/PS1LOGO.BIN" "$DST_BM$/PS1LOGO.BIN"
    RETURN "-1"
ELSEIF FAIL COPY "$SRC_BM$/PS1LOGO2.BIN" "$DST_BM$/PS1LOGO2.BIN"
    RETURN "-1"
ENDIF

# Copy USBD.IRX(main USB driver) and USBMASS.IRX(USB HDD driver) if they're there. NOTE: will not fail if files
#   do not exist.
COPY "$SRC_BOOT$/SHARED/USBD.IRX" "$DST_BOOT$/SHARED/USBD.IRX"
COPY "$SRC_BOOT$/SHARED/USBMASS.IRX" "$DST_BOOT$/SHARED/USBMASS.IRX"

# Copy additional files such as HDD drivers, net drivers, etc.
