/***************************************************************************/
/*                                                                         */
/* Copyright (c) 1995 SiS Corp. Setup Utility                              */
/*                                                                         */
/***************************************************************************/

Trace 'O'
Address CMD
'@ECHO ON'

/**************/
/* Initialize */
/**************/
Call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
Call sysloadfuncs

toolpath = ''
bootdrive = Substr(Translate(Value('PATH',,'OS2ENVIRONMENT')),Pos('\OS2\SYSTEM',Translate(Value('PATH',,'OS2ENVIRONMENT')))-2,2)
tooldrive = bootdrive
toolpath=tooldrive||"\SISDRV"


/* ================================================= */
/* [Yeou] add for the ASUS request                   */
/*  To warning user cannot execute the sisinst.cmd   */
/*  before execute setup.cmd  6/27/96                */
/* ================================================= */
Call CheckConfig


Say " *------------------------------------------------------------------*"
Say " * SiS Inc. SVGA installation for OS/2 3.0...                       *"
Say " *==================================================================*"
Say " *                                                                  *"
Say " * This installation program will make a directory in boot drive.   *"
Say " * example: md c:\sisdrv                                            *"
Say " *                                                                  *"
Say " *------------------------------------------------------------------*"
"md" ""||bootdrive||"\sisdrv  "

Say ""
Say " Copy Files ...........Please Wait"

'@ECHO OFF'
"copy svga.exe"  ""||bootdrive||"\os2 > NUL"
"copy frate2.exe" ""||bootdrive||"\os2  > NUL"
"copy ddc.exe" ""||bootdrive||"\os2  > NUL"

"copy" "*.* "||toolpath||"\*.* > NUL "
"copy" ""||toolpath||"\sis.in@ "||bootdrive||"\os2\sis.ini > NUL"
"md" ""||toolpath||"\temp > NUL"
""||bootdrive||""
"cd" ""||toolpath||"\temp > NUL"
""||bootdrive||"\os2\unpack ..\s768256.dl@ > NUL "
""||bootdrive||"\os2\unpack ..\ibmvga32.dl@ > NUL"
""||bootdrive||"\os2\unpack ..\bvhsvga.dl@ > NUL "
""||bootdrive||"\os2\unpack ..\vga256.dr@  > NUL "
""||bootdrive||"\os2\unpack ..\vga64k.dr@  > NUL"
""||bootdrive||"\os2\unpack ..\vga16m.dr@  > NUL"
""||bootdrive||"\os2\unpack ..\vga256s.dr@ > NUL"
""||bootdrive||"\os2\unpack ..\vga64ks.dr@ > NUL"
""||bootdrive||"\os2\unpack ..\vga16ms.dr@ > NUL"
""||bootdrive||"\os2\unpack ..\vsvga.sy@   > NUL"
"cd .. > NUL"


/* call sis.cmd to setup the sis icon */
/* 12/18/95 */
/* for fix the problem of Janpanese OS/2 version first install icon error */
If tooldrive <> '' Then Do
  Call SysCreateObject 'WPProgram', 'SiS Setup','<WP_DESKTOP>','OBJECTID=<TK_SISDRV>;EXENAME='||toolpath||'\notebook.exe;PROGTYPE=PM;ICONFILE='||toolpath||'\sis.ico','R'
End


if "%1"=="" then
""||toolpath||"\sissetup"
else
""||toolpath||"\sissetup %1 %2 %3 %4"

"del "||toolpath||"\temp\*.drv  > NUL"
"del "||toolpath||"\temp\*.dll  > NUL"
"del "||toolpath||"\temp\*.sys  > NUL"
"rd temp > NUL"

'@ECHO ON'
Say ""
Say ""
Say " *---------------------------------------------------------------------*"
Say " * This program will now create a icon for SiS SVGA Display Driver and *"
Say " * its identified components on your desktop.                          *"
Say " *                                                                     *"
Say " * If you want to change resolution, please run system icon of System  *"
Say " * Setup Group in PM or run the SiS Setup icon after reboot.           *"
Say " *---------------------------------------------------------------------*"


EndCmd:
Exit 0


/***************************/
/* Check the CONFIG.SYS    */
/***************************/

CheckConfig:   /* check the config.sys file for DBCS */
config=bootdrive'\CONFIG.SYS'

os2vvga='DEVICE='bootdrive'\OS2\MDOS\VVGA.SYS'

/* read the file one line at a time */
Do while lines(config)
    inline=linein(config)

    /******************************************/
    /* parse the line into variable and value */
    /******************************************/

    parse value inline with os2var ' ' os2value

    /********************************************************/
    /* translate the variable into uppercase for comparison */
    /********************************************************/

    os2var=translate(os2var)
    if os2var=os2vvga Then Do
       '@cls'
       Say ' '
       Say ' '
       Say ' '
       Say '  !!!!!!! Warning !!!!!!!'
       Say '  Please run the setup.cmd'
       Say ' '
       result = lineout(config)
       Call EndCmd
    End

End /* Do */

/*********************/
/* close the files   */
/*********************/
result=lineout(config)
return 0
