CONFIGSYS
attribute of the opening PCK
tag.
However, note that we do not recommend changing CONFIG.SYS in the first place. With many applications, CONFIG.SYS changes are the result of a lack of conceptual design on the programmer's part. Especially if you think of changing the system paths to point to your installation directory, think again. This forces the user to reboot, slows down the system, makes de-installation more difficult, and moving application directories on the hard disk becomes a real hassle. 99% of all applications do NOT need to have system paths changed if you simply use the OS/2 APIs to query information about your executable.
Basically, I can only think of four situations where changing CONFIG.SYS would actually be necessary:
BIN
and DLL
directories, into which other software will insert
their stuff as well. But then again, much of the environment which these packages
need can be created using CMD scripts, which saves the user from rebooting every time
the environment changes.
CONFIGSYS="statement[|modifiers...]"
attribute to
the opening PCK
tag is a bit complex,
but very flexible.
Per default (that is, if no modifiers
are specified),
the CONFIGSYS
attribute will simply add
statement
in a new line to the end of
the user's CONFIG.SYS file without any further checking.
Example: CONFIGSYS="SET RESTARTOBJECTS=NO"
would add that line
to the bottom of CONFIG.SYS (even if another SET RESTARTOBJECTS
statement
already existed).
However, there are many modifiers
available which
allow for a more flexible CONFIG.SYS manipulation, which is necessary in
many cases. These modifiers must appear after a "|"
character.
UNIQUE[(statement2)]
statement
part of the CONFIGSYS
attribute occurs only once, i.e. will be unique in CONFIG.SYS, by searching for a
similar line and replacing that line with the new line. If no such similar line
is found, the new line is appended to the bottom of CONFIG.SYS
(that position can be changed with ADDTOP
, ADDBEFORE
, ADDAFTER
).
All searching is case-insensitive.
This assumes that
statement contains a "=" character, as all CONFIG.SYS statements do. The exact
behavior of UNIQUE
depends on the syntax:
UNIQUE
is specified all alone (without the brackets and
statement2
),
CONFIG.SYS is searched for a line containing the part before the "="
char
of statement.
This is only useful for single CONFIG.SYS statements such as SET xxx=
whose left part (before "=") will occur only once in CONFIG.SYS.
Example: CONFIGSYS="PROTECTONLY=YES | UNIQUE"
would replace any
"PROTECTONLY="
statement with the new line. If no such line exists, a new
line is added to the bottom (that position can be changed with ADDTOP
,
ADDBEFORE
, ADDAFTER
).
UNIQUE
is specified with the (statement2)
part, CONFIG.SYS is searched for a line which contains the part before the "="
char of statement
and statement2
after
the "="
char as a substring.
Example:
CONFIGSYS="BASEDEV=DANIS506.ADD | UNIQUE(IBM1S506.ADD)"
would search for a line containing both BASEDEV=
and IBM1S506.ADD
and replace that line with BASEDEV=DANIS506.ADD
.
This syntax is required for adding device drivers, because there will surely be
more than one BASEDEV
statement in CONFIG.SYS.
This also works with the DEVICE=
statements which can have a full
path specification, as follows:
CONFIGSYS="DEVICE=$(1)\bin\crashsys.drv | UNIQUE(stable.drv)"
This would replace a line containing both DEVICE=
and stable.drv
with DEVICE=[path_of_package_1]\bin\crashsys.drv
, using
macro resolution.
ADDRIGHT
statement
contains a "="
character and searches CONFIG.SYS for that first part. This is useful for
path statements (SET PATH
and the like).
If the first part of statement
is found, the part after the
"="
character is appended to that line in CONFIG.SYS.
If no corresponding line is found, a new line is added to the bottom of CONFIG.SYS
(that position can be changed with ADDTOP
, ADDBEFORE
, ADDAFTER
).
This cannot be used with UNIQUE
or ADDLEFT
.
Example:
CONFIGSYS="SET PATH=$(1)\BIN | ADDRIGHT"appends the
BIN
subdirectory of the target path of package 1 to the system path, using
macro resolution.
ADDLEFT
ADDRIGHT
, but the part after the "="
character is inserted
at the beginning of the list. This is only recommended if your data needs to appear
first in the list (e.g. for replacing system DLLs). Be very careful with this one,
this can lead to real problems.
This cannot be used with UNIQUE
or ADDRIGHT
.
ADDTOP
or ADDAFTER(xxx)
or ADDBEFORE(xxx)
Examples:
CONFIGSYS="BASEDEV=CRASHSYS.ADD /DOCRASH | UNIQUE(CRASHSYS.ADD) ADDBEFORE(IBM1S506.ADD)"searches CONFIG.SYS for the line containing
IBM1S506.ADD
(the
IBM IDE driver) and inserts BASEDEV=CRASHSYS.ADD / DOCRASH
right before that
line.
CONFIGSYS="SET INCLUDE=$(1)\INCLUDE | ADDRIGHT ADDAFTER(SET BOOKSHELF)"searches CONFIG.SYS for a line starting with
SET INCLUDE=
. If such
a line is found, assuming that the target path of package 1 is "F:\WHATEVER",
"F:\WHATEVER\INCLUDE" is appended to that line. If that line is not found, a new line
containing SET INCLUDE=F:\WHATEVER\INCLUDE
is added before the line
which contains SET BOOKSHELF=
. Whoa.
REMOVELINE
statement
is taken as a search string. If that string
is found, the whole line which contains it is removed.
Example:
CONFIGSYS="BASEDEV=CRASHSYS.ADD | UNIQUE(CRASHSYS.ADD) ADDBEFORE(IBM1S506.ADD)" CONFIGSYS="BASEDEV=IBM1S506.ADD | REMOVELINE"replaces IBM1S506.ADD with CRASHSYS.ADD.
REMOVEPART
If a "="
character is found in statement
,
the CONFIG.SYS line starting with the first part of statement
is searched, and the second part of statement
is removed.
(Useful for SET PATH=WHATEVER
and the like.)