; ************************************************
; *
; * $VER: Install-ATAPI A4000 v1.00 Demo Vers (07.09.95)
; *
; * Installation for A4000 Atapi Package v 1.00
; *
; * Copyright © 1995 by Georg Campana
; *
; *    -------   G E R M A N    V E R S I O N    -----------
; *
; ************************************************

;/// Variabili
; ****************************
;       Variabili
; ****************************
;
(set DemoVersion        1) ; Demo Version
(set ProductName        "A4000 ATAPI DEUTSCHE VERSION"  )  ; product name
(set ProductBaseName    "A4000-Atapi")                    ; product base name
(set VersionNum         "1.00 ")                     ; product version number

(set OSVersion          (/ (getversion) 65536))
(set PctDone            0)

(set CPUOpts            0)    ; 0=68000,68010; 1=68020,68030,68040

(makeassign "CDPLUSPLUS" "" (safe))

(set Disk1Name                  "CDPLUSPLUS:")

(set MemSpace 1024)   ; 1K minimo di spazio necessario su disco

;///

;/// Proc setPkgOPts
(procedure setPkgOpts
;
; ****************************
; * Wich Parts
; ****************************
;
  (
        (set PkgOpts
                (askoptions
                        (prompt
                           "Suche aus was Du vom Package"
                           (" %s installieren willst" ProductName)
                        )
                        (help
                                "Hier kannst Du aussuchen welche Teile (Modules) Du vom"
                                (" Package %s installieren willst.\n" ProductName)
                                "\n"
                                "*** Atapi Device Driver\n"
                                "Hiermit wird der wichtige Device-Treiber"
                                " (cd.device ) ins Verzeichnis Devs: kopiert (Fundamental)\n"
                                "\n"
                                "*** CDplusplusFS\n"
                                "Mit dieser Option wird das spezielle Filesystem"
                                " der CD++ ins Verzeichnis L: kopiert (ratbar).\n"
                                "\n"
                                "*** MAP-Mini Atapi Player\n"
                                "Mit dieser Option wird der Mini Player"
                                " für CD-Audio ins Verzeichnis Utilities kopiert.\n"
                                "\n"
                                "*** TRKDownLoad Track-Downloader\n"
                                "Mit dieser Option wird das Program TRKDownload"
                                " (fürs Download von CD-Spuren) in Utilities kopiert.\n"
                                "\n"
                                "*** PlayCDXL\n"
                                "Mit dieser Option wird PlayCDXL ( ein Program"
                                " fürs Abspielen von CDXL Files ) in Utilities kopiert.\n"
                                "\n"
                                @askoptions-help
                        )
                        (choices
                                ; bit position 0 -- todo & 1
                                ;
                                "Atapi Device Driver          (16 Kbytes)"

                                ; bit position 1 -- todo & 2
                                ;
                                "CDplusplusFS - CD Filesystem (23 Kbytes)"

                                ; bit position 2 -- todo & 4
                                ;
                                "MAP- Mini Atapi Player       ( 9 Kbytes)"

                                ; bit position 3 -- todo & 8
                                ;
                                "TRKDownLoad- Track DownLoader(15 Kbytes)"

                                ; bit position 4 -- todo & 16
                                ;
                                "PlayCDXL - Player Film CDXL  (30 Kbytes)"

                        )
                )
        )
  )
)
;///

;/// Proc setDirPath

(procedure setDirPath
;
; ****************************
; * Ask the user for a directory name.
; ****************************
;
; these variables must be defined before calling this procedure:
;    DirPath
;
; this procedure returns the selected directory in DirPath
;
   (

       (set DirPath
               (askdir
                       (prompt ("Wo soll das Package installiert werden   ( Normalerweise SYS: )" )

                       )
                       (help   "Atapi Plug'n Play wird in das ausgesuchte Verzeichnis"
                               " Installiert.\n"
                               "Wenn Du es in eine Diskette installieren möchtest"
                               " dann stecke diese in den Drive und suche Sie aus"
                               " der Liste aus.\n"
                               "\n"
                               @askdir-help
                       )
                       (disk)
                       (default "SYS:")
               )
       )



   )
)
;///

;/// Proc AskFsIcon
;
;
(procedure AskFsIcon
;
; This procedure ask of wich cd Icon you want to install with wich Name
; It requires initialization of variables:
;
; In "DefaultIcon" ci deve essere quella accesa di default
; 
; Ridà in "IconChoose" qual icona
; 0 nessuna - 1 AmiCDFilesystem
; 2 AmiCDFS - 3 CDfilesystem - 4 CDplusplusFS
;
  (
    (set IconChoose
     
           (askchoice
                (prompt "Suche aus,für welches CD-Filesystem du ein Piktogram installieren möchtest")
                (help
                        "Hier kannst du aussuchen für welches Dateinsystem"
                        " Atapi Plug'n Play Installiert werden soll.\n"
                        "Hast Du schon CDplusplusFS installiert dann suche am besten"
                        " diese Möglichkeit aus.\n"
                        "\n"
                        "Sollte Dein CD-filesystem nicht in der Liste"
                        " vorkommen dann suche -Keines- aus , und"
                        " modifizier später die Tooltypes im"
                        " Piktogram :\n"
                        "Device wird\nDevice=cd.device\n"
                        "und Unit wird\nUnit=0\n\n"
                        @askchoice-help
                )
                (choices
                        "-Keines"
                        "-AmiCDFileSystem - by Nicola Salmoria"
                        "-cdrom-handler   - by Frank Munkert"
                        "-CDFileSystem    - by CBM Commodore"
                        "-CDplusplusFS    - by CD++"
                )
                (default DefaultIcon)
           )
    )
  )
)
;///

