/* */
/* Usage : Service [sourcefiles] */

say 'IBM SecureEntry for OS/2 Version 3'
say '5793-R46 (C) Copyright IBM Corp. 1996'
say 'All Rights reserved. US Government Users Restricted Rights -'
say 'Use, duplication or disclosure restricted by GSA ADP '
say 'Schedule Contract with IBM Corp. '
say 'Licensed Materials - Property of IBM.'
say

parse source t1 t2 thisprogram
thispath=filespec("drive",thisprogram)||filespec("path",thisprogram)

parse arg command

batchparm=''
sourcefiles=''
do while command<>''
  parse var command p1 command
  if strip(translate(p1))='BATCH' then
     batchparm=' BATCH'
  else
  if sourcefiles='' then
    sourcefiles=p1
  else
  do
    say 'ERROR: Unknown parameter :'p1
    return
  end
end

if sourcefiles='' then sourcefiles=thispath

if substr(sourcefiles,length(sourcefiles),1)<>'\' then
   sourcefiles=sourcefiles'\'

sgm_shell = value('SGM_SHELL',,'OS2ENVIRONMENT')
sefilepath=sgm_shell
if sgm_shell='' then
do
  say 'ERROR: SecureEntry not installed'
  return
end

if substr(sefilepath,length(sefilepath),1)<>'\' then
   sefilepath=sefilepath'\'

if stream(sefilepath'install\sentry.cnf','c','query exists')='' then
do
  say 'ERROR: Secure Entry 3.0 must be installed to apply service'
  return
end
if translate(sourcefiles)=translate(sefilepath'INSTALL\') then sourcefiles='A:\'
if stream(sourcefiles'INSTALB.EXE','c','query exists')='' then
do
  say 'ERROR: Could not locate 'sourcefiles'INSTALB.EXE'
  return
end
address cmd '@'sourcefiles'INSTALB.EXE SERVICE OVERFROM:'sourcefiles' OVERTO:'sefilepath' 'sefilepath'INSTALL\SENTRY.CNF'batchparm' 1>nul 2>&1'
