home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Amiga / Workbench / Pilotes / Imprimantes / NetParLpr.lha / NetPar / Install_Client next >
Text File  |  1998-04-21  |  16KB  |  603 lines

  1. ; NetPar Client Installation Script
  2. ;
  3. ; NetPar Client ⌐ MikeySoft 1997-98 "When Mikey Goes Soft"
  4. ;
  5.  
  6. (transcript "NetPar Installation")
  7.  
  8.  
  9. ; Welcome to Netpar Installation
  10. ;
  11. (set @default-dest "DEVS:")
  12. (welcome "Please read the AmigaGuide Documentation concerning "
  13.          "installation of this product. NetPar now supports the "
  14.          "prt_42.50 printer package as well as the original "
  15.          "parallel.device replacement. This version of NetPar is NOT "
  16.          "compatible with the current NetPar Server or TestPar programs.\n\n")
  17.  
  18. ;Choosing which Action the user wishes to take
  19. ;
  20. (set Action
  21.         (askchoice
  22.                 (prompt "NetPar Client ⌐ MikeySoft 1997-98\n"
  23.                         "\"When Mikey Goes Soft\"\n"
  24.                         "\n"
  25.                         "What Action do you want to take?\n"
  26.                         "(Note: Please read AmigaGuide Docs\nabout installation first!)")
  27.                 (help @askchoice-help)
  28.                 (choices "Change Installed Settings"
  29.                          "Install Normal NetPar (parallel.device)"
  30.                          "Install PRT_42.50 NetPar (netpar.device)"
  31.                          "Remove NetPar Installation")
  32.                 (default 0)
  33.         )
  34. )
  35.  
  36. ; These are the possible Action modes. They
  37. ; are defined to make reading the installation
  38. ; script easy.
  39. (set Settings   0)
  40. (set NetPar     1)
  41. (set PRT4250    2)
  42. (set Remove     3)
  43.  
  44. (debug "User Action" Action)
  45.  
  46. ;
  47. ; Checking to See if NetPar Client has already been installed
  48. ;
  49. (set FinalAction 0)
  50. (set #OldPar "DEVS:orig_parallel.device")
  51. (if (exists #OldPar (noreq))
  52.    (if (= Action NetPar)
  53.       (set FinalAction 1)
  54.    )
  55. )
  56.  
  57. ; Debug or Not Debug
  58. (set Mode 0)
  59. ; Debug no longer used. Mode still set by default
  60.  
  61.  
  62. (if (OR (= Action NetPar)(= Action PRT4250))
  63.    (if (= Mode 0)
  64.       (if (patmatch "68060" (database "cpu"))
  65.          (
  66.             (set #WhatCPU 3)
  67.          )
  68.          (
  69.             (if (patmatch "68040" (database "cpu"))
  70.                (
  71.                   (set #WhatCPU 2)
  72.                )
  73.                (
  74.                   (if (patmatch "68030" (database "cpu"))
  75.                      (
  76.                         (set #WhatCPU 1)
  77.                      )
  78.                      (
  79.                         (if (patmatch "68020" (database "cpu"))
  80.                            (
  81.                               (set #WhatCPU 1)
  82.                            )
  83.                            (
  84.                               (set #WhatCPU 0)
  85.                            )
  86.                         )
  87.                      )  
  88.                   )
  89.                )
  90.             )
  91.          )
  92.       )
  93.    )
  94. )
  95.  
  96. (if (OR (= Action NetPar) (= Action PRT4250 ))
  97.    (if (= Mode 0)
  98.       (set #MyCPU
  99.          (askchoice
  100.             (prompt "Which version of the NetPar Client do you \n"
  101.                     "want to install?\n\n")
  102.             (help @askchoice-help)
  103.             (choices "68000|68010" "68020|68030" "68040" "68060")
  104.             (default #WhatCPU)
  105.          )
  106.       )
  107.    )
  108. )
  109.  
  110. ; NetPar Installation setup
  111. (if (= Action NetPar)
  112.    (if (= Mode 0)
  113.       (if (= #MyCPU 3)
  114.          (
  115.             (set #NewSource  "parallel.device.060")
  116.             (set #NewSource2 "NetParSpool.060")
  117.          )
  118.          (
  119.             (if (= #MyCPU 2)
  120.                (
  121.                   (set #NewSource  "parallel.device.040")
  122.                   (set #NewSource2 "NetParSpool.040")
  123.                )
  124.                (
  125.                   (if (= #MyCPU 1)
  126.                      (
  127.                         (set #NewSource  "parallel.device.020")
  128.                         (set #NewSource2 "NetParSpool.020")
  129.                      )
  130.                      (
  131.                         (set #NewSource  "parallel.device.000")
  132.                         (set #NewSource2 "NetParSpool.000")
  133.                      )
  134.                   )
  135.                )
  136.             )
  137.          )
  138.       )
  139.    )
  140. )
  141.  
  142. ; NetPar Prt_42.50 Installation setup
  143. (if (= Action PRT4250)
  144.    (if (= Mode 0)
  145.       (if (= #MyCPU 3)
  146.          (
  147.             (set #NewSource  "NetPar.device.060")
  148.             (set #NewSource2 "NetParSpool.060")
  149.          )
  150.          (
  151.             (if (= #MyCPU 2)
  152.                (
  153.                   (set #NewSource  "NetPar.device.040")
  154.                   (set #NewSource2 "NetParSpool.040")
  155.                )
  156.                (
  157.                   (if (= #MyCPU 1)
  158.                      (
  159.                         (set #NewSource  "NetPar.device.020")
  160.                         (set #NewSource2 "NetParSpool.020")
  161.                      )
  162.                      (
  163.                         (set #NewSource  "NetPar.device.000")
  164.                         (set #NewSource2 "NetParSpool.000")
  165.                      )
  166.                   )
  167.                )
  168.             )
  169.          )
  170.       )
  171.    )
  172. )
  173.  
  174.  
  175. ; Start the install
  176. (if (= Action NetPar)
  177.    ;Is it a New install?
  178.    (if (= FinalAction 0)
  179.       (if (not(exists #OldPar (noreq)))
  180.          (run "rename devs:parallel.device devs:orig_parallel.device"
  181.             (prompt "Renaming DEVS:Parallel.Device into DEVS:Orig_Parallel.Device. "
  182.                     "NetPar Client will replace your Original Parallel.device. If "
  183.                     "this step is skipped, the installation will not work."
  184.                     "\n\nNOTE: This Install Script comes with a \"Remove\" option which will "
  185.                     "restore your computer to it\'s original settings.")
  186.            (help @run-help) 
  187.            (confirm)
  188.          )
  189.       )
  190.    )
  191. )
  192.  
  193.  
  194. ; Copy the normal NetPar.Device
  195. (if (= Action NetPar)
  196.    (if (exists #OldPar (noreq))
  197.       ; Do the Actual Copy
  198.       (copylib
  199.          (prompt "Copying NetPar Client into DEVS:")
  200.          (help @copylib-help)
  201.          (source #NewSource)
  202.          (dest   "DEVS:")
  203.          (newname "parallel.device")
  204.          (confirm)
  205.       )
  206.    )
  207. )   
  208.  
  209. ; Copy the PRT_42.50 NetPar.Device
  210. (if (= Action PRT4250 )
  211.    ; Do the Actual Copy
  212.    (copylib
  213.       (prompt "Copying NetPar Client into DEVS:")
  214.       (help @copylib-help)
  215.       (source #NewSource)
  216.       (dest   "DEVS:")
  217.       (newname "netpar.device")
  218.       (confirm)
  219.    )
  220. )
  221.  
  222. ; Copy the NetParSpool
  223. (if (OR (= Action NetPar) (= Action PRT4250 ))
  224.    (if (OR (exists #OldPar (noreq)) (= Action PRT4250 ))
  225.       ; Do the Actual Copy
  226.       (copylib
  227.          (prompt "Copying NetPar Spooler into DEVS:")
  228.          (help @copylib-help)
  229.          (source #NewSource2)
  230.          (dest   "DEVS:")
  231.          (newname "NetParSpool")
  232.          (confirm)
  233.       )
  234.    )
  235. )
  236.  
  237. ;(if (NOT (exists "ENV:NetPar/PrinterHOST" (noreq)))
  238. ;   ; Finally the Machine used message
  239. ;   (if (= Action 0)
  240. ;      (if (exists #OldPar (noreq))
  241. ;         (set HostName
  242. ;            (askstring
  243. ;             (prompt "What is the name of the host machine that you "
  244. ;                     "want to print to? The installer script will "
  245. ;                     "create a environment variable called NetPar/PrinterHOST "
  246. ;                     "to store this information. You can manually "
  247. ;                     "reset this variable later by using the setenv "
  248. ;                     "AmigaDOS command.")
  249. ;             (help @askstring-help)
  250. ;            )
  251. ;         )
  252. ;      )
  253. ;   )
  254. ;)
  255.  
  256. ;Adding the NetPar directories to env: and envarc:
  257. (if (<= Action PRT4250)
  258.    (if (NOT (exists "ENV:NetPar" (noreq)))
  259.       (run "makedir ENV:NetPar"
  260.           (prompt "Making Directory")
  261.       )
  262.    )
  263. )
  264.  
  265.  
  266. (if (<= Action PRT4250)
  267.    (if (NOT (exists "ENVARC:NetPar" (noreq)))
  268.       (run "makedir ENVARC:NetPar"
  269.           (prompt "Making Directory")
  270.       )
  271.    )
  272. )
  273.  
  274. ;Adding the PrinterHOST
  275. ;(if (= Action 0)
  276. ;   (if (exists #OldPar (noreq))
  277. ;       (run "setenv NetPar/PrinterHOST" HostName
  278. ;             (prompt "Making PrinterHOST")
  279. ;       )
  280. ;   )
  281. ;)
  282.  
  283. ;(if (NOT (exists "ENV:NetPar/PrinterNAME" (noreq)))
  284. ;   ; PrinterName
  285. ;   (if (= Action 0)
  286. ;      (if (exists #OldPar (noreq))
  287. ;         (set PrintName
  288. ;            (askstring
  289. ;             (prompt "What is the name of the printer that you "
  290. ;                     "want to print to? The installer script will "
  291. ;                     "create a environment variable called NetPar/PrinterNAME "
  292. ;                     "to store this information. You can manually "
  293. ;                     "reset this variable later by using the setenv "
  294. ;                     "AmigaDOS command.")
  295. ;             (help @askstring-help)
  296. ;             (default "lp")
  297. ;            )
  298. ;         )
  299. ;      )
  300. ;   )
  301. ;)
  302.  
  303. ;Adding the HOSTPrinter
  304. ;(if (= Action 0)
  305. ;   (if (exists #OldPar (noreq))
  306. ;       (run "setenv NetPar/PrinterNAME" PrintName
  307. ;             (prompt "Making PrinterNAME")
  308. ;       )
  309. ;   )
  310. ;)
  311.  
  312. (if (NOT (exists "ENV:NetPar/SpoolDir" (noreq)))
  313.    ; Spool Directory
  314.    (if (<= Action PRT4250 )
  315.       (set SpoolDir
  316.           (askdir
  317.              (prompt "Where do you want to spool in printed files "
  318.                      "to? An additional directory will NOT be created. "
  319.                      "The information will be stored in ENV:NetPar/SpoolDir "
  320.                      "You can manually reset the variable later by using "
  321.                      "the setenv AmigaDOS command.")
  322.              (help @askdir-help)
  323.              (default "T:")
  324.          )
  325.       )
  326.    )
  327. )
  328.  
  329. ;Adding the SpoolDir
  330. (if (<= Action PRT4250)
  331.    (if (exists "ENV:NetPar" (noreq))
  332.       (run "setenv NetPar/SpoolDir" SpoolDir
  333.             (prompt "Making SpoolDir")
  334.       )
  335.    )
  336. )
  337.  
  338. ;
  339. ; Port Settings for Server Name and Printer Name...Go Here
  340. ;
  341. ;
  342.  
  343. ; Force NetPar into a Settings mode if it appears
  344. ; as if this is the first time the program has
  345. ; been installed
  346.  
  347. (set DoSetting 0)
  348.  
  349. (if (OR (= Action NetPar) (= Action PRT4250))
  350.    (if (NOT (exists  "ENV:NetPar/0/PrinterHOST" (noreq)))
  351.       (set DoSetting 1)
  352.    )
  353. )
  354.  
  355. (if (= Action Settings)
  356.    (set DoSetting 1)
  357. )
  358.  
  359. (if (= DoSetting 1)
  360.    (
  361.       ;
  362.       ; Getting ready to loop
  363.       (set DoAgain 1)
  364.       (set Unit 0)
  365.       (while (= DoAgain 1)
  366.  
  367.          ; So Now on with the PrinterHost
  368.          (set HostName "")
  369.          (if (exists ("ENV:NetPar/%ld/PrinterHOST" Unit))
  370.             (set HostName (getenv ("NetPar/%ld/PrinterHOST" Unit)))
  371.          )
  372.  
  373.          (set HostName
  374.             (askstring
  375.              (prompt ("Setting up Hostname for Unit #%ld\n\nWhat is the name of the host machine that you want to print to?\nCan also be the IP Address of a Network Ready Printer.\n\n"
  376.                        Unit))
  377.              (help @askstring-help)
  378.              (default ("%s" HostName))
  379.             )
  380.          )
  381.  
  382.          ; Now comes PrinterName
  383.          (set PrinterName "lp")
  384.          (if (exists ("ENV:NetPar/%ld/PrinterNAME" Unit))
  385.             (set PrinterName (getenv ("NetPar/%ld/PrinterNAME" Unit)))
  386.          )
  387.  
  388.          (set PrinterName
  389.             (askstring
  390.              (prompt ("Setting up Printer Name for Unit #%ld\n\nWhat is the name of the printer connected to\n\"%s\"\n\nUse \"lp\" for Network Ready Printers.\n\n"
  391.                        Unit HostName))
  392.              (help @askstring-help)
  393.              (default ("%s" PrinterName))
  394.             )
  395.          )
  396.  
  397.          ; Time to place these values into ENV:
  398.          (if (NOT (exists ("ENV:NetPar/%ld" Unit)))
  399.             (run ("makedir ENV:NetPar/%ld" Unit)
  400.                  (prompt "Making Unit Directory")
  401.             )
  402.          )
  403.  
  404.          (if (exists ("ENV:NetPar/%ld" Unit))
  405.             (
  406.                (run ("setenv NetPar/%ld/PrinterHOST \"%s\"" Unit HostName)
  407.                     (prompt "Storing Hostname")
  408.                )
  409.                (run ("setenv NetPar/%ld/PrinterNAME \"%s\"" Unit PrinterName)
  410.                     (prompt "Storing Printer name")
  411.                )
  412.             )
  413.          )
  414.  
  415.          ; Time to test for PrinterPorts
  416.          (if (AND (exists "DEVS:netpar.device") (exists "DEVS:PrinterPorts"))
  417.  
  418.             (
  419.                 ; Forcfully copy the default icon
  420.                 (copyfiles
  421.                      (prompt "Setting up PRT 42.50 Printer Port Icon")
  422.                      (help @copyfiles-help)
  423.                      (source "prt_42.50_icon/NetPar.info")
  424.                      (dest   "DEVS:PrinterPorts")
  425.                      (newname ("NetPar %ld.info" Unit))
  426.                      (files)
  427.                      (optional "force")
  428.                 )
  429.  
  430.                 ; Now set the Unit Number in the icon
  431.                 (tooltype
  432.                      (prompt "Setting up PRT 42.50 Printer Port Icon")
  433.                      (help @tooltype-help)
  434.                      (dest ("DEVS:PrinterPorts/NetPar %ld" Unit))
  435.                      (settooltype "UNIT" ( "%ld" Unit))
  436.                 )
  437.             )
  438.          )
  439.  
  440.  
  441.          ; See if we need to loop again. First loop is automatic.
  442.          (set DoAgain
  443.              (askchoice
  444.                 (prompt ("NetPar Client ⌐ MikeySoft 1997-98\n\"When Mikey Goes Soft\"\n\nWhat is next?\n\n( Next Unit : %ld )\n\n"
  445.                          (+ Unit 1)))
  446.                 (help @askchoice-help)
  447.                 (choices "Done Installing Ports"
  448.                          "Configure Next Port")
  449.                 (default 0)
  450.              )
  451.          )
  452.          ; Add one to Unit
  453.          (set Unit (+ Unit 1))
  454.       )
  455.    )
  456. )
  457. ;
  458. ;
  459. ;
  460. ;
  461.  
  462. ;  Saving settings to ENVARC:
  463. (if (<= Action PRT4250)
  464.     (if (exists "ENV:NetPar" (noreq))
  465.          (run "copy ENV:NetPar ENVARC:NetPar all quiet"
  466.               (prompt "Backing Up Settings")
  467.          )
  468.     )
  469. )
  470.  
  471. ;Warning message if user decides to not allow parallel.device rename...
  472. (if (= Action NetPar)
  473.    (if (not (exists #OldPar (noreq)))
  474.       (message "\ns s unable to rename current parallel.device to orig_parallel.device. "
  475.                "Installation was NOT Complete!"
  476.                (all)
  477.       )
  478.    )
  479. )
  480.  
  481. ;
  482. ; Now to check on a removal
  483. (if (= Action Remove)
  484.    (if (exists #OldPar (noreq))
  485.       (if (exists "DEVS:parallel.device" (noreq))
  486.          (delete "DEVS:parallel.device"
  487.             (prompt "Deleting old NetPar Client Installation")
  488.             (optional "force")
  489.          )
  490.       )
  491.    )
  492. )
  493.  
  494. (if (= Action Remove)
  495.    (if (exists "DEVS:NetParSpool" (noreq))
  496.       (delete "DEVS:NetParSpool"
  497.          (prompt "Deleting old NetPar Client Installation")
  498.          (optional "force")
  499.       )
  500.    )
  501. )
  502.  
  503. (if (= Action Remove)
  504.    (if (exists "DEVS:netpar.device" (noreq))
  505.       (delete "DEVS:netpar.device"
  506.          (prompt "Deleting old NetPar Client Installation")
  507.          (optional "force")
  508.       )
  509.    )
  510. )
  511.  
  512. (if (= Action Remove)
  513.    (if (exists #OldPar (noreq))
  514.       (rename #OldPar "DEVS:parallel.device"
  515.          (prompt "Returning the original parallel.device")
  516.       )
  517.    )
  518. )
  519.  
  520.  
  521. (if (= Action Remove)
  522.    (if (exists "ENV:NetPar" (noreq))
  523.       (run "delete ENV:NetPar all quiet"
  524.          (prompt "Removing NetPar")
  525.       )
  526.    )
  527. )
  528.  
  529. (if (= Action Remove)
  530.    (if (exists "ENVARC:NetPar" (noreq))
  531.       (run "delete ENVARC:NetPar all quiet"
  532.           (prompt "Removing NetPar")
  533.       )
  534.    )
  535. )
  536.  
  537. (if (= Action Remove)
  538.    (if (exists "DEVS:PrinterPorts" (noreq))
  539.       (run "delete DEVS:PrinterPorts/NetPar#? quiet"
  540.           (prompt "Removing NetPar")
  541.       )
  542.    )
  543. )
  544.  
  545.  
  546. ; Cleaning up old NetPar setups.
  547. (if (exists "ENV:PrintHOST" (noreq))
  548.       (delete "ENV:PrintHOST"
  549.          (prompt "Removing PrintHOST")
  550.          (optional "force")
  551.       )
  552. )
  553.  
  554.  
  555. (if (exists "ENVARC:PrintHOST" (noreq))
  556.       (delete "ENVARC:PrintHOST"
  557.           (prompt "Removing PrintHOST")
  558.           (optional "force")
  559.       )
  560. )
  561. (if (exists "ENV:HOSTPrinter" (noreq))
  562.       (delete "ENV:HOSTPrinter"
  563.          (prompt "Removing HOSTPrinter")
  564.          (optional "force")
  565.       )
  566. )
  567.  
  568. (if (exists "ENVARC:HOSTPrinter" (noreq))
  569.       (delete "ENVARC:HOSTPrinter"
  570.           (prompt "Removing HOSTPrinter")
  571.           (optional "force")
  572.       )
  573. )
  574.  
  575. ;Cleaning up some Beta Versions of Netpar
  576. (if (exists "ENV:NetPar/PrinterHOST" (noreq))
  577.       (delete "ENV:NetPar/PrinterHOST"
  578.            (prompt "Removing old PrinterHOST")
  579.            (optional "force")
  580.       )
  581. )
  582.  
  583. (if (exists "ENVARC:NetPar/PrinterHOST" (noreq))
  584.       (delete "ENVARC:NetPar/PrinterHOST"
  585.            (prompt "Removing old PrinterHOST")
  586.            (optional "force")
  587.       )
  588. )
  589.  
  590. (if (exists "ENV:NetPar/PrinterNAME" (noreq))
  591.       (delete "ENV:NetPar/PrinterNAME"
  592.            (prompt "Removing old PrinterNAME")
  593.            (optional "force")
  594.       )
  595. )
  596.  
  597. (if (exists "ENVARC:NetPar/PrinterNAME" (noreq))
  598.       (delete "ENVARC:NetPar/PrinterNAME"
  599.            (prompt "Removing old PrinterNAME")
  600.            (optional "force")
  601.       )
  602. )
  603.