;/// Proc GetDevName
;
;  in DevName si ritrova il nome da usare per l'icona
;


(procedure GetDevName
   
   (
     (set DevName
           (askstring
                     (prompt "Schreibe hier den Namen für das installierte CD-Laufwerk ohne den Doppelpunkt\nz.B. CD0")
                     (help
                             "Der ausgesuchte Name wird der"
                             "  Name des Devices\n"
                             "Es ist ratbar keinen langen Namen"
                             " auszusucheni\n"
                             "\nAm besten CD0 oder CD1 usw."
                             " weil viele Programe diesen"
                             " Namen suchen\n"
                     )
                     (default "CD0")
           )
     )
   )
)
;///

;/// Proc AskAutoMount
;
;
(procedure AskAutoMount
;
; Chiede se l'icona deve essere inserita nel devs Dosdrivers o nel
; storage dosdrivers
;
  (
    (set AutoMount
     
           (askbool
                (prompt "Möchtest Du daß das Laufwerk bei jedem Computerstart"
                        " automatisch angeschaltet wird (Mount) ,"
                        " statt manuell per-Mauseklick ?"
                )
                (help
                        "Wenn Du positiv antwortest wird das Piktogram"
                        " des Devices in das Verzeichnis:\n"
                        "Devs:Dosdrivers kopiert\n"
                        "Bei jedem Start wird so auch automatisch das"
                        " CD-Laufwerk gestarted\n\n"
                        "Ansonsten wird es in: Storage:DosDrivers\n"
                        " kopiert , und Du mußt per-Hand auf das"
                        " Piktogram klicken um daß Laufwerk zu -Mounten-"
                )
                (choices
                        "Automatisch beim Start"
                        "Nein , manuell"
                )
                (default 1)
           )
    )
  )
)
;///


; *************************************************************************
; *                         ACTUAL START OF SCRIPT
; *
; * Ask all questions for the user now, do all of the work later.
; *************************************************************************
;
;/// MAIN SCRIPT
(onerror

)
; ****************************
;  Check for OS Version
; ****************************

(if (= DemoVersion 1)
    (message "\n" "\n"
             "Achtung: Das hier ist eine DEMO Version\n"
             "vom Program  A4000_Atapi_Deu !\n"
             "DU KANNST ES JEDEM KOMPLETT\n"
             "WEITERGEBEN (ausser den Crakker)" "\n"
             "\n" "\n" "\n"
             "Atapi Plug'n Play is Copyright by \n"
             "Georg Campana & Marco Campinoti ©1994"
             (help "Wenn Du die registrierte Version erhalten möchtest dann lies das Handbuch oder rufe 0039/565/850621 an")
    )
)


; ****************************
; ****************************
;

(set DirPath "SYS:")

(setDirPath)

(set @default-dest DirPath)

(set devdest  (tackon @default-dest "Devs"))
(set fsdest   (tackon @default-dest "L"))
(set utildest (tackon @default-dest "Utilities"))


(setPkgOpts)

(set DefaultIcon 0)

(if (= (exists (tackon fsdest "AmiCDFileSystem")) 1)
    (set DefaultIcon 1)
)

(if (= (exists (tackon fsdest "cdrom-handler")) 1)
    (set DefaultIcon 2)
)

(if (= (exists (tackon fsdest "CDFileSystem")) 1)
    (set DefaultIcon 3)
)

(if (IN PkgOpts 1)
    (set DefaultIcon 4)
)

(AskFsIcon)

(select IconChoose
   (set FsName 0)
   (set FsName "AmiCDFS")
   (set FsName "AmiCDHandler")
   (set FsName "CbmCDFS")
   (set FsName "CDplusplusFS")
)


(set AutoMount 1)
(set DevName "CD0")

(if (> @user-level 1)

    (if (<> IconChoose 0)
        (
         (GetDevName)
         (AskAutoMount)
        )
    )
)

(if (= AutoMount 1)
    (set Icondest  (tackon @default-dest "Devs"))
    (set Icondest  (tackon @default-dest "Storage"))
)





(if (IN PkgOpts 0)
    (set MemSpace (+ MemSpace 16000))
)
(if (IN PkgOpts 1)
    (set MemSpace (+ MemSpace 23000))
)
(if (IN PkgOpts 2)
    (set MemSpace (+ MemSpace  9000))
)
(if (IN PkgOpts 3)
    (set MemSpace (+ MemSpace 30000))
)
(if (IN PkgOpts 4)
    (set MemSpace (+ MemSpace 14000))
)
(if (<> IconChoose )
    (set MemSpace (+ MemSpace 1000))
)

