Metropoli BBS
VIEWER: install_amftp MODE: TEXT (LATIN1)
;******************************************************************************
;      ____           ______ ______ ______
;     / __ \         / ____//_  __// __  /
;    / /_/ /_   _   / /_     / /  / /_/ /
;   / __  // \_/ \ / __/    / /  / ____/
;  / / / // /__/ // /      / /  / /
; /_/ /_//_/  /_//_/      /_/  /_/
;
; $VER: 1.53c (March-05-1996) 
; Changes, suggestions or problems: rcr@netcom.com
; AmFTP Installer ©1995,1996 by Robert C. Reiswig 
;******************************************************************************
;*** System Stuff ***
(set cpu (database "cpu"))  (set vblank (database "vblank"))
(set graphmem (database "graphics-mem")) (set totmem (database "total-mem"))
(set osver (/ (getversion "LIBS:version.library") 65536))
(if (= vblank "60") ((set blank "NTSC")) ((set blank "PAL")))
(set fastmem (- totmem graphmem))

(if (= osver 37) (set workbench "2.0")) (if (= osver 38) (set workbench "2.1"))
(if (= osver 39) (set workbench "3.0")) (if (= osver 40) (set workbench "3.1"))
(if (= osver 41) (set workbench "4.0"))

(set cpu (database "cpu"))
(if (= cpu 68000) (set #cpu 0)) (if (= cpu 68010) (set #cpu 1))
(if (= cpu 68020) (set #cpu 2)) (if (= cpu 68030) (set #cpu 3))
(if (= cpu 68040) (set #cpu 4)) 
(if (> (exists ("sys:libs/68060.library")) 0) (set #cpu 5) )

(set vernum1 (getversion "AmFTP")) (set ver1 (/ vernum1 65536)) 
(set rev1 (- vernum1 (* ver1 65536) ) ) (set AmFTPver (cat ver1 "." rev1))

(if (> (exists ("env:Language")) 0) (set lanfound (getenv "Language")) )
(set lan 0)

(if (= "english"    lanfound) (set lan 0))  (if (= "deutsch"    lanfound) (set lan 1))
(if (= "svenska"    lanfound) (set lan 2))  (if (= "suomi"      lanfound) (set lan 3))
(if (= "français"   lanfound) (set lan 4))  (if (= "norsk"      lanfound) (set lan 5))
(if (= "español"    lanfound) (set lan 6))  (if (= "greek"      lanfound) (set lan 7)) 
(if (= "nederlands" lanfound) (set lan 8))  (if (= "italiano"   lanfound) (set lan 9)) 
(if (= "bosanski"   lanfound) (set lan 10)) (if (= "dansk"      lanfound) (set lan 11)) 
(if (= "polski"     lanfound) (set lan 12))

(if (> lan 12) (set lan 0))

(set #English    "English")  (set #Deutsch    "Deutsch")
(set #Français   "Français") (set #Español    "Español")
(set #Svenska    "Svenska")  (set #Nederlands "Nederlands")
(set #Norsk      "Norsk")    (set #Suomi "Suomi")
(set #Greek      "Greek")    (set #Italiano "Italiano")
(set #Bosanski   "Bosanski") (set #Dansk "Dansk")
(set #Polski     "Polski")


(set mfound 0) (set newicon1 1) 
(set keeper 1) (set firsttime 0)

;********************************************************************
; English Strings
;********************************************************************
(set #about (cat "\n\n\nWelcome to\n\nAmFTP " AmFTPver "\n\nCopyright © 1995-1996 by Mathias Mischler\n\nAll Rights Reserved.\n") )
(set #nomui (cat "\n\nAmFTP uses Magic User Interface (MUI).\n\nThe installer has not found MUI: to be assigned, "
                 "therefore you AmFTP will not work correctly.  You will need to install "
                 "MUI before running AmFTP."
            )
)
(set #whereAmFTP "Where do you wish to install AmFTP. A directory called 'AmFTP' will be created if one is not there. If a copy of AmFTP is found it will be backed up.")
(set muiver "No Version Installed")
(set #newermui "\n\nAmFTP needs version 3.0 or higher of MUI installed to work correctly.\n\nNow would be a good time to Upgrade!\n\n It looks like you have: \n\n")
(set #need-os "\n\nThe 68020 version of AmFTP needs version 3.0 or higher of the Amiga OS installed to work correctly.\n\n It looks like you have: \n\n")
(set #000used "\n\nThe 68000 version will be installed.") 
(set #filethere1 "\n\nThe installer has found AmFTP version ")
(set #filethere2 " at ")
(set #filethere3 "\n\nThe file will be renamed to ")
(set #filethere4 " and it will then be moved to ")
(set #oktodelete1 "\nIs it ok to delete the older AmFTP binary so that the AmFTP Directory can be made?\n")
(set #oktodelete2 "\nIs it ok to delete the older _renamed_ AmFTP binary so that the AmFTP Directory can be made?\n")
(set #backuptoXXX "Back-UP to file named 'AmFTP")
(set #copyover "Copy Over Old Version")
(set #AmFTPfound "\nThe Installer has found a copy of AmFTP already installed. What do you want to do?\n")
(set #askcpu "\nCPU Check: What CPU does the machine have that you are installing AmFTP on? The installer has found:\n")
(set #no020found "\n\nThe 68020 Version of AmFTP , AmFTP020, was not found in this archive the 68000 version was installed.")
(set #newicon "\nDo you wish to copy over one of the AmFTP Icons from the archive? If you have any ToolTypes already set you should select no.\n")
(set #pickicon "\nAmFTP has a number of different icons you can choose from. Which one would you like to use?\n")
(set #nomultiview (cat "The installer could not find multiview or you are running on a 2.0x Amiga. "
                       "The AmFTP Installer will let you choose between a few different icon to use. "
                       "You can use a picture viewer to look at the 'Icons/ftp_Icons.iff' to see the choices side-by-side, "
                       "or you can just look in the Icon drawer from where you are installing AmFTP from."
                  )
)
(set #nonewicon  "No  - ToolTypes already set.")
(set #yesnewicon "Yes - Copy over Icon.")
(set #whatcat "\nSelect the AmFTP Language catalog you wish to install.\n")
(set #wherecat "\nWhere do you wish to install the AmFTP Language Catalog? Default is ")
(set #catnofind "Can not find this catalog in this AmFTP archive. You may need to get the complete archive from the support site.")
(set #whatdocs "\nWhat AmFTP documentation would you like to install?\n")
(set #wheredocs "Where would you like the AmFTP documentation you selected to be installed?")
(set #byebye (cat "\nAmFTP Install Complete!\n\n" ))
;********************************************************************
; Hello
;********************************************************************
(message #about)
(welcome) 

;********************************************************************
; MUI installed?
;********************************************************************
(if (< (exists "mui:") 2)  (message #nomui) )

;********************************************************************
; Check for AmFTP020 requs
;********************************************************************
(set ver 0)
(if (exists "mui:mui") 
 (
  (set vernum (getversion "mui:mui") )
  (set ver (/ vernum 65536)) (set rev (- vernum (* ver 65536) ) )

  (if (= ver 7) (set muiver "2.0") )   (if (= ver 8) (set muiver "2.1") )
  (if (= ver 9) (set muiver "2.2") )   (if (= ver 10) (set muiver "2.3") )
  (if (= ver 11) (set muiver "3.0") )  (if (= ver 12) (set muiver "3.1") )
  (if (= ver 12) (set muiver "3.2") )
 )
)

(if (< ver 11)   ( (message (cat #newermui muiver))   (set cpuPick 0) ))
;(if (< osver 39) ( (message (cat #need-os workbench #000used)) (set cpuPick 0) ))


;********************************************************************
; Ask where to put AmFTP & Make dir if needed
;********************************************************************
(set Package (getassign "AmiTCP"))
  (if (= Package "") (set Package (getassign "Inet"))
)

(set AmFTPdir  (askdir (prompt #whereAmFTP)
		       (help   #whereAmFTP)
     		       (default Package)
               )  
)

(set where AmFTPdir)

(if (= 1 (exists (tackon where "AmFTP") ) ) 
  (
    (set vernum1 (getversion (tackon where "AmFTP") ))
    (set ver1 (/ vernum1 65536)) (set rev1 (- vernum1 (* ver1 65536) ) )
    (set AmFTP_old (cat ver1 "." rev1))

    (message (cat #filethere1 ver1 "." rev1 #filethere2 where #filethere3 
                  (cat "AmFTP" AmFTP_old) #filethere4 (tackon AmFTPdir "AmFTP") )
    )
    

    (copyfiles (source (tackon where "AmFTP"))
               (dest where) 
               (infos)
               (newname (cat "AmFTP" AmFTP_old))
    )

    (delete (tackon AmFTPdir "AmFTP") (prompt #oktodelete1) (help #oktodelete1) (confirm) (infos)) 

    (if (< (exists (tackon AmFTPdir "AmFTP")) 2) (makedir (tackon AmFTPdir "AmFTP") (infos)) )    

    (copyfiles (source (tackon where (cat "AmFTP" AmFTP_old) ))
                       (dest (tackon AmFTPdir "AmFTP")) 
                       (infos)
               
    )

    (delete (tackon where (cat "AmFTP" AmFTP_old)) (prompt #oktodelete2) (help #oktodelete2) (confirm) (infos) ) 

    ;(set firsttime 1)

  )
)

(if (< (exists (tackon AmFTPdir "AmFTP")) 2) (makedir (tackon AmFTPdir "AmFTP") (infos)) )
(set where (tackon AmFTPdir "AmFTP"))
(set @default-dest where)

;********************************************************************
; Check for old & backup
;********************************************************************
(if (exists (tackon where "AmFTP")) 
  (
      (set vernum1 (getversion (tackon where "AmFTP") ))
      (set ver1 (/ vernum1 65536)) (set rev1 (- vernum1 (* ver1 65536) ) )
      (set AmFTP_old (cat ver1 "." rev1))

      (set keeper  (askchoice (choices  (cat #backuptoXXX AmFTP_old "'")  #copyover)
                     (prompt #AmFTPfound)
	             (help   #AmFTPfound)
                     (default 0)
	           )
      )    


      (if (= keeper 0)
         (copyfiles (source (tackon where "AmFTP"))
                     (dest where) 
                     (infos)
                     (newname (cat "AmFTP" AmFTP_old))
         )
      )          

      (set firsttime 1)
    
  )
)

;********************************************************************
; Double Check on the CPU
;********************************************************************
(set cpuPick (askchoice (choices "68000" "68010" "68020" "68030"
		                 "68040" "68060"
		        )
			 (prompt #askcpu)
	                 (help   #askcpu)
          		 (default #cpu)
	  )
)

;********************************************************************
; Copy over correct AmFTP and Icon if wanted
;********************************************************************
(if (AND (> cpuPick 1) (exists ("AmFTP020")) )
   (copyfiles (source "AmFTP020") (dest where) (optional "nofail") (newname "AmFTP") )

   (copyfiles (source "AmFTP") (dest where) (optional "nofail") )
)


(if (AND (> cpuPick 1) (= (exists ("AmFTP020")) 0) )
 (message #no020found)
)

;(if (= firsttime 0)  (copyfiles (source "AmFTP.info") (dest where) (optional "nofail") ) )

(if (exists ("RegisterAmFTP"))
 (copyfiles (source "RegisterAmFTP") (dest where)  (infos) (optional "nofail") )
)


(if (OR (= keeper 0) (= firsttime 0))
  (
  
   (set newicon (askchoice (choices #yesnewicon #nonewicon)
                           (prompt #newicon)
	                   (help   #newicon)
                           (default 0)
	        )
   )
 
   (if (= newicon 0) 
     (
       (if (> (exists ("c:multiview")) 0)  ((set #mpath "c:") (set mfound 1)) )
       (if (> (exists ("sys:Utilities/multiview")) 0) ((set #mpath "sys:Utilities") (set mfound 1)) )
       (if (= mfound 1) (run (cat "run " (tackon #mpath "multiview ") "Icons/ftp_Icons.iff")) )
       (if (<> mfound 1) (message #nomultiview))


       (set pickicon (askchoice (choices "AmFTP:  World/Disk, 3 Arrows"
                                         "AmFTP2: Amiga w/WorldMap & Sel_Arrow"
                                         "AmFTP3: Amiga w/Earth"
                                )
                                (prompt #pickicon)
                                (help   #pickicon)
                                (default 0)
	        )
       )



     )
   )

  
   (if (= pickicon 0) (copyfiles (source "Icons/AmFTP.info") (dest where) (newname "AmFTP.info") (optional "nofail") ))
   (if (= pickicon 1) (copyfiles (source "Icons/AmFTP2.info") (dest where) (newname "AmFTP.info") (optional "nofail") ))
   (if (= pickicon 2) (copyfiles (source "Icons/AmFTP3.info") (dest where) (newname "AmFTP.info") (optional "nofail") ))

  )

)

;********************************************************************
; Select and copy over Catalog
;********************************************************************
(set catalog (askchoice (choices #English #Deutsch #Svenska #Suomi #Français
                                 #Norsk #Español #Greek #Nederlands #Italiano #Bosanski #Dansk #Polski)
                           (prompt #whatcat)
	                   (help   #whatcat)
                           (default lan)
             )
)



;(set #Bosanski   "Bosanski") (set #Dansk "Dansk")
;(set #Polski     "Polski")

(if (= catalog 0)  (set #lcat #English ))   (if (= catalog 1)  (set #lcat #Deutsch))
(if (= catalog 2)  (set #lcat #Svenska))    (if (= catalog 3)  (set #lcat #Suomi))
(if (= catalog 4)  (set #lcat #Français))   (if (= catalog 5)  (set #lcat #Norsk))    
(if (= catalog 6)  (set #lcat #Español))    (if (= catalog 7)  (set #lcat #Greek))
(if (= catalog 8)  (set #lcat #Nederlands)) (if (= catalog 9)  (set #lcat #Italiano))
(if (= catalog 10) (set #lcat #Bosanski))   (if (= catalog 11) (set #lcat #Dansk))
(if (= catalog 12) (set #lcat #Polski)) 

(if (<> catalog 0)
 (
  (if (> (exists (cat "Catalogs/" #lcat "/AmFTP.catalog")) 0)
    (
        (set wherecat  (askchoice (choices (tackon where (cat "Catalogs/" #lcat)) (cat "Locale:Catalogs/" #lcat) )
                                  (prompt (cat #wherecat (tackon where (cat "Catalogs/" #lcat)) "\n"))
	  	                  (help   #wherecat)
     		                  (default 0)
                       )  
        )

      (if (= wherecat 1)
        (
         (if (< (exists "Locale:") 2) ( (makedir "sys:Locale") (makeassign "Locale" "sys:Locale") ) )
         (if (< (exists "Locale:Catalogs") 2) (makedir "sys:Locale/Catalogs") )
         (if (< (exists (cat "Locale:Catalogs/" #lcat)) 2) (makedir (cat "sys:Locale/Catalogs/" #lcat)) )
         (copylib (source (cat "Catalogs/" #lcat "/AmFTP.catalog")) (dest (cat "sys:Locale/Catalogs/" #lcat)) )
        )
  
        (
         (if (< (exists (tackon where "Catalogs")) 2) (makedir (tackon where "Catalogs")) )
         (if (< (exists (tackon where (cat "Catalogs/" #lcat)) ) 2) (makedir (tackon where (cat "Catalogs/" #lcat)) ) )
         (copylib (source (cat "Catalogs/" #lcat "/AmFTP.catalog")) (dest (tackon where (cat "Catalogs/" #lcat)) ) (optional "nofail") )
        )
      )

    )

    (message (cat "\nCatalogs/" #lcat "/AmFTP.catalog\n\n" #catnofind))
  )


 )
)

;********************************************************************
; Ask and and copy docs if wanted!
;********************************************************************
(set docs (askoptions (choices "AmFTP.guide" "AmFTP.doc" "AmFTP.Changes")
		      (prompt #whatdocs)
                      (help #whatdocs)
	              (default 3)
	  )
)

(if (<> docs 0)
 (
   (set docsdir (askdir (prompt #wheredocs)
		       (help   #wheredocs)
     		       (default where)
                )  
   )

   (if (IN docs 0) (copyfiles (source "AmFTP.guide") (dest docsdir) (infos) (optional "nofail") ) )
   (if (IN docs 1) (copyfiles (source "AmFTP.doc") (dest docsdir) (infos) (optional "nofail") ) )
   (if (IN docs 2) (copyfiles (source "AmFTP.Changes") (dest docsdir) (infos) (optional "nofail") ) )

 )
)
;********************************************************************
; copy keyfile if there 
;********************************************************************
(if (> (exists "AmFTP.Key") 0)
 (copyfiles (source "AmFTP.Key") (dest where) (infos) (optional "nofail") ) 
)

;********************************************************************
; End Bye 
;********************************************************************
(exit #byebye)
[ RETURN TO DIRECTORY ]