
/*********************************************************************************************
 *
 * installation script for the SavInstaller $VER: 0.7 (22.11.98)
 *
 * note, that this script makes use of seveal new features of the Savage-Installer
 * like multilined comments, the new builtin variable @system-language and the
 * enhanced pattern-match functionality of the DATABASE function
 *
 *********************************************************************************************/

(if (= @system-language "english")

    (
      (set #msg_welcome (cat "Welcome to the Installation of the Savage-Installer\n\n"
                             "The Savage-Installer wants to be a substitution of\n"
                             "the original Installer by C=\n"
                             "It offers many new features, looks much better and is\n"
                             "smaller than the C= Installer"
                        )
      )
      (set #msg_askfile_prompt "Where is the default Installer located?")
      (set #msg_askfile_help (cat "Please select the original Installer by C=. "
                                  "This script will make a backup copy of the "
                                  "Installer and then, it will replace the "
                                  "original by the new Savage-Installer."
                             )
      )
      (set #msg_copylib_prompt "Now copying the Savage-Installer to \"%s\"")
      (set #msg_copylib_help "")
      (set #msg_askbool_prompt (cat "Your prefered language is \"%s\"\n"
                                    "Do you want to install the related catalog (if it exists)?"
                               )
      )
      (set #msg_askbool_help "")
      (set #msg_done (cat "Done!\n"
                          "The Savage-Installer replaced the original Installer\n"
                          "and made a copy of the old one in \"%s\".\n\n"
                          "Have fun with the new Installer and its features"
                     )
      )
    )
)

(if (= @system-language "deutsch")

    (
      (set #msg_welcome (cat "Willkommen zur Installation des Savage-Installer\n\n"
                             "Der Savage-Installer soll ein Ersatz für den\n"
                             "originalen Installer von C= sein\n"
                             "Er bietet viele neue Eigenschaften, sieht viel besser aus\n"
                             "und ist kleiner als der C= Installer"
                        )
      )
      (set #msg_askfile_prompt "Wo befindet sich der Installer?")
      (set #msg_askfile_help (cat "Bitte wählen Sie den originalen Installer von C=. "
                                  "Dieses Skript macht eine Kopie des originalen "
                                  "Installers und wird danach den originalen durch "
                                  "den neuen Savage-Installer ersetzen."
                             )
      )
      (set #msg_copylib_prompt "Kopiere jetzt den Savage-Installer nach \"%s\"")
      (set #msg_copylib_help "")
      (set #msg_askbool_prompt (cat "Ihre eingestellte Sprache ist \"%s\"\n"
                                    "Wollen Sie einen entsprechenden Katalog (falls "
                                    "vorhanden) installieren?"
                               )
      )
      (set #msg_askbool_help "")
      (set #msg_done (cat "Fertig!\n"
                          "Der Savage-Installer hat Ihren originalen Installer\n"
                          "ersetzt und eine Kopie des alten als \"%s\" erzeugt.\n\n"
                          "Viel Spaß mit dem neuen Installer und seinen Möglichkeiten"
                     )
      )
    )
)

/*********************************************************************************************/

(user expert)

(message #msg_welcome)

(welcome)

(complete 0)

(set #installer (askfile (prompt #msg_askfile_prompt)
                         (default "c:installer")
                         (help #msg_askfile_help)
                )
)
(set #installer_backup (cat #installer ".backup"))

(complete 25)

(if (not (exists #installer_backup (noreq)))
    (
      (rename #installer #installer_backup)
    )
) 

(complete 50)

(copylib (prompt (#msg_copylib_prompt #installer))
         (help #msg_copylib_help)
         (confirm average)
         (source (if (database "cpu" "(68000|68010)")
                     ("c/installer000")
                     ("c/installer020")
                 )
         )
         (dest (pathonly #installer))
         (newname (fileonly #installer))
)

(complete 75)

(if (askbool (prompt (#msg_askbool_prompt @system-language))
             (help #msg_askbool_help)
             (default 0)
    )

    (
      (set #catalog_source (tackon (tackon "catalogs" @system-language) "savageinstaller.catalog"))
      (set #catalog_dest (tackon "locale:catalogs" @system-language))

      (if (exists #catalog_source (noreq))
          (if (exists #catalog_dest (noreq))
              (copylib (source #catalog_source)
                       (dest #catalog_dest)
              )
          )
      )
    )
)

(complete 100)

(exit (#msg_done #installer_backup))



