;************************************************************
;*                                                          *
;*     "PEGGYplus" - MPEG-Decoder Installation-Script       *
;*                                                          *
;*                                                          *
;*              Script written by J.Ringelberg              *
;*                       15.04.1994                         *
;*                                                          *
;*           $VER: Install-Script 1.0  (15.04.94)           *
;*                ©1994 by Ing.Büro Helfrich                *
;*                                                          *
;************************************************************


;*************** Now the installation itself begins ******************

(set Disk1 "PEGGYplus_Disk#1" )
(set Disk2 "PEGGYplus_DemoMPEG" )

;*** First check if assigned directories exists

(set PEGGYok 0)    ; there is no Assign to PEGGYplus: at the first time
(set MPEGok 0)     ; and also no assign to MPEG:
(set DemoMPEGok 0) ; and finally no DemoMPEGfile

(if (exists "PEGGYplus:" (noreq)) (set PEGGYok 1))

(if (exists "MPEG:" (noreq)) (set MPEGok 1))

(if (= 1 PEGGYok) ((set PEGGYSysDir "PEGGYplus:")))
(if (= 1 MPEGok)  ((set MPEGSysDir "MPEG:")))


;*** Create directory for NOVICE user ***

(if (= 0 @user-level)
	(
		(set PEGGYSysDir "WORK:")
        (set DemoMPEGok 1)
        (set InstDemoMPEG 1)
	)
)

;*** Selection of PEGGYplus-drawer ***

(if (= 0 PEGGYok)
(
	(set PEGGYSysDir
		(askdir
		(prompt "Please select a drawer into which you want to install "
				"the PEGGYplus software.\n "
				"Please notice: The installer will create the drawer 'PEGGYplus' "
				"in that directory.")
		(help "In this step you select the partition/drawer where the PEGGYplus "
			  "software is to be installed.\n"
			  "You do NOT have to create a new subdirectory! It is automatically "
			  "created by the Installer as 'PEGGYplus' in the selected directory.\n\n"
			  HELPTEXT "\n\n" @askdir-help)
		(default "WORK:")
		)
	)
)
)

(set @default-dest PEGGYSysDir)

;**************** Now the installation itself begins ******************

(complete 10)


(if (= 0 PEGGYok)
(
    (startup "PEGGYplus.MPEG-Decoder"
	    		(prompt "It is necessary to add some commands to your \"S:user-startup\" file in order "
                        "to help PEGGYplus find its files.")
			    (help "The PEGGYplus software  requires an assignment 'PEGGYplus:' under which it "
    				  "searches for auxiliary files (like convolution matrices).\n"
	    			  "In order to activate this assignment automatically at every reboot, "
		    		  "some lines have to be inserted into the file \"S:user-startup\".")
    		    (set PEGGYAssign (tackon PEGGYSysDir "PEGGYplus"))
        		(command ("assign PEGGYplus: %s\n" PEGGYAssign))
    )
)
)
(complete 15)


(if (= 0 MPEGok)
(
    (startup "MPEG.files"
	    		(prompt "It is necessary to add some commands to your \"S:user-startup\" file in order "
                        "to help PEGGYplus find its MPEGfiles.")
			    (help "The PEGGYplus software  requires an assignment 'MPEG:' under which it "
				      "searches for auxiliary files (like convolution matrices).\n"
    				  "In order to activate this assignment automatically at every reboot, "
	    			  "some lines have to be inserted into the file \"S:user-startup\".")
		        (set MPEGAssign (tackon PEGGYSysDir "PEGGYplus/MPEG"))
    		    (command ("assign MPEG: %s\n" MPEGAssign))
    )
)
)
(complete 20)



;*** copy PEGGYmpeg.device to DEVS:

(copyfiles
	(prompt "Copy the needed PEGGYmpeg.device to your DEVS: drawer.")
	(confirm "expert")
	(source "PEGGYplus_Disk#1:devs/PEGGYmpeg.device")
	(dest   "DEVS:")
	(help "All the access to the MPEG-Hardware is done by a Amiga.Device."
		  " So it is neccessary to copy this Device to the DEVS: drawer.")
)

(complete 30)
;*** copy timecode.font to FONTS:

(copyfiles
	(prompt "Copy the needed Timecode.Font for the MPEGplayer to your FONTS: drawer.")
	(confirm "expert")
	(source "PEGGYplus_Disk#1:fonts")
        (pattern "~#?.info")
	(dest   "FONTS:")
	(help "This Timecode.Font is needed in the MPEGplayer program to show timing information of the MPEGstream."
		  " So it is necessary to copy this font to your FONTS: drawer.")
)


(complete 40)


(if (= 1 PEGGYok) ((set PEGGYDir "PEGGYplus:")))
(if (= 0 PEGGYok) (((set PEGGYDir (tackon PEGGYSysDir "PEGGYplus"))(makedir PEGGYDir (infos)))))


;*** copy the MPEGplayer.stuff to the PEGGYplus-drawer
((working "Installing MPEGplayer...")
	(set @execute-dir PEGGYSysDir)
;	(set PEGGYDir (tackon PEGGYSysDir "PEGGYplus"))
;	(makedir PEGGYDir (infos))
	(copyfiles
		(prompt "Copying PEGGYplus files to " PEGGYSysDir ".")
		(source "PEGGYplus_Disk#1:PEGGYplus")
		(dest PEGGYDir)
		(pattern "~disk.info")
		(confirm "expert")
		(help "This step installs the MPEGplayer program "
			  "and other PEGGYplus.stuff on your harddisk.")
	)
)


(complete 60)


(if (exists "PEGGYplus:MPEG/nfl.mpg" (noreq)) ((set DemoMPEGok 1) (set InstDemoMPEG 0)))
(if (exists "MPEG:nfl.mpg" (noreq)) ((set DemoMPEGok 1) (set InstDemoMPEG 0)))




(if (= 0 DemoMPEGok)
	(
		(set InstDemoMPEG
			(askbool
				(prompt "Do want to install a demo MPEGfile (870kB) ?")
                      (help "This action will install a demo MPEGfile \"nfl.mpg\" (870kB) "
                        "into MPEG:.")
                (choices "Yes" "No")
			)
      	    )
      	)
)



;*** Ask user to insert disk 2 ***

(if (= 1 InstDemoMPEG)
(
    (askdisk
	    (prompt "Please insert the disk labelled " Disk2 " into any disk drive...")
	    (help @askdisk-help)
	    (dest Disk2)
    )
)
)

(if (= 0 MPEGok) ((set MPEGSysDir (tackon PEGGYSysDir "PEGGYplus/MPEG"))))


(complete 80)

(if (= 1 InstDemoMPEG)
(
    (copyfiles
	    (prompt "Copy the demo MPEG file to the MPEG: drawer.")
	    (confirm "expert")
	    (source "PEGGYplus_DemoMPEG:nfl.mpg")
	    (dest   MPEGSysDir)
	    (help " With this action the demo MPEG file (870kB) will be"
              "copied to MPEG: drawer.")
    )
)
)


(complete 100)
;*** Ask user to reboot ***
(exit	"The system software for your PEGGYplus.MPEG board is installed now.\n"
		"Please perform a reset (reboot) to activate the new software !!!\n\n"
		"We wish you a good time with your PEGGYplus MPEG-Decoder board.")
