idir='usr/lpp/' /* Or use install directory
of just '' */
/* and all paths are fully specified below. */
dirs=,
,
/* <== Here is the list of directories */
,
/* with respective permission bits */
,
/* The last one doesn't have a comma */
, /*--------------------------------------------------------*/
, /* HFS directories required for
installation
*/
, /*--------------------------------------------------------*/
,
'db2olap 755',
'db2olap/api 755',
'db2olap/api/include 755',
'db2olap/api/include/IBM 755',
'db2olap/api/lib 755',
'db2olap/api/lib/IBM 755',
'db2olap/api/redist 755',
'db2olap/api/redist/IBM 755',
'db2olap/locale 755',
'db2olap/locale/IBM 755',
'db2olap/app 755',
'db2olap/app/_tmpinst 755',
'db2olap/app/_tmpinst/IBM 755',
'db2olap/app/_tmpinst/Demo 755',
'db2olap/app/_tmpinst/Demo/Basic 755',
'db2olap/app/_tmpinst/Demo/Basic/IBM 755',
'db2olap/app/_tmpinst/Sampeast 755',
'db2olap/app/_tmpinst/Sampeast/East 755',
'db2olap/app/_tmpinst/Sampeast/East/IBM 755',
'db2olap/app/_tmpinst/Sample 755',
'db2olap/app/_tmpinst/Sample/Basic 755',
'db2olap/app/_tmpinst/Sample/Basic/IBM 755',
'db2olap/app/_tmpinst/Sample/Interntl 755',
'db2olap/app/_tmpinst/Sample/Interntl/IBM 755',
'db2olap/app/_tmpinst/Sample/Xchgrate 755',
'db2olap/app/_tmpinst/Sample/Xchgrate/IBM 755',
'db2olap/app/_tmpinst/Samppart 755',
'db2olap/app/_tmpinst/Samppart/Company 755',
'db2olap/app/_tmpinst/Samppart/Company/IBM 755',
'db2olap/bin 755',
'db2olap/bin/IBM 755',
'db2olap/is 755',
'db2olap/is/bin 755',
'db2olap/is/bin/IBM 755',
'db2olap/java 755',
'db2olap/java/IBM 755',
'db2olap/scripts 755',
'db2olap/scripts/IBM 755',
'db2olap/is/jar 755',
'db2olap/is/jar/IBM 755',
'db2olap/is/samples 755',
'db2olap/is/samples/IBM 755'
parse arg $root .
If $root='' then
$root = "/"
/* Add a trailing slash */
Else
/* if none exists on input */
$root=strip($root,'T','/')'/'
/****************************************************************/
/* Beginning of main procedure:
*/
/****************************************************************/
firstchar = Substr($root,1,1)
If firstchar ¬= "/" then
Do
say 'Directory name does NOT begin with a "/".'
say 'Please correct and resubmit.'
Exit 12
End
if syscalls(on)>4 then
Do
say 'Initialization failure. Please correct and resubmit.'
Exit 12
End
$rc= '0'
SINDEX.=0
flag1="OFF"
flag2="OFF"
flag3="OFF"
flag4="OFF"
flag7="OFF"
say 'The EXEC to create the directories has begun.'
say 'It will run for a couple of minutes.'
call saym 1, 'The EXEC ran at ' TIME() ' on ' DATE()
call saym 1, '
'
address syscall 'getuid'
myuid=retval
address syscall 'geteuid'
myeuid=retval
privflag=0
/* Change the Effective UID to */
If myeuid ¬= 0 then
/* be 0 since invoker should */
Do
/* be part of the BPX.SUPERUSER */
address syscall 'seteuid 0'
/* facility class
*/
privflag=1
End
address syscall 'access' $root F_OK
If (rc=0 & retval¬=0) | rc¬= 0 then
Do
If errno = 6F then
/* EACCESS */
Do
call saym 1, 'Do not have appropriate permission to' $root
call saym 1, '
'
call saym 1, 'Please get appropriate permission to this
directory',
'and resubmit.'
call saym 1, '
'
End
Else
Do
call saym 1, 'Directory' $root 'does not exist.'
call saym 1, '
'
call saym 1, 'Please create this directory and resubmit.'
call saym 1, '
'
End
$rc=12
End
If $rc=0 then
Do
address syscall 'chmod' $root 755
If (rc=0 & retval¬=0) | rc¬= 0 then
Do
call saym 1, 'Do not have appropriate permission
to' $root
call saym 1, '
'
call saym 1, 'Please get appropriate permission
to this directory',
'and resubmit.'
call saym 1, '
'
$rc=12
End
End
If $rc=0 then
Do
flag1="ON"
call saym 2, 'Created the following directories:'
call saym 2, '=================================='
call saym 3, 'Following directories already exist:'
call saym 3, '===================================='
call saym 4, 'Problems creating the following directories:'
call saym 4, '============================================'
call saym 5, ' '
call saym 6, ' '
call syscall0 mkdir $root || idir '755'
do while dirs<>''
parse var dirs dir perm dirs
call syscall0 mkdir $root || idir || strip(dir)
strip(perm)
end
End
If privflag=1 then
address syscall 'seteuid' myuid
say 'The EXEC has completed with Return Code' $rc
say 'Check the SYSOUT held OUTPUT for further details.'
'ALLOC FI(BPXOUT) SYSOUT HOLD REUSE'
call saym 1, 'This EXEC completed with Return Code' $rc
call saym 1, '
'
If flag2 = 'OFF' then
Do
call saym 2, 'None. No directories were created.'
call saym 2, '
'
End
Else
call saym 2, '
'
If flag3 = 'OFF' then
Do
call saym 3, 'None. No existing directories.'
call saym 3, '
'
End
Else
call saym 3, '
'
If flag4 = 'OFF' then
Do
call saym 4, 'No problems while creating the directories.'
call saym 4, '
'
End
Else
call saym 4, '
'
If flag7 = 'OFF' then
call saym 7, 'End of EXEC.'
Else
Do
call saym 7, '
'
call saym 7, 'Please refer to the OS/390 UNIX Messages
and Codes',
'book to interpret'
call saym 7, 'the Return and Reason Codes.'
call saym 7, 'Please correct and resubmit.'
End
If flag1 = 'OFF' then
'EXECIO' SINDEX.1 'DISKW BPXOUT (STEM STEM.1. FINIS'
Else
Do
'EXECIO' SINDEX.1 'DISKW BPXOUT (STEM STEM.1.'
'EXECIO' SINDEX.2 'DISKW BPXOUT (STEM STEM.2.'
'EXECIO' SINDEX.3 'DISKW BPXOUT (STEM STEM.3.'
'EXECIO' SINDEX.4 'DISKW BPXOUT (STEM STEM.4.'
'EXECIO' SINDEX.5 'DISKW BPXOUT (STEM STEM.5.'
'EXECIO' SINDEX.6 'DISKW BPXOUT (STEM STEM.6.'
'EXECIO' SINDEX.7 'DISKW BPXOUT (STEM STEM.7. FINIS'
End
'FREE FI(BPXOUT)'
Exit $rc
/********************************/
/* Subroutine for mkdir calls */
/********************************/
syscall0:
parse arg cmd
address syscall cmd
parse arg . path permbits
If (rc=0 & retval¬=0) | rc¬= 0 then
Do
If errno = 75 then
/* EEXIST */
Do
flag3 = 'ON'
call saym 3, path
address syscall 'chmod' path permbits
End
Else
If errno ¬= 75 then
Do
flag4 = 'ON'
flag7 = 'ON'
call saym 4, path
call saym 4,' Not created.
RC='errno ' RSN='errnojr
$rc = '12'
End
End
Else
Do
flag2 = 'ON'
call saym 2, path
End
Return
/*****************************************/
/* Subroutine to add messages to STEMS */
/*****************************************/
saym:
parse arg s,msg
SINDEX.s=SINDEX.s+1
ix=SINDEX.s
STEM.s.ix=msg
Return