;
; Script di installazione per EasyPrint 2.28 (18.05.97)
;

(if (= @language "italiano")
    (
        (message
                (cat      "\n\n\nEasyPrint, script di upgrade.\n"
                          "Questa procedura installa l' ultima versione di EasyPrint sul vostro Amiga.\n\n"
                          "(C) Copyright 1995-1997 Andrea Latina."
                ))


        (while (NOT (exists (set eprint-path
                                (tackon
                                    (askdir
                                        (prompt  "Seleziona la directory in cui hai installato EasyPrint")
                                        (help    @askdir-help)
                                        (default "SYS:Tools")
                                    ) "EasyPrint" ))))
            (message "\nATTENZIONE!\n\nEasyPrint non risulta essere installato in questa directory."))

        (if (= (exists eprint-path) 2) (set eprint-path (tackon eprint-path "EasyPrint")))

        (if (NOT (exists ("%s.key" eprint-path))) (abort "ATTENZIONE!\n\nLa versione installata è solo una DEMO,\nquindi non è possibile applicarvi alcun patch!"))
        
        (set eprint-vers (getversion eprint-path))
        (set eprint-ver (/ eprint-vers 65536))
        (set eprint-rev (- eprint-vers (* eprint-ver 65536)))
        
        (if (< eprint-rev 27)
            (message "\nLa versione attualmente insallata è precedente la 2.27,\nquindi il patch non può essere applicato.\n\nContattatemi per avere l' aggiornamento.")
            ((message ("\nLa versione attualmente insallata è la 2.%ld,\n\napplico il Patch alla versione 2.28 ?" eprint-rev))
             (select (- eprint-rev 27)
                ((run  ("Spatch -o%s -pep_patch/from_27_to_28.pch %s" eprint-path eprint-path))
                (copyfiles
                    (prompt "Copio i nuovi files...")
                    (source "ep_files/")
                    (help @copyfiles-help)
                    (dest (pathonly eprint-path))
                    (all)
                    (optional force))
                (copyfiles
                    (prompt "Copio i fonts XEN...")
                    (source "ep_fonts/")
                    (help @copyfiles-help)
                    (dest "FONTS:")
                    (all)
                    (optional force))
                (if (exists ("%s_ITA.guide" eprint-path))
                    (copyfiles
                        (prompt "Copio la nuova documentazione....")
                        (source "ep_docs/EasyPrint_ITA.guide")
                        (help @copyfiles-help)
                        (dest (pathonly eprint-path))
                        (optional force))))
                (message "\nATTENZIONE!\n\nQuesta versione è la piu' recente."))
            )
        )
    )
    (
        (message
                (cat      "\n\n\nEasyPrint, upgrade to latest version.\n"
                          "This process install the latest version of EasyPrint on your Amiga.\n\n"
                          "(C) Copyright 1995-1997 Andrea Latina."
                ))


        (while (NOT (exists (set eprint-path
                                (tackon
                                    (askdir
                                        (prompt  "Select directory where have installed EasyPrint")
                                        (help    @askdir-help)
                                        (default "SYS:Tools")
                                    ) "EasyPrint" ))))
            (message "\nWARNING!\n\nEasyPrint isn't installed in this directory!"))

        (if (= (exists eprint-path) 2) (set eprint-path (tackon eprint-path "EasyPrint")))

        (if (NOT (exists ("%s.key" eprint-path))) (abort "WARNING!\n\nThis version is only a DEMO!!,\nTherefore i can't apply a patch."))
        
        (set eprint-vers (getversion eprint-path))
        (set eprint-ver (/ eprint-vers 65536))
        (set eprint-rev (- eprint-vers (* eprint-ver 65536)))

        (if (< eprint-rev 27)
            (message "\nVersion installed at present is older than 2.27,\nso I can't apply the patch.\n\nPlease contact me for the upgrade.")
            ((message ("\nVersion installed at present is 2.%ld,\n\napply the Patch to version 2.28 ?" eprint-rev))
             (select (- eprint-rev 27)
                ((run  ("Spatch -o%s -pep_patch/from_27_to_28.pch %s" eprint-path eprint-path))
                (copyfiles
                    (prompt "Copying new files...")
                    (source "ep_files/")
                    (help @copyfiles-help)
                    (dest (pathonly eprint-path))
                    (all)
                    (optional force))
                (copyfiles
                    (prompt "Copying fonts XEN...")
                    (source "ep_fonts/")
                    (help @copyfiles-help)
                    (dest "FONTS:")
                    (all)
                    (optional force))
                (copyfiles
                    (prompt "Copying new docs....")
                    (source "ep_docs/EasyPrint.guide")
                    (help @copyfiles-help)
                    (dest (pathonly eprint-path))
                    (optional force)))
            (message "\nWARNING!\n\nVersion already installed is the latest."))
            )
        )
    )
) ; if
