home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / stofsw03.zip / SetUp.CMD < prev    next >
OS/2 REXX Batch file  |  1999-10-07  |  5KB  |  131 lines

  1. /*
  2.    Quick and (somewhat) Dirty Installation Script for StofaSwitch/2
  3.  
  4.    (C) Mads Orbesen Troest & SIRIUS Cybernetics 1999
  5.  
  6.    Contact author at <mads@troest.dk>
  7. */
  8.  
  9. PARSE SOURCE . . InstallPath
  10. InstallPath = DELSTR( InstallPath, LASTPOS( '\', InstallPath ) + 1 )
  11.  
  12. CALL RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs"
  13. CALL SysLoadFuncs
  14.  
  15. CALL SysCls
  16. SAY
  17. SAY "StofaSwitch Installation Script V0.01 - (C) Mads Orbesen Troest [SCC] '99"
  18. SAY "─────────────────────────────────────────────────────────────────────────"
  19. SAY "OK... If you continue, this script will configure the Stofa Switcher and"
  20. SAY "install/update customised program objects on your desktop. Also, two"
  21. SAY "simple SignOn.CMD and SignOff.CMD scripts are generated for commandline"
  22. SAY "usage of the switcher."
  23. SAY ""
  24. SAY "The script assumes that the files /already/ reside in the directory in"
  25. SAY "which you want them. If not, abort the script, move the files to the"
  26. SAY "right place, and re-run this script... Notice that you may run this"
  27. SAY "script at any time, if you need to reconfigure the switcher!"
  28. SAY ""
  29. SAY "It looks like I am installing program objects for files residing in:"
  30. SAY InstallPath
  31. SAY ""
  32. SAY "Are you ready to continue the installation script? (Y/N)"
  33. PULL Response
  34. IF Response \= "Y" & Response \= "YES" THEN DO
  35.  SAY "OK, then; aborting script..."
  36.  EXIT
  37. END
  38.  
  39. Switches = ""
  40.  
  41. SignOnIcon = "Icons\UserOn.ICO"
  42. SignOffIcon = "Icons\UserOff.ICO"
  43.  
  44. SAY ""
  45. SAY "OK, I need to know your User ID at the cable ISP:"
  46. PARSE PULL User
  47. SAY "Fine, and then your Password at the ISP:"
  48. PARSE PULL Password
  49. SAY "Right... Now, does the ISP NAT reside at IP 192.168.30.2, Port 259 ?"
  50. PULL Response
  51. IF Response \= "Y" & Response \= "YES" THEN DO
  52.  SAY "Aha. Then please tell me the NAT IP:"
  53.  PULL NatIP
  54.  Switches = Switches || " -NATIP:" || NatIP
  55.  SAY "And also the Port of the NAT:"
  56.  PULL NatPort
  57.  Switches = Switches || " -NATPORT:" || NatPort
  58. END
  59. SAY "Finally, should I make informative sign-on/off and panic sounds (recommended!)?"
  60. PULL Response
  61. IF Response \= "Y" & Response \= "YES" THEN DO
  62.  Switches = Switches || " -SHUTUP"
  63.  SAY "OK, feedback noises are disabled; /not/ recommended though!"
  64. END
  65. SAY "Oh, wait! Do you want to see the alternative icons available?"
  66. PULL Response
  67. IF Response \= "N" & Response \= "NO" THEN DO
  68.  SAY "OK, I am opening the folder now..."
  69.  CALL SysSetObjectData InstallPath"Icons", "OPEN=ICON;"
  70.  SAY "The traditional icon-set consists of the 'man-in-chair' icons."
  71.  SAY "Do you want the 'traffic-light' icons instead?"
  72.  PULL Response
  73.  IF Response \= "N" & Response \= "NO" THEN DO
  74.   SAY "OK! Well, I prefer the traditional ones... ;-)"
  75.   SignOnIcon = "Icons\TrafficGreen.ICO"
  76.   SignOffIcon = "Icons\TrafficRed.ICO"
  77.  END
  78.  ELSE DO
  79.   SAY "Yeah! My choice too! :-)"
  80.  END
  81. END
  82. SAY "Press any key to move on the final part of the setup!"
  83. PULL KNALL
  84.  
  85. CALL SysCls
  86. SAY "* Calling ""StofaNet.EXE ENCRYPT "Password""" to obtain encrypted version..."
  87. DO WHILE QUEUED() > 0 /* Empty queue... */
  88.  KNALL = LINEIN( "QUEUE:" )
  89. END
  90. Encrypted = ""
  91. "@ECHO "Password"|StofaNet.EXE Encrypt|RXQUEUE"
  92. DO WHILE QUEUED() > 0 /* Examine queue... */
  93.  qLine = LINEIN( "QUEUE:" )
  94.  P = POS( "Encrypted version of '"||Password||"' is '", qLine )
  95.  IF P > 0 THEN PARSE VAR qLine "'"."'" "'"Encrypted"'"
  96. END
  97. IF Encrypted \= "" THEN DO
  98.  SAY "* Obtained encrypted password '"||Encrypted||"'..."
  99.  Switches = Switches || " -ENCRYPTED"
  100.  Password = Encrypted
  101. END
  102. ELSE DO
  103.  SAY "* PANIC : Encryption failed, encryption NOT enabled!"
  104. END
  105.  
  106. '@IF NOT EXIST 'InstallPath'Scripts MD 'InstallPath'Scripts >NUL'
  107. RC = SysCreateObject( 'WPProgram',,
  108.                       'StofaNet SignOn',,
  109.                       '<WP_DESKTOP>',,
  110.                       'EXENAME=' || InstallPath ||'StofaNet.EXE;'||'ICONFILE='InstallPath||SignOnIcon';MINIMIZED=YES;NOAUTOCLOSE=NO;PROGTYPE=WINDOWABLEVIO;',
  111.                       'FULLSCREEN;PARAMETERS=SignOn 'User' 'Password' 'Switches';',,
  112.                       'REPLACE' )
  113. IF( RC <> 1 ) THEN SAY '* PANIC : Unable to create Sign-On object! :-('
  114. '@ECHO @'InstallPath'StofaNet.EXE SignOn 'User' 'Password' 'Switches' > Scripts\SignOn.CMD'
  115.  
  116. RC = SysCreateObject( 'WPProgram',,
  117.                       'StofaNet SignOff',,
  118.                       '<WP_DESKTOP>',,
  119.                       'EXENAME=' || InstallPath ||'StofaNet.EXE;'||'ICONFILE='InstallPath||SignOffIcon';MINIMIZED=YES;NOAUTOCLOSE=NO;PROGTYPE=WINDOWABLEVIO;',
  120.                       ';PARAMETERS=SignOff 'User' 'Password' 'Switches';',,
  121.                       'REPLACE' )
  122. IF( RC <> 1 ) THEN SAY '* PANIC : Unable to create Sign-Off object! :-('
  123. '@ECHO @'InstallPath'StofaNet.EXE SignOff 'User' 'Password' 'Switches' > Scripts\SignOff.CMD'
  124.  
  125. SAY ""
  126. SAY "StofaSwitch Objects should now be installed on your desktop! :-)"
  127. SAY "And heeey: SignOn/Off scripts should also be generated in:"
  128. SAY InstallPath'Scripts'
  129. SAY "(If not, well uh-uh; try writing me at <mads@troest.dk> ;-)"
  130.  
  131.