;
; $VER: Install-ADAPCMCFL 1.21 (17/01/07) Leaman Computing 
;
; Copyright (C) 2006-2007 Leaman Computing and may not be distributed without written prior consent
; 
(complete 0)

(set #installertitle "ADAPCMCFL INSTALLER v1.21\n")

(onerror
(USER 2)
(IF (> @ioerr 0)
(Message ("\n\nA Dos Error %ld has occured" @ioerr)
"\n\n\n\nPlease consult your Workbench manual"
(" for further details, or type Fault %ld from a shell." @ioerr))
)
)
(User 2)
;
    (set #oschoice
        (askchoice
            (prompt #installertitle "\nPlease choose your version of AmigaOS")
            (choices "AmigaOS 3.x" 
                    "AmigaOS 2.x")
            (help  )
            (default 0)
        )
    )

(if (= #oschoice 0)
(

(message #installertitle
" \n-Thank you for supporting AmigaKit.com-\n\n"
"  This installer will perform the following actions:\n\n  1. Copy the programs CardReset & CardPatch to C:"
" \n 2. Update your S:StartUp-Sequence"
" \n 3. Copy file fat95 to L:"
" \n 4. Copy file CF0 to DEVS:Dosdrivers "
" \n 5. Copy file compactflash.device to DEVS:"
)
(PROCEDURE RESELECT
(SET components
(askoptions
(Prompt "Which files do you wish to install?\n CardReset & CardPatch are only required if your Amiga hardware has not been modified with a PCMCIA RESET fix")
(help (cat 
"\n\CardReset - \n"
"                        CardReset is a software patch for the PCMCIA RESET problem\n"
"                         It will be installed in the C: directory.\n"
"                         Consult author's original documentation for more information.\n"
"\n\nCardPatch - \n"
"                        CardPatch patches various bugs in card.resource\n"
"                         It will be installed in the C: directory.\n"
"                         Consult author's original documentation for more information.\n"
"\n"
"The S:StartUp-Sequence will be modified with following lines added at start: \n"
"C:CardPatch \nC:CardReset TICKS 50\n"
"\n"
@askoptions-help))
(choices
"CardReset & CardPatch"
"Update S:StartUp-Sequence"
"Copy file fat95 to L:"     
"Copy file CF0 to DEVS:Dosdrivers"
"Copy file compactflash.device to DEVS:"
)
(default -1)
)
)
)

(RESELECT)
(while (= components 0)
(RESELECT)
)

(IF (IN Components 0)
(
       (copyfiles
           (prompt "\nInstalling file CardReset into SYS:C/ directory\n")
           (help )
           (source "CardReset/CardReset")
           (confirm)
           (infos)
           (dest "SYS:C/")
        )
        (complete 30)  
       (copyfiles
           (prompt "\nInstalling file CardPatch into SYS:C/ directory\n")
           (help )
           (source "CardPatch/CardPatch")
           (confirm)
           (infos)
           (dest "SYS:C/")
        )
        (complete 40)  
    )
)

(IF (IN Components 1)
(
    (set backupdir (tackon "s:" "backup"))
    (if                                         
       (= (exists backupdir) 0)
        (
          (makedir backupdir (infos))
        )
    )  
       (copyfiles
           (prompt "\nModifying the file S:Startup-Sequence\n(the file will be backed up to S:Backup/)")
           (help )
           (source "sys:s/startup-sequence")
           (confirm)
           (infos)
           (dest "SYS:S/Backup/")
       )
       (complete 60)
       (run "type install.s sys:s/backup/startup-sequence > sys:s/startup-sequence")     
    )
)



(IF (IN Components 2)
(
       (copyfiles
           (prompt "\nInstalling file fat95 into SYS:L/ directory\n")
           (help )
           (source "fat95/l/fat95")
           (confirm)
           (infos)
           (dest "SYS:L/")
        )
        (complete 70)  
))


(IF (IN Components 3)
(
       (copyfiles
           (prompt "\nInstalling file CF0 into SYS:DEVS/DosDrivers/ directory\n")
           (help )
           (source "cfd/devs/CF0")
           (confirm)
           (infos)
           (dest "SYS:DEVS/DosDrivers/")
        )
        (complete 80)  
))

(IF (IN Components 4)
(
       (copyfiles
           (prompt "\nInstalling file compactflash.device to SYS:DEVS/ \n")
           (help )
           (source "devs/compactflash.device")
           (confirm)
           (infos)
           (dest "SYS:DEVS/")
        )
        (complete 90)  
))

(complete 100)

(Message "\nINSTALLATION COMPLETE\nREBOOT YOUR AMIGA\n"
   "CardReset & CardPatch © Artur Pogoda \n\n"
   "FAT95 © 2003 Torsten Jager \n\n"
   "CFD © 2003 Torsten Jager \n\n"    
   "ADAPCMCFL Install © 2006 Leaman Computing\n\n")
))

(if (= #oschoice 1)
(

(message #installertitle
" \n-Thank you for supporting AmigaKit.com-\n\n"
"  This installer will perform the following actions:\n"
" \n 1. Update your DEVS:mountlist"
" \n 2. Copy file fat95 to L:"
" \n 3. Copy file compactflash.device to DEVS:"
"\n 4. Copy file Mount_CF0 to SYS:WBStartup"
)
(PROCEDURE RESELECT
(SET components
(askoptions
(Prompt "Which files do you wish to install?\n")
(help (cat 
"\n"
@askoptions-help))
(choices
"Update DEVS:mountlist"
"Copy file fat95 to L:"     
"Copy file compactflash.device to DEVS:"
"Copy file Mount_CF0 to SYS:WBStartup"
)
(default -1)
)
)
)

(RESELECT)
(while (= components 0)
(RESELECT)
)

(IF (IN Components 0)
(
        (if                                         
           (= (exists "sys:devs/mountlist") 1)
            (
        (set backupdir (tackon "DEVS:" "backup"))
        (if                                         
           (= (exists backupdir) 0)
            (
              (makedir backupdir (infos))
            )
        )  
           (copyfiles
               (prompt "\nModifying the file DEVS:mountlist\n(the file will be backed up to DEVS:Backup/)")
               (help )
               (source "sys:devs/mountlist")
               (confirm)
               (infos)
               (dest "SYS:DEVS/Backup/")
           )
           (run "type sys:devs/backup/mountlist ADAPCMCFL:devs/mountlist > sys:devs/mountlist")     
        ))

    (if                                         
       (= (exists "sys:devs/mountlist") 0)
        (
               (copyfiles
                   (prompt "\nCopying the mountlist file to DEVS:\n")
                   (help )
                   (source "ADAPCMCFL:devs/mountlist")
                   (confirm)
                   (infos)
                   (dest "SYS:DEVS/")
               )
    ))

        (complete 60)
    )
)


(IF (IN Components 1)
(
       (copyfiles
           (prompt "\nInstalling file fat95 into SYS:L/ directory\n")
           (help )
           (source "ADAPCMCFL:fat95/l/fat95")
           (confirm)
           (dest "SYS:L/")
        )
        (complete 70)  
))


(IF (IN Components 2)
(
       (copyfiles
           (prompt "\nInstalling file compactflash.device to SYS:DEVS/ \n")
           (help )
           (source "ADAPCMCFL:devs/compactflash.device")
           (confirm)
           (dest "SYS:DEVS/")
        )
        (complete 80)  
))

(IF (IN Components 3)
(
       (copyfiles
           (prompt "\nInstalling file Mount_CF0 to SYS:WBStartup/ \n")
           (help )
           (source "ADAPCMCFL:s/Mount_CF0")
           (confirm)
           (infos)
           (dest "SYS:WBStartup/")
        )
        (complete 90)  
))

(complete 100)

(Message "\nINSTALLATION COMPLETE\nREBOOT YOUR AMIGA\n"
   "CardReset & CardPatch © Artur Pogoda \n\n"
   "FAT95 © 2003 Torsten Jager \n\n"
   "CFD © 2003 Torsten Jager \n\n"    
   "ADAPCMCFL Install © 2007 Leaman Computing\n\n")
))







