;
; Football Update Installer Script
;
;*****************************************************************************

 (set #MSG_DESTINATION "Where is Football currently installed?\n(Select parent directory where the 'Football' directory resides)")
 (set #MSG_OS          "You need Kickstart 2.04 and above to use this program.")
 (set #MSG_UPDATE      "\nFootball Update\n---------------\nThis installation will update Football 2.3 \nwith the latest program updates and data.  \n\nHighlights include all the data from the  \nFA Premiership 98/99 season, alternative  \n")
 (set #MSG_UPDATE1     "league table displays and new icons.       \n\n\n\n")

 (set #MSG_UPDATE2     "Football 2.31 by Mark Naughton, during 1996-99")

;*****************************************************************************
; Are we on the wrong system?

(if (< (/ (getversion) 65536) 37)
(
    (abort #MSG_OS)
))

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

(complete 0)

(message (#MSG_UPDATE) (#MSG_UPDATE1) (#MSG_UPDATE2))

(set #dest_dir
   (askdir (prompt (#MSG_DESTINATION))
                 (help @askdir-help)
                 (default @default-dest)
                 (newpath))
)
(working)

(set #dest_dir (tackon #dest_dir "Football"))
(set dest_file (tackon #dest_dir "Football"))
(set @default-dest #dest_dir)
(set #exis_dir (exists #dest_dir))
(if #exis_dir (<> 2)
    (abort "Respecify correct path for Football\notherwise we're not going to work....\n")
    (set #happy "We're working!")
)

(if (<> (getsize dest_file) 79732)
    (set #happi "We're moving!")
    (abort "You have Football 2.31 installed.\nThis is the latest version.\n")
)

(if (<> (getsize dest_file) 79728)
    (abort "You do not have Football 2.3 installed.\nYou have another which is incompatible\nwith this update. Try downloading the full\narchive from the Aminet.\n")
    (set #happi "We're moving!")
)

(complete 15)

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

(copyfiles  (source "Football")
            (dest @default-dest)
            (infos)
)
(copyfiles  (source "Football.guide")
            (dest @default-dest)
            (infos)
)
(copyfiles  (source "User.info")
            (dest @default-dest)
)
(copyfiles  (source "Exec.info")
            (dest @default-dest)
)
(copyfiles  (source "Data.info")
            (dest @default-dest)
)

(set datadir (tackon @default-dest "Data"))
(set execdir (tackon @default-dest "Exec"))
(set userdir (tackon @default-dest "User"))

(copyfiles (source "Data/FAPrem_9899.df")
           (dest datadir)
)
(copyfiles (source "Data/FAPrem_9899.sf")
           (dest datadir)
)
(copyfiles (source "Data/FAPrem_9899.sflearn")
           (dest datadir)
)
(copyfiles (source "Data/FAPrem_9899.stats")
           (dest datadir)
)

(copyfiles (source "Data/FACPS_9899.schd")
           (dest datadir)
)
(copyfiles (source "Exec/League.rexx")
           (dest execdir)
)
(copyfiles (source "Exec/Alt_League.rexx")
           (dest execdir)
)

(set delet (tackon @default-dest "User/GamesPlayed.rexx"))
(delete (delet)
        (prompt "To tidy up old programs, Football needs to\ndelete the script 'GamesPlayed.rexx' which\nhas been replaced by 'MatchesPlayed.rexx'.\n")
        (help @delete-help)
        (confirm)
)

(copyfiles (source "User/Combination.rexx")
           (dest userdir)
)
(copyfiles (source "User/MatchesPlayed.rexx")
           (dest userdir)
)
(copyfiles (source "User/SwapLeagueMode.rexx")
           (dest userdir)
)

(complete 100)

(exit)

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