;*catch any errors and pass dos errors to a message screen
;*if a dos problem occured
(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 WBVer (< 2424832 (getversion "exec.library" (resident))))
(set ARCPATH @default-dest)
;*****components*******
(Message "This is a script supplied with a Squirrel product to extract all the files"
" included on the PD disks.\n\n"
" None of these programs are required to use to your Squirrel product,"
" they are simply supplied to \"enrich the user experience!\". Please note that there"
" is NO technical support available from HiSoft on these products;"
" if you have a problem using them with the Squirrel SCSI interface we"
" will be more than happy to try and help, but we cannot offer general support"
" on these programs which are supplied at no charge.")
(PROCEDURE RESELECT
(SET components
(askoptions
(Prompt "Which archives do you want to install - See Help for info on each archive")
(help (cat 
"LhA_e138.run - This is the main LhA files and it is\n"
"               essential that you extract this file\n"
"               if you do not already have a copy of\n"
"               LhA."
"\n\ncdda112.lha - This a command line tool to allow the\n"
"              reading and writing of digital audio\n"
"              data across the SCSI bus if your\n"
"              CD-ROM drive supports it."
"\n\nReOrg3_1.lha - ReOrg 3.1 the disk optimiser."
"\n\nReOrg3_11pch.lha - ReOrg 3.11 Update patch."
"\n\nReqTools22c_user.lha - ReqTools archive required\n"
"                       by YACDP & other programs."
"\n\nviewpcd.lha - A PhotoCD viewer."
"\n\nVMM_V2_1.lha - A vitural memory manager."
"\n\nAmiCDROM-1.15.lha - A CD-ROM file system that\n"
"                     supports Multi-Session disks."
"\n\nDiskSalv11_31.lha - A disk repair program."
"\n\nDSLocale11_31.lha - The Locale files for DiskSalve"
"\n\njukebox.lha - A GUI CD-ROM player."
"\n\nYACDP1.2.lha - A GUI CD-ROM player that can\n"
"               play audio via SCSI."
@askoptions-help))
(choices
"LhA_e138.run"
"cdda112.lha"
"ReOrg3_11pch.lha"
"ReOrg3_1.lha"
"ReqTools22c_user.lha"
"viewpcd.lha"
"VMM_V2_1.lha"
"AmiCDROM-1.15.lha"
"DiskSalv11_31.lha"
"DSLocale11_31.lha"
"jukebox.lha"
"YACDP1.2.lha"                     
)
(default -1)
)
)
)

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

(IF (IN Components 0)

(
(set LHALOCATION 
(Askdir 
(Prompt "Select the location to extract LhA to\n Note: A new drawer will not be created") 
(help "") 
(disk)
(default ARCPATH)
)
) 
(set ARCPATH LHALOCATION)
(makeassign "LhA" LHALOCATION) 
(textfile
	(dest "T:Install_Temp")
	(append "a\n")
)
(run "From_Aminet_1:LhA_e138.run LhA: >CON: <T:Install_Temp")
(delete "T:Install_Temp")

(Startup "LhA Path"
(Prompt "Add the LhA path to your user-startup?")
(Help (cat "If you let the installer add the LhA path to your user-startup,"
" you will be able to type LhA from any directory when using the CLI/Shell"
" and it will run LhA.\n\n"
@startup-help))
(command
("Path %s Add quiet" LHALOCATION)
)
)
(set LHALOCATION "LhA:LhA")
)

(
(set LHALOCATION
(Askfile
(Prompt "Select the LhA file to use for extracting the archives?")
(help "Please note that this must a copy of LhA not a clone or a program"
" that claims to do the same things as LhA.")
(default @default-dest) 
)
)
)

)

(SET n 1)
(while 
(SET ARCHIVE (select n 
"LhA_e138.run"
"cdda112.lha"
"ReOrg3_1.lha"
"ReOrg3_11pch.lha"
"ReqTools22c_user.lha"
"viewpcd.lha"
"VMM_V2_1.lha"
"AmiCDROM-1.15.lha"
"DiskSalv11_31.lha"
"DSLocale11_31.lha"
"jukebox.lha"
"YACDP1.2.lha"
""
))

(If (IN components n)
(

(if (>= n 7)
(
(SET DISKNAME "From_Aminet_2:")
(askdisk
(Prompt "\n\nPlease insert Aminet disk 2 in any drive")
(help @askdisk-help)
(DEST "From_Aminet_2")
)
)
(SET DISKNAME "From_Aminet_1:")
)

(Set DESTINATION
(askdir
(prompt ("Select or create a directory for the archive %s" ARCHIVE))
(help "")
(default ARCPATH)
)
)
(set ARCPATH DESTINATION)
(IF (OR (= (substr DESTINATION (- (strlen DESTINATION) 1) ) ":")
      (= (substr DESTINATION (- (strlen DESTINATION) 1) ) "/"))
(set DESTINATION DESTINATION)
(set DESTINATION ("%s/" DESTINATION))
)
(run ("%s X %s%s %s >CON:" LHALOCATION DISKNAME ARCHIVE DESTINATION))
)
)
(complete (* n 9))
(set n (+ n 1))

)
(makeassign "LhA")

(askdisk
(Prompt "\n\nPlease insert Aminet disk 1 in any drive")
(help @askdisk-help)
(DEST "From_Aminet_1")
)

(complete 100)

(IF (AND (= WBVer 1) (= (exists "SYS:Utilities/Multiview") 1))
   (Run "Run SYS:Utilities/Multiview From_Aminet_1:Read.Me-FreeWare" (safe))
   (Run "Run From_Aminet_1:More From_Aminet_1:Read.Me-FreeWare" (safe))
)
