/* REXX Script */

/* Register with REXX API extensions. */
Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
Call SysLoadFuncs

/* Get creation disposition. */
Call SysCls
Say
Say 'Create Apache for OS/2 folder and icons.'
Say
Say 'NOTE: This program needs to be executed from the OS2 directory of your'
Say '      working Apache setup. Refer to INSTALL.OS2 for more details.'
Say
Say 'When object exists object creation should:' 
Call CharOut, '  (U=Update, R=Replace, F=Fail) : '
Parse Upper Pull Answer
CreateCollision = 'Fail'
If Left( Answer, 1 ) = R Then CreateCollision = 'Replace' 
If Left( Answer, 1 ) = U Then CreateCollision = 'Update' 
Say

Call CreateObjects
Exit

CreateObject: procedure
    Parse Arg Class, Title, Location, Setup, Collision
    Say 'Creating ['Title']'
    rc = SysCreateObject( Class, Title, Location, Setup, Collision )
    If rc <> 1 Then
        Say ' > failed to create ['Title' | 'Class'] at location ['Location']'
    return rc

CreateObjects:

current_dir = directory()
previous_dir = left(current_dir, ( length(current_dir) - 4 ))

rc = CreateObject( 'WPFolder',,
    'Apache for^OS/2 Ver 1.2.4',,
    '<WP_DESKTOP>',,
    'NOPRINT=YES;'||,
        'DEFAULTVIEW=CONTENTS;'||,
        'SELFCLOSE=1;'||,
        'ICONVIEW=NONGRID,NORMAL;'||,
        'DETAILSVIEW=MINI;'||,
        'TREEVIEW=LINES,NORMAL;'||,
        'ALWAYSSORT=YES;'||,
        'OBJECTID=<Apache_for_OS_2_folder>',,
    CreateCollision )

  rc = CreateObject( 'WPProgram',,
      'Reinitialize^Apache',,
      '<Apache_for_OS_2_folder>',,
      'NOPRINT=YES;'||,
          'DEFAULTVIEW=RUNNING;'||,
          'EXENAME='||current_dir||'\REINIT.CMD;'||,
          'STARTUPDIR='||current_dir||';'||,
          'PROGTYPE=WINDOWABLEVIO;'||,
          'MINIMIZED=YES;'||,
          'OBJECTID=<Apache_for_OS_2_Reinit>',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'HTDOCS',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\HTDOCS',,
      CreateCollision )

  rc = CreateObject( 'WPProgram',,
      'Terminate^Apache',,
      '<Apache_for_OS_2_folder>',,
      'NOPRINT=YES;'||,
          'DEFAULTVIEW=RUNNING;'||,
          'EXENAME='||current_dir||'\TERMINATE.CMD;'||,
          'STARTUPDIR='||current_dir||';'||,
          'PROGTYPE=WINDOWABLEVIO;'||,
          'MINIMIZED=YES;'||,
          'OBJECTID=<Apache_for_OS_2_Terminate>',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'CONF',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\CONF',,
      CreateCollision )

  rc = CreateObject( 'WPProgram',,
      'Apache^Web Server',,
      '<Apache_for_OS_2_folder>',,
      'NOPRINT=YES;'||,
          'MINWIN=HIDE;'||,
          'DEFAULTVIEW=RUNNING;'||,
          'EXENAME='||previous_dir||'\HTTPD.EXE;'||,
          'STARTUPDIR='||previous_dir||';'||,
          'PROGTYPE=FULLSCREEN;'||,
          'MINIMIZED=YES;'||,
          'PARAMETERS=-fconf/httpd.conf -d'||previous_dir||';'||,
          'OBJECTID=<Apache_for_OS_2_Server>',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'LOGS',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\LOGS',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'ABOUT_APACHE',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\ABOUT_APACHE',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'CHANGES',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\CHANGES',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'KEYS',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\KEYS',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'LICENSE',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\LICENSE',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'README',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\README',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'README.OS2',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\README.OS2',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'INSTALL.OS2',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\INSTALL.OS2',,
      CreateCollision )

  rc = CreateObject( 'WPShadow',,
      'LOCALTESTING.OS2',,
      '<Apache_for_OS_2_folder>',,
      'SHADOWID='||previous_dir||'\LOCALTESTING.OS2',,
      CreateCollision )

return
