
;
; Installer Script for LaMeRKiLLeR 2.0
; $VER: 1.1 (11.1.97)
;

(set @app-name "LaMeRKiLLeR")
(set @user-level 2)
(set cpu (database "cpu"))

(set @default-dest "SYS:")
(procedure WAITX (set X 1) ( (while (< X 90) (set X (+ X 1)))))
(procedure WAITL (set X 1) ( (while (< X 2350) (set X (+ X 1)))))

(working "\n\n\n\n\n\n\n\n\n\n\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n\n\n\n\n\n\n\n\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n\n\n\n\n\n\n\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n\n\n\n\n\n\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n\n\n\n\n\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n\n\n\n\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n\n\n\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n\n\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "\n|LaMeR KiLLeR 2.0|") (WAITX)
(working "|LaMeR KiLLeR 2.0|") (WAITX)
(working "|LaMeR KiLLeR 2.0|") (WAITL)
(working "-|LaMeR KiLLeR 2.0|-") (WAITX)
(working "\\-|LaMeR KiLLeR 2.0|-/") (WAITX)
(working "/\\-|LaMeR KiLLeR 2.0|-/\\") (WAITX)
(working "-/\\-|LaMeR KiLLeR 2.0|-/\\") (WAITX)
(working "-/\\- |LaMeR KiLLeR 2.0| -/\\") (WAITX)
(working "-/\\-  |LaMeR KiLLeR 2.0|  -/\\") (WAITX)
(working "-/\\-   |LaMeR KiLLeR 2.0|   -/\\") (WAITX)
(working "-/\\-    |LaMeR KiLLeR 2.0|    -/\\") (WAITX)
(working "-/\\-     |LaMeR KiLLeR 2.0|     -/\\") (WAITX)
(working "-/\\-      |LaMeR KiLLeR 2.0|      -/\\") (WAITX)
(working "-/\\-       |LaMeR KiLLeR 2.0|       -/\\") (WAITX)
(working "-/\\-        |LaMeR KiLLeR 2.0|        -/\\") (WAITX)
(working "-/\\-         |LaMeR KiLLeR 2.0|         -/\\") (WAITX)
(working "-/\\-          |LaMeR KiLLeR 2.0|          -/\\") (WAITX)
(working "-/\\-           |LaMeR KiLLeR 2.0|           -/\\") (WAITX)
(working "-/\\-            |LaMeR KiLLeR 2.0|            -/\\") (WAITX)
(working "-/\\-             |LaMeR KiLLeR 2.0|             -/\\") (WAITX)
(working "-/\\-              |LaMeR KiLLeR 2.0|              -/\\") (WAITX)
(working "-/\\-               |LaMeR KiLLeR 2.0|               -/\\") (WAITX)
(working "-/\\-                |LaMeR KiLLeR 2.0|                -/\\") (WAITX)
(working "-/\\-                 |LaMeR KiLLeR 2.0|                 -/\\") (WAITX)
(working "-/\\-                  |LaMeR KiLLeR 2.0|                  -/\\") (WAITX)
(working "-/\\-                   |LaMeR KiLLeR 2.0|                   -/\\") (WAITX)
(working "-/\\-                    |LaMeR KiLLeR 2.0|                    -/\\") (WAITX)
(working "-/\\-                     |LaMeR KiLLeR 2.0|                     -/\\") (WAITX)

        (set
               #envpath    "ENV:LaMeRKiLLeR"
               #envarcpath "ENVARC:LaMeRKiLLeR"
               @prog-source (pathonly @icon)
        )

        (message "Welcome to the installation script of:\n\n|LaMeR KiLLeR 2.0|\n(07-01-97)\n\nby Zapek\n\nThe Ultimate AmIRC FrontDoor\n\n(Help is available at any time. Use and abuse it!)")

        (if (not(exists "libs:reqtools.library"))
        (exit "LaMeRKiLLeR needs reqtools.library to work correctly.\n\n Please install it (not supplied with the archive)." (quiet)))

        (complete 0)

        (set @destdir (askdir  (prompt "Please select the AmIRC drawer.\n")
                 (help "Select the drawer where AmIRC is. A drawer will be created in PROGDIR:rexx/LaMeRKiLLeR if not already present.")
                 (default "SYS:")))

        (set @lkdir (tackon @destdir "rexx/LaMeRKiLLeR"))

        (if (exists @lkdir)
        (message("It seems that you have a previous version of LaMeRKiLLeR installed (1.0 - 1.02).\n\nThe current version of LaMeRKiLLeR has completely changed.\nTo work correctly, I must delete the old files....")))

        (if (exists @lkdir)
        (delete @lktar (optional "force")(all)))

        (complete 10)

        (if (not (exists @lkdir (noreq)))
        (makedir @lkdir))

        (complete 20)

        (set @lktar (tackon @prog-source "rexx"))

        (set @lkdir (tackon @destdir "rexx"))

        (copyfiles (source @lktar)
                   (dest @lkdir) (all)
                   )

        (complete 30)

        (set @libdir (tackon @prog-source "libs/rexxreqtools.library"))

        (set @muidir (tackon @prog-source "libs/MUIRexx"))

        (copylib (prompt "LaMeRKiLLeR needs rexxreqtools.library for the requesters.") (source @libdir) (dest "LIBS:") (confirm) (help "rexxreqtools.library provides a full range of requesters handled by reqtools.library.\nIt is supplied with the archive. If not, then you may have a wrong archive."))

        (complete 40)

        (set @muitar (tackon @prog-source "SYS:Rexxc"))

        (copylib (prompt "LaMeRKiLLeR also needs MUIRexx to build the GUI.") (source @muidir) (dest @muitar) (confirm) (help "MUIRexx is an interface between MUI and ARexx ports.\nIt is supplied with the current archive. If not, then you may have a wrong archive."))

        (set @muidir (tackon @prog-source "libs/Icon.mcc"))

        (set @muitar (tackon @prog-source "MUI:libs/mui"))

        (copylib (prompt "Icon.mcc is needed by MUIRexx." (source @muidir) (dest @muitar) (confirm) (help "Icon.mcc is a little file needed by MUIRexx to build some aspects of its interface.")))

        (complete 50)

        (set LKType (askchoice (prompt"Select the startup system of LaMeRKiLLeR.") (help"Manual:\nLaMeRKiLLeR is not started automatically. You'll have to start it by hand (an alias (/RunLK) is provided for this).\n\nAutomatic:\nLaMeRKiLLeR is automatically started when you run AmIRC (including multiples copies).\n")(choices "Manual" "Automatic") (default 1)))

        (set LKWC (askbool (prompt"Do you want to install the default WordKick list?\nYou may activate and/or modify it later.\nSee Help to know the words.") (help"This is the default list:\n\n[PC]  PC is too LAME!\n[Windows]  This shit suxxs!\n[Win95]  No shit like this here!\n[Pentium]  Bad processor!\n[IBM]  Big Blue's DEAD!\n[P60]  What a joke! (up to P200)\n[Microsoft]  All they do suxxs!\n[NetScape]  Stupid Web Browser!\n[Intel]  INTEL OUTSIDE!\n[W95]  What an insult! Don't come back!\n[(#G]  NO COMIC CHAT HERE!!!\n\nThat's all. Me? I don't like the PCs? How did you guess? :) ")))

        (set @envd "ENV:LaMeRKiLLeR/")

        (set @enva "ENVARC:LaMeRKiLLeR")

        (if (exists (tackon @envd "MODE"))
        ((message("You have the configuration of an old release of LaMeRKiLLeR (1.0-1.02)\nIt is incompatible with the new configuration (except WordKick list). I must delete them now, otherwise LaMeRKiLLeR 2.0 will not work.\n")) (delete (tackon @envd "ChanList")) (delete (tackon @envd "MODE")) (delete (tackon @envd "WORDKICK")) (delete (tackon @envd "userlist"))))

        (if (exists (tackon @enva "MODE"))
        ((delete (tackon @enva "ChanList")) (delete (tackon @enva "MODE")) (delete (tackon @enva "WORDKICK")) (delete (tackon @enva "userlist"))))

        (set FirstConf (askbool(prompt "Now, I'm going to configure AmIRC for LaMeRKiLLeR. You'll have to select your default configuration (usually Default.AmIRCfg) and then the program will write a new configuration called LK.AmIRCfg.\n Don't worry, this may take a few seconds...\n\nNote: Your original configuration IS PRESERVED.\n\nSelect NO if you did it already before.") (help "Do it if it's the first time you install it.")))

        (if FirstConf (

        (set @source (askfile (prompt "Please select your default configuration (usually Default.AmIRCfg).") (default (tackon @destdir "Default.AmIRCfg")) (help "LaMeRKiLLeR will be installed automatically within AmIRC. Your original configuration is preserved.")))

        (set LKEx (exists (tackon @destdir "LK.AmIRCfg")))

        (if LKEx (delete (prompt"I've found a LK.AmIRCfg. Do you want to delete it ?") (tackon @destdir "LK.AmIRCfg") (confirm)(help "The choice is up to you. The presence of LK.AmIRCfg means that you have installed it before.\nIf you want to delete it, then a new configuration if created.")))

        (set LKEx (exists (tackon @destdir "LK.AmIRCfg")))

        (if LKEx (set @fuck "fuck") (working "Creating LK.AmIRCfg from Default.AmIRCfg...\n\nPlease wait a moment..."))

        (if LKEx (set @Fuck "fuck") (run "ModifyConf" LKType LKWC @destdir "zzarjk" @source))

        (set confcode (rexx "Result.rexx" "LKConf"))

        (if (= confcode 12) (exit "Couldn't open the source configuration (have you selected an EXISTING file?). Run the installation again." (quiet)))

        (if (= confcode 13) (exit "Couldn't open the target configuration (LK.AmIRCfg, is the disk full, the object still in use?). Run the installation again."(quiet)))
        ))

        (complete 60)

        (set VERER (askbool (prompt"Do you want to clear the version reply of AmIRC? This will prevent you from being flooded and works for every version of AmIRC (if not already patched).\nLaMeRKiLLeR's got its own version reply string built in.") (help"It's better to clear the version reply string of AmIRC, because it's too long and LaMeRKiLLeR's one is better :)")))

        (if VERER (set @source (askfile (prompt "Please select the AmIRC executable") (default (tackon @destdir "AmIRC"))(help "The executable AmIRC will be patched, so no version string will be sent (except's LaMeRKiLLeR's one). If you've got a special version of AmIRC with a different version reply, then nothing will be done."))))

        (if VERER (working "Deleting the version reply of AmIRC...\n\nPlease wait..."))

        (if VERER (run "VersionEraser" @destdir "zzarjk" @source))

        (set vercode (rexx "Result.rexx" "LKVer"))

        (if (= vercode 12) (exit "Couldn't open the AmIRC input file (have you selected it RIGHT?). Run the installation again."(quiet)))

        (if (= vercode 13) (exit "Couldn't open the AmIRC output file (is the disk full or the file still in use?. Run the installation again."(quiet)))

        (if (= vercode 14) (exit "Search Window error! Couldn't patch the AmIRC executable. Please mail zapek@geocities.com immediatelly and include your AmIRC version number."(quiet)))

        (if (= vercode 11) (message "I didn't found an original version reply in AmIRC.\n\nEither your AmIRC executable is already patched or the version reply is different.\n\nMail zapek@geocities.com if you are sure it's an original."))

        (if VERER (delete (tackon @destdir "AmIRC")))

        (if VERER (rename (tackon @destdir "AmIRC.pch") (tackon @destdir "AmIRC")))

        (complete 70)

        (message "Let's copy the docs to the LaMeRKiLLeR directory. The doc'll be available when you press the 'HELP' key on LaMeRKiLLeR's GUI.")

        (set @lkdir (tackon @destdir "rexx/LaMeRKiLLeR"))

        (set @lktar (tackon @prog-source "LaMeRKiLLeR.guide"))

        (complete 80)

        (copyfiles (source @lktar)
                   (dest @lkdir)
                   )

        

        

        (if (not (exists @envd (noreq)))
        (makedir @envd))

        (if (not (exists @enva (noreq)))
        (makedir @enva))

        (complete 90)

        (set @wordlist (tackon @prog-source "libs/WordList"))

        (if LKWC (copyfiles (source @wordlist)
                            (dest @envd)
                            (nogauge))
                 (copyfiles (source @wordlist)
                            (dest @enva)
                            (nogauge)))


        (complete 100)

        (message "Installation complete!\n\nLaMeRKiLLeR 2.0 is now on your machine. But remember that:\n\nIf you want to activate it, run AmIRC and then load LK.AmIRCfg. Before connecting to a server.\n\nTo make LaMeRKiLLeR active on every session, Save the configuration as Default.\n\nEnjoy!\n\nZapek")

