;
; CIM's Installer Script.
; $VER: CIMBINInstallerScript 3.1.22 (10.05.00) Written by Jan-Erik Tervo 1998-2000
; Installer version 42.12 or better recommended
;

(ONERROR
      (EXIT)
        )

(SET @default-dest "CIM:bin/")

(IF  (exists "CIM:" (noreq))
     (
     
     (SET cim_vernum (getversion "CIM:bin/cim"))
     (SET cim_ver (/ cim_vernum 65536))
     (SET cim_rev (- cim_vernum (* cim_ver 65536)))

     (SET e_cim_vernum (getversion "stuff/bin/cim.exe"))
     (SET e_cim_ver (/ e_cim_vernum 65536))
     (SET e_cim_rev (- e_cim_vernum (* e_cim_ver 65536)))


     ; ENGLISH STRINGS

     (SET #alku_str
          (cat "\nThis script will only update the executables at CIM:bin/\n\nYou have currently CIM version " cim_ver "." cim_rev "\n\nYou are about to install version " e_cim_ver "." e_cim_rev)
          )

     (SET #str-installing-exe
          (cat "\n\nInstalling...")

     )

     (SET #str-installingmul
     (cat "\n\nInstalling multifunction.library")
     )
    

     (MESSAGE #alku_str)

     (COMPLETE 0)

     (SET CIMdirBin "CIM:bin/")
     (SET CIMdir "CIM:")
     (SET @default-dest CIMdir)

    
    
    (COPYLIB
        (help "No help for this function")
        (source "3rdpartylibs/multifunction.library")
        
        (dest "LIBS:")
        (prompt #str-installingmul)
        (confirm)
         )

     (COMPLETE 50)
     
     (DELETE "CIM:bin/cim")
     (DELETE "CIM:bin/waitforthefile")

     (COPYFILES
        (source "stuff/bin/")
        (pattern "#?")
        (dest CIMdirBin)
        (prompt #str-installing-exe)
        )

     (COMPLETE 75)

     (RENAME "CIM:WPositions" "CIM:CONFIG/WPositions")

     (RENAME "CIM:area_codes" "CIM:CONFIG/area_codes")

     (RENAME "CIM:ccodes" "CIM:CONFIG/ccodes")
     
     (RENAME "CIM:bin/cim.exe" "CIM:bin/cim")
          (RENAME "CIM:bin/cim.exe.asc" "CIM:bin/cim.asc")
     
     (RENAME "CIM:bin/waitforthefile.exe" "CIM:bin/waitforthefile")
          (RENAME "CIM:bin/waitforthefile.exe.asc" "CIM:bin/waitforthefile.asc")
     
     

     (PROTECT "CIM:bin/#?" "rwed")

     (RUN "multiview IMPORTANT.txt")

     )
     (MESSAGE "CIM is not installed correctly! (No CIM: assign.) Can't update.")
)
(COMPLETE 100)

; end of installation

(EXIT)