(if (< (getdiskspace DirPath) MemSpace)
    (if(> (getdiskspace DirPath) 0)
       (
          (abort "ACHTUNG: Der übrige Speicherplatz\n"
                 ("auf der Platte %s\n" DirPath)
                 ("beträgt nur um %ld bytes\n" (getdiskspace DirPath) )
                 ("und es werden mindestens %ld benötigt\n" MemSpace)
                 "\n"
                 "Du kannst nochmal auf Install klicken\n"
                 "und weniger Utilities aussuchen , oder\n"
                 "unnötige Files von der Ziel-Platte\n"
                 ("%s löschen\n" DirPath)
          )
       )
    )
)














; if bit position 0 is on  Installa device
(if (IN PkgOpts 0)
     (

        
        (if (< (exists devdest (noreq)) 2)

            (makedir devdest
               (prompt "Neues Verzeichnis -Devs-")
               (infos)
            )
        )


        (copylib
            (prompt "Installiere Device Driver")
            (source (tackon Disk1Name "devs/cd.device"))
            (dest devdest)
            (optional force)
        )
        

     )
)
; if bit position 1 is on Installa FileSystem
(if (IN PkgOpts 1)
     (

        
        (if (< (exists fsdest (noreq)) 2)

            (makedir fsdest
               (prompt "Neues Verzeichnis -L-")
            )
        )


        (copylib
            (prompt "Installiere FileSystem von CD++")
            (source (tackon Disk1Name "l/CDplusplusFS"))
            (dest fsdest)
            (optional force)
        )
        

     )
)

; if bit position 2 is on Installa MAP
(if (IN PkgOpts 2)
     (

        
        (if (< (exists utildest (noreq)) 2)

            (makedir utildest
               (prompt "Neues Verzeichnis -Utilities-")
               (infos)
            )
        )


        (copyfiles
            (prompt "Installiere Mini Atapi Player")
            (source (tackon Disk1Name "utilities/MAP"))
            (dest utildest)
            (infos)
            (optional force)
        )
        

     )
)

; if bit position 3 is on Installa TRKDownLoad
(if (IN PkgOpts 3)
     (

        
        (if (< (exists utildest (noreq)) 2)

            (makedir utildest
               (prompt "Neues Verzeichnis -Utilities-")
               (infos)
            )
        )


        (copyfiles
            (prompt "Installiere TrkDownLoader")
            (source (tackon Disk1Name "utilities/TRKDownLoad"))
            (dest utildest)
            (infos)
            (optional force)
        )
        

     )
)

; if bit position 4 is on Installa PlayCDXL
(if (<> DemoVersion 1)
   (if (IN PkgOpts 4)
        (

           
           (if (< (exists utildest (noreq)) 2)

               (makedir utildest
                  (prompt "Neues Verzeichnis -Utilities-")
                  (infos)
               )
           )


           (copyfiles
               (prompt "Installiere PlayCDXL")
               (source (tackon Disk1Name "utilities/PlayCDXL"))
               (dest utildest)
               (infos)
               (optional force)
           )
           

        )
   )
)
(if (> IconChoose 0)
    (
        (if (< (exists Icondest (noreq)) 2)

            (makedir Icondest
               (prompt "Neues Verzeichnis Devs oder Storage")
               (infos)
            )
        )

        (set Icondest  (tackon Icondest "Dosdrivers"))
         
        (copyfiles
            (prompt "Installiere Device-Piktogram")
            (source (tackon Disk1Name (tackon "Devs/Storage" FsName)))
            (dest IconDest)
            (newname  DevName)
            (infos)
            (optional force)
        )

    
        (if (= AutoMount 1)
            ( message "\n" "\n"
                   "Bei jedem starten des Computers wird\n"
                   "das CD-Laufwerk automatisch ins System\n"
                   "eingebindet !\n"
                   "\n"
                   "Du kannst dieses Verhalten jederzeit verändern\n"
                   ("indem Du das Piktogram %s vom Verzeichnis" DevName)
                   "Devs/Dosdrivers ins Verzeichnis Storage/Dosdrivers\n"
                   "verschiebst\n"
            )
            ( message "\n" "\n"
                   "Du kannst jederzeit das CD-ROM Laufwerk einbinden \n"
                   ("indem du zweimal auf %s\n" DevName)
                   "im Verzeichnis Storage/Dosdrivers klickst\n"
                   "Soll es automatisch eigebunden werden, dann\n"
                   "verschieb das Piktogram ins Verzeichnis Devs/Dosdrivers"
            )
        )
    )
    ( message "\n" "\n"
           "Es wurde kein Piktogram für das\n"
           "CD-ROM Laufwerk ausgesucht .\n"
           "Du mußt es Dir deshalb selber bauen!\n"
           "\n"
           "Du kannst auch nocheinmal auf -Install- klicken\n"
           "und Dir ein CD-Filesystem aussuchen\n"
    )

)

(exit)
;///
