; $VER: Install.IconX 37.3 (29.10.94)
;
; This script installs the GUIFront library and preferences editor on your
; hard drive.
;
FailAt 21

Echo "GUIFront installation script for use with IconX"
Echo "Copyright © 1994 by Michael Berg"
Echo "All Rights Reserved"
Echo ""

Echo "Installing library:"

Echo "    guifront.library"

SetEnv DoCopyLib YES

Version >NIL: guifront.library 37
If NOT WARN
    Echo "        You already have: [1m" NOLINE
    Version guifront.library
    Echo "[0m" NOLINE
    Ask "        Do you want to install version [1m37.3[0m of guifront.library?"
    If NOT WARN
        SetEnv DoCopyLib NO
    EndIf
EndIf

If $DoCopyLib EQ "YES"
    Echo "        Which CPU version of the library do you want to install? "
Lab SelectLibVersion
    Echo "            Enter '000' for the 68000 version"
    Echo NOLINE "            Enter '020' for the 68020 version: "
    /GetLine >ENV:GFLibInstallVersion
    If $GFLibInstallVersion EQ "000"
        SetEnv SourceFile /libs/guifront.library
    Else
        SetEnv SourceFile /libs/guifront.library.$GFLibInstallVersion
    EndIf
    If NOT EXISTS $SourceFile
        Echo "            Illegal selection. Please re-select*N"
        Skip BACK SelectLibVersion
    EndIf

    Echo "        Copying guifront.library to your LIBS: ..."
    Copy $SourceFile LIBS:guifront.library QUIET
Else
    Echo "        Skipped"
EndIf

Avail >NIL: FLUSH

Echo ""

If EXISTS Locale:Catalogs
    Echo "Do you wish to install the catalog files for the GUIFront"
    Echo "preferences editor?"
    Ask  "Kickstart 2.04 users should answer No, all others Yes: [y/n]:"
    If WARN
        Copy >NIL: Locale Locale: All
        Echo "Catalogs installed"
    EndIf
Else
    Echo "Catalog files not installed -- no Locale directory found"
EndIf

If EXISTS SYS:Prefs
    SetEnv TargetDir Sys:Prefs/
Else
    SetEnv TargetDir Sys:
Endif

Echo "*NInstalling GUIFront preferences editor..."

Lab SelectDir

Ask "    Install in '$TargetDir'? [y/n]:"
If WARN
    Echo "        Which version do you wish to install?"
Lab SelectVersion
    Echo "          Enter '000' for the 68000 version"
    Echo NOLINE "          Enter '020' for the 68020 version: "
    /GetLine >ENV:GFInstallVersion
    If $GFInstallVersion EQ "000"
        SetEnv SourceFile /Prefs/GUIFront
    Else
        SetEnv SourceFile /Prefs/GUIFront.$GFInstallVersion
    EndIf
    If NOT EXISTS $SourceFile
        Echo "          Illegal selection. Please re-select*N"
        Skip BACK SelectVersion
    EndIf

    Echo "        Copying preferences editor to '"$TargetDir"'..."
    Copy $SourceFile $TargetDir QUIET
    Copy $SourceFile.info $TargetDir QUIET
Else
    Echo NOLINE "    Enter other path, QUIT to skip installation: "
    /GetLine >ENV:TargetDir
    If NOT $TargetDir EQ "QUIT"
        Skip BACK SelectDir
    Else
        Echo "    Installation skipped..."
    EndIf
EndIf

Echo "*NInstallation complete. You may close the window now."
