;
; @(#)instxm.ibm	1.1 8/17/90 12:45:10
;
; Main installation script for IBM X-Windows for IBM DOS
;
; Default values
;
set src         "%INSTDRIVE%"
set srcdflt     "%INSTDRIVE%"
set dst         "C:\XSIGHT\"
set instvar     "install.vr0"
set mousetype   "mouse3"
set kbtype      "kb101"
set fontset     "75dpi"
set nettype     "lcc"
set scnsize     "dsp13"
set scnwid      245
set scnhgt      175
set pcxopts	"%XSIGHT%"
set startcmd	"%XSTARTUP%"
ifnull "%startcmd%" set startcmd "telnet"

set firstpass   "yes"
;
; set display colors appropriately for color or monochrome display
;
goto %displaytype% mono
colors work 0x17 menu 0x17 0x71 help 0x1e display 0x17 input 0x1e
goto color
:mono
colors work 0x07 menu 0x70 0x07 help 0x0f display 0x07 input 0x0f
:color

newwork
helpline 14
work
                   IBM X-Windows for IBM DOS Release 2.1.1

          Copyright 1990, International Business Machines Corporation
                Copyright 1989,1990 Locus Computing Corporation
..
prompt ""
help
Use the up and down arrow keys to change your selection.
Press enter to choose the current selection.

"Full Installation" will install IBM X-Windows on your hard disk from
the distribution diskettes.

"Change Configuration" allows you to change certain configuration
parameters without reinstalling IBM X-Windows.

"Install Fonts" allows you to install fonts from the Supplemental 
Fonts Disk.
..
menu insttype 7 28
" Full Installation "           full
" Change Configuration "        configonly
" Install Fonts "               instsupp
" Quit"                         quit
..
goto %insttype% quit full
set dst "%cwd%"
:full
:askagain
newwork
prompt "Destination directory:  "
help
Enter the drive and directory where you want IBM X-Windows installed.

You may edit the directory name with these keys:

left arrow - move cursor left          right arrow - move cursor right
home       - goto beginning of line    end         - goto end of line
backspace  - delete before cursor      del         - delete at cursor
ins        - toggle insert mode        esc         - clear input
..
:askdest
indir dirvar "%dst%" invdir
checkdrive ddtype "%dirvar%"
goto %ddtype% harddisk
parsepath ddtype "%dirvar%" "d:"
display

%ddtype% is not a hard disk drive.  Please specify a destination
directory on a hard disk drive.
..
goto askdest
:harddisk
parsepath ddtype "%dirvar%" "p"
goto "%ddtype%isroot" isroot
goto notroot
:isroot
display

Cannot install into root directory.
..
goto askdest
:notroot
set dst "%dirvar%"
check ddtype "%dst%"
goto %ddtype%1 nodir1
goto %insttype% configonly instsupp
display

The directory %dst% exists.
Do you wish to install over it?
..
menu ddcheck 0 40
" Yes "         ddok
" No "          askdest
" Quit "        quit
..
display
..
:configonly
:instsupp
goto %ddcheck% askdest quit
ifeq "%firstpass%" "no" goto nodir1
check ddtype "%dst%%instvar%"
call var%ddtype% varfile
;
; If XSIGHT environment variable set, use it to override anything in
; the variable file.
;
ifneq "%XSIGHT%" "" set pcxopts "%XSIGHT%"
set firstpass "no"
:nodir1
;
; If src is not a diskette drive, try an alternative
;
checkdrive ddtype "%src%"
ifneq "%ddtype%" "diskette" set src "%srcdflt%"
goto %insttype% instsupp
;
; Ask configuration questions
;
prompt "Mouse Buttons:         "
help
Choose the entry corresponding to the number of buttons on your mouse.

If you have a two button mouse and wish to simulate the middle button by
simultaneously depressing both buttons choose the "Simulated 3 Button"
entry.
..
menu mousetype 0 16 display "%mousetype%"
" 2 Button "   mouse2
" 3 Button "   mouse3
" Simulated 3 Button " mouse3sim
..

prompt "Keyboard Type:         "
help
Choose the entry that matches your keyboard.

The 84 key keyboard has 10 function keys on the left of the keyboard.

The 101 key keyboard has 12 function keys across the top of the keyboard
and a set of dedicated cursor keys.
..
menu kbtype 0 16 display "%kbtype%"
" 84 Key Keyboard "     kb84
" 101 Key Keyboard "    kb101
..

prompt "Display Size:          "
help
The actual size of your display is required so that IBM X-Windows can
properly inform X clients of your display resolution.

You may choose the diagonal measurement that most closely matches your
monitor.  If none of the diagonal measurements are appropriate or you
wish to enter a more accurate measurement, choose Custom Display Size.

If you choose Custom Display Size, you will be required to enter the
measurements in millimeters.
..
menu scnsize 0 16 display "%scnsize%"
" 13 Inch (33 cm) Display "             dsp13
" 15 Inch (38 cm) Display "             dsp15
" 19 Inch (48 cm) Display "             dsp19
" Custom Display Size "                  custdsp
..
goto %scnsize%
:dsp13
set scnwid 245
set scnhgt 184
goto scncont
:dsp15
set scnwid 280
set scnhgt 210
goto scncont
:dsp19
set scnwid 360
set scnhgt 270
goto scncont
:mdsgenius
set scnwid 190
set scnhgt 255
goto scncont
:cnrsp
set scnwid 205
set scnhgt 280
goto scncont
:cnrdp
set scnwid 410
set scnhgt 280
goto scncont
:cnr1280
set scnwid 375
set scnhgt 265
goto scncont
:custdsp
help
Enter the width and height, in millimeters, of the displayable
area of your screen.

There are 25.4 millimeters to an inch.

You should measure only the area of your screen in which data is 
displayed.
..
prompt "Screen Width:           "
innumber scnwid "%scnwid%"
prompt "Screen Height:          "
innumber scnhgt "%scnhgt%"
goto scncont
:scncont
prompt "IBM X-Windows Options:  "
help
Enter any IBM X-Windows command line options that you would like to
use regularly.

If you wish to change your default options, you should run install and
choose the "Change Configuration" option, rather than editing the X.BAT
file directly.
..
instr pcxopts "%pcxopts%"
prompt "Startup Command:        "
help
Enter the command that IBM X-Windows should issue to start your X sessions.

If you do not know an appropriate command at this time, accept the default
response.  You may use the "Change Configuration" option of this install
program to change your startup command later, after you have consulted the
IBM X-Windows documentation.
..
instr startcmd "%startcmd%"
goto %insttype% configonly
prompt "Install Fonts:         "
help
You should choose either the "75 Dot Per Inch" or "100 Dot Per Inch"
fonts, whichever most closely matches the resolution of your display.

The "Required Fonts" selection may be used for a quick installation
or if you are short on disk space.  The "All Fonts" selection is
provided if you think there will be some reason that you will
regularly need to switch between the two font sets.
..
menu fontset 0 16 display "%fontset%"
" 75 Dot Per Inch "     75dpi
" 100 Dot Per Inch "    100dpi
" Required Fonts "      reqfonts
" All Fonts "           allfonts
..
:configonly
display

Do you wish to change any of the above answers?
..
help
Choose "Yes" and the questions will be asked again with your previous
answers as defaults.

Choose "No" to proceed with the installation.

Choose "Quit" if you do not wish to complete the installation.
..
menu askagain 5 50
" Yes "         askagain
" No "          ansok
" Quit "        quit
..
display
..
help
..
goto %askagain% askagain quit ansok
:instsupp
;
; Start installation
;
:ansok
;
; check for simulated 3 button mouse
;
set mousefile "%mousetype%"
set mouse23 ""
call %mousetype% mouse3sim
;
; remove mouse23 and nomouse23 options from pcxopts if present
;
deloption pcxopts "nomouse23" "mouse23"
ifneq "%pcxopts%" "" ifneq "%mouse23%" "" set mouse23 " %mouse23%"
ifeq "%insttype%" "full" mkdir "%dst%"
chdir "%dst%"
goto %insttype% configonly instsupp
set disk "copysub.dat"
set disktitle "Program 1"
call getdisk
callscript "%src%copysub.dat"
set disk "instnio.dat"
set disktitle "Network Interface Options"
call getdisk
callscript "%src%instnio.dat"
:instsupp
set disk "instfont.dat"
set disktitle "Supplemental Fonts"
call getdisk
callscript "%src%instfont.dat"
:configonly
;
; determine font path
;
set fontpath ""
for fontdir *\*.* d "%dst%FONTS\*"
addpath fontpath "%fontpath%" "%fontdir%"
..
;
; save variables so we can present the right defaults in the future
;
call savevars
;
; write x.bat file
;
writefile "%dst%x.bat"
set XFONTS=%fontpath%
set XSIGHT=%pcxopts%%mouse23%
set XSTARTUP=%startcmd%
%dst%xsight
..
goto %insttype% instsupp
newwork
work



                         Creating Configuration File
..
writefile "%dst%config.txt"
;
;       config.txt - main configuration source file
;
;
; To create a configuration file, use the command:
;
;       XSCONFIG CONFIG.TXT
;
[definitions]
#include <keysyms.h>
[parameters]
ScreenWidth = %scnwid%                    ;millimeters
ScreenHeight = %scnhgt%                   ;millimeters
#include <%mousefile%.mou>
#include <%kbtype%.kbd>
..
dos "xsconfig config.txt"
helpline 0
newwork
display



                            Installation Complete.



     The file X.BAT may be used to start IBM X-Windows.  You may wish to
     transfer the SET commands from X.BAT into your AUTOEXEC.BAT file so
     that you can start IBM X-Windows by running XSIGHT directly.  Or,
     you may wish to move X.BAT into a directory that is in your program
     search path.

     Before running IBM X-Windows the first time you should run the
     PMINFO program to determine whether protected mode software runs
     correctly on your computer.  If PMINFO fails to run properly or
     hangs your computer, please refer to the IBM X-Windows documenta-
     tion for information on protected mode operation.

     If there is a READ.ME file in the IBM X-Windows directory it will
     contain information that was unavailable at the time the printed
     documentation was prepared.
..
chdir "%dst%"
:instsupp
:quit
exit
:invdir
display

            Invalid directory name: %dirvar%
..
..
;
; Subroutine to verify diskette
;
:getdisk
check diskfile "%src%%disk%"
goto %diskfile% file
newwork
work

Insert "%disktitle%" disk and press enter to continue.

..
Prompt "Diskette Drive: "
help
You may edit the name of the floppy drive with these keys:

left arrow - move cursor left          right arrow - move cursor right
home       - goto beginning of line    end         - goto end of line
backspace  - delete before cursor      del         - delete at cursor
ins        - toggle insert mode        esc         - clear input
..
:getdisk10
indir dirvar "%src%" invdir
set src "%dirvar%"
check diskfile "%src%%disk%"
goto %diskfile% file
display

Wrong disk in %src%.
..
goto getdisk10
:file
set srcdflt "%src%"
newwork
work

Installing from "%disktitle%" disk in drive %src% to %dst%

..
prompt " "
prompt "       Copying: "
help
..
..
;
; subroutine for simulated 3 button mouse
;
:mouse3sim
set mousefile "mouse3"
set mouse23 "-mouse23"
..
;
; subroutine to add fonts\75dpi
;
:add75dpidir
addpath fontpath "%fontpath%" "%dst%FONTS\75DPI"
..
;
; subroutine to add fonts\100dpi
;
:add100dpidir
addpath fontpath "%fontpath%" "%dst%FONTS\100DPI"
..
;
; subroutine to load variables for re-install or reconfig
;
:varfile
callscript "%dst%%instvar%"
..
;
; subroutine to save variables
;
:savevars
writefile "%dst%%instvar%" "w"
set mousetype   "%mousetype%"
set kbtype      "%kbtype%"
set fontset     "%fontset%"
set nettype     "%nettype%"
set scnsize     "%scnsize%"
set scnwid      %scnwid%
set scnhgt      %scnhgt%
set srcdflt     "%srcdflt%"
set pcxopts	"%pcxopts%"
set startcmd	"%startcmd%"
..
..
