; Script to install Directory Opus version 5.11
;
; Directory Opus Install Version $VER: Install-Opus 5.11 20.5.95
; COPYRIGHT ©1995 GP SOFTWARE, AUSTRALIA
;

(onerror
        (makeassign "DOPUSDEST" (safe)) 
)


(complete 0)

;
;check user has Dos 2
;

(set DOSTYPE (/ (getversion) 65536))
(if
        (NOT (>= DOSTYPE 37))
        (abort "Directory Opus 5 requires AmigaDOS 2.04 or higher."
                " If you have an earlier version of AmigaDOS you must purchase an upgrade before using Opus 5.")
)

(set wbisgo 0)

;
; see if this is really an update
;


(set is_update 0)
(set DOPus_Dest (getassign "DOpus5" "a"))


; if update, be sure they want program in same place

(if DOPus_Dest
        (if     (askbool
                        (prompt "Opus 5 has already been installed on this system.\n"
                                "The current copy is located in the drawer named \"" DOPus_Dest"\"."
                                "\n\nDo you want this version installed in that drawer?"
                        )
                        (help
                                "The installer has determined that you may already have a "
                                "copy of Opus 5 installed on your system. If this is wrong or "
                                "you want the update installed elsewhere, select NO as an "
                                "answer. Otherwise, select YES."
                        )
                (default 1)
                )
                (set is_update 1) ; if user wants in same place
                (set DOPus_Dest   ; if user wants in different place
                        (tackon (askdir
                                (prompt "Directory Opus 5 will be installed in its own directory on your hard disk.\n\nWhere should the 'Opus5' directory be created?")
                                        (help @askdir-help)
                                        (default @default-dest)
                                )
                                "Opus5"
                        )
                )
        )
        (set DOPus_Dest ; else if not an update, get a location for program
                (tackon
                        (askdir
                                (prompt "Directory Opus 5 will be installed in its own directory on your hard disk.\n\nWhere should the 'Opus5' directory be created?")
                                (help @askdir-help)
                                (default @default-dest)
                        )
                        "Opus5"
                )
        )
)


; make DOpus drawer & icon if not there

(if     (not is_update)
                (makedir DOPus_Dest (infos))
)

; at this point we have a valid destination, so we tell installer where
; the application will end up so the exit page will be correct -- also,
; the installation log file (if any) will be copied to the destination
        
(set @default-dest DOPus_Dest)
(makeassign "DOPUSDEST" DOPus_dest (safe))

(working "DeArchiving Directory Opus and related files.\n This will take a minute or so....")

(run "SET4a:Tools/LhA >NIL: <NIL: -q x SET4a:DOpus5/English/DO5.lha DOPUSDEST:")

;
; tidyup
;

(run "c:protect DOPUSDEST:c/DopusRT5 +p")
(run "c:protect DOPUSDEST:ARexx/#? +s")


;Install the Readme file
;

(copyfiles 
        (source "SET4a:DOpus5/English/ReadMe.511")
        (dest DOPus_dest)
        (infos)
        (files)
)

(complete 80)


;Get the users startup choices
(set mode (askchoice
        (prompt "Opus 5 can be started automatically when you boot your computer. What do you wish to do?")
                (help   @askchoice-help )
                (choices "Start Opus 5 on boot"
                         "Start Opus 5 Iconified"
                         "Use Opus 5 as Workbench Replacement!"
                         "Do not start Directory Opus on boot") 
                (default 0)
        )
)
        
        

(complete 90)
        
    
                
; start on boot normal
        (if (= mode 0)
                (
                        (copyfiles
                                (source (tackon DOPus_dest "wbstartup/Opus5_Startup"))
                                (dest "SYS:WBStartup")
                                (infos)

                        )

                        (tooltype
                                (dest "SYS:WBStartup/Opus5_Startup")
                                (settooltype "CX_POPUP" "YES")
        
                        )
                )
        )


; start on iconified normal
        (if (= mode 1)
                (

                        (copyfiles
                                (source (tackon DOPus_dest "wbstartup/Opus5_Startup"))
                                (dest "SYS:WBStartup")
                                (infos)

                        )

                        (tooltype
                                (dest "SYS:WBStartup/Opus5_Startup")
                                (settooltype "CX_POPUP" "NO")
        
                        )
                )

        )


        
; use as wb replacement

        (if (= mode 2)
                (
                (set wbisgo 1)

                (if (= (exists "c:loadwb") 1)
                        (rename "c:LoadWB" "c:LoadWB_old")
                )

                (copyfiles
                        (source (tackon DOPus_dest "c/LoadDB"))
                        (dest "c:")
                )
                (rename "c:LoadDB" "c:LoadWB")
                )
        )

                                        
; start on boot iconified
                                                        

(complete 95)

; modify S:User-Startup


; set the script for user startup

        (startup "DirectoryOpus 5"
                (prompt
                "The following instructions will added to your "
                "\"S:User-Startup\" so that your system will be properly "
                "configured to use Opus.\n\n"
                "ASSIGN DOpus5: \"" DOpus_Dest "\"\n"
                "PATH DOpus5:c Add \n"
                )
                (help "This will add commands to your S:user-startup file to "
                        "allow the correct operation of Directory Opus")
                (command "ASSIGN DOpus5: \"" DOpus_Dest "\"\n")
                (command "PATH DOpus5:c Add \n")
        )




(if     (askbool
                (prompt"\nDo you wish to Install the ARexx LhADir archive to your Opus 5 Directory?\n\n"
                "The LhADir archive was developed by Edmund Vermeulen.\nIt allows you to easily handle LHA and LZH files via Directory Opus 5\n")
                (help "none")
        )
        (
        (run "SET4a:Tools/LhA >NIL: <NIL: -q x SET4a:DOpus5/English/LhADirOpus5V10.lha DOPUSDEST:")
        (message "\nThe LhADir has been unarchived into your current Dopus5: drawer.\n"
                "\nOnce you have finished the Opus 5.11 installation, please "
                "open the dopus5:LhADir directory and double click on the "
                "'Inslall LhADir' icon to complete the installation of LhADir\n")
        )
)



;make sure assignment is set up so that Opus 5 can run
        
        (makeassign "DOpus5" DOPus_Dest)

;
;Display the ReadMe 
;

(if (> (run "Sys:Utilities/MultiView DOPUSDEST:ReadMe.511") 0)
        (if (> (run "Sys:Utilities/AmigaGuide DOPUSDEST:ReadMe.511") 0)
                (run "More DOPUSDEST:ReadMe.511")
        )
)


(complete 100)

; cleanup
(makeassign "DOPUSDEST" (safe)) 


(exit text)

