; $VER: AfA_OS_Installer_Script 2.0 (11.04.2010)
; #############################################################
; 
;           AfA_OS - AROS for Amiga OS Installer V2.0
;                   AfA_OS by Bernd Roesch
;                this script by Thomas Klein
;
; #############################################################



(set #debug "OFF") ;OFF no extra messages ,ON active extra messages

;/// ########## begin AfA_OS related settings defaults ##########
(set @default-dest                  "SYS")

(set #afa_os_installed              "NO")       ; NO mean no priv install,
                                                ; YES mean update,
                                                ; CUSTOM mean AfA_OS_LIBS: assign is set but not to the default
                                                ; CONFLICT mean same as CUSTOM but SYS:AfA_OS_LIBS exists too

(set #zunelib_install               0)          ; 0 mean NO, 1 mean YES
(set #morelibspace_module_install   0)          ; 0 mean NO, 1 mean YES
; default for AfA_OS
(set #afa_os_defaultpath            "SYS:AfA_OS")               ; default path for Docs and Testprograms
(set #afa_os_libs_defaultpath       "SYS:AfA_OS_Libs")          ; default path for AfA_OS_Libs
(set #afa_os_libs_assign            "AfA_OS_Libs:")             ; Assign name if AfA_OS_Libs not in the default directory
(set #afa_os_skins_defaultpath      "SYS:Prefs/Presets/Skins")  ; default path for the Skins

;------- set skinpath to default
(set #afa_os_skins_path             #afa_os_skins_defaultpath)  ; this path can change depent on the install for CUSTOM/AmiKit
;/// ########## end AfA_OS related settings defaults ##########


;/// ########## begin AmiKit install related setting defaults ##########
(set #amikitinstalldetect           "NO")     ; NO mean no AfA_OS in AmiKitpath defaults
                                              ; YES mean AfA_OS update for Amikit defaults
(set #amikitversion                 0)        ; will fild with the Version of the AmiKit install we run on

(set #amikit_version_env            "AmiKitVersion")                                 ; name of the ENV Variable that contain the Versionnumber
(set #amikitafa_ospath              "SYS:Utilities/Expansion/AfA_OS")                ; AmiKitpath to the AfA_OS install for Amikit >= V1.2.0
(set #amikitmorpheuzpath            "SYS:Prefs/Presets/AmiKit/MorpheuZ")             ; AmiKitpath for skin support
(set #amikit_afaskins_path          "SYS:Prefs/Presets/AmiKit/MorpheuZ/24bitThemes") ; AmiKitpath for AfA_OS skin support
(set #amikit_afaskins_oldpath       "SYS:Prefs/Presets/AmiKit/MorpheuZ/NewThemes")   ; old AmiKitpath for AfA_OS skin support
;/// ########## end AmiKit install related setting defaults ##########



;/// ########## begin check and set language strings ##########
;---- english strings as default
       ; -- error strings
       (set #string_os                     "Incorrect OS version (software requires OS 40 or better )!")
       (set #string_error                  "An error has occurred during installation. Please check the log file to understand the error.")
       (set #installerng_used              "You use InstallerNG for this install we must abort for savety!\n\nPlease use the Amiga Installer V43+ or the Installer from Geit V1.32+ for this install!")

       ;-- info message to inform the user
       (set #string_amikit_system          "AmiKit-system installation")
       (set #string_custom_install         "custom-installation")

       (set #message_installed_NO          "No AfA_OS installation present or detected , so we make a first install!")
       (set #message_installed_YES         "A AfA_OS installation detected for an update!")
       (set #message_installed_CUSTOM      (cat "A AfA_OS " #string_custom_install " detected for an update!") )
       (set #message_installed_CONFLICT    (cat "!!A AfA_OS " #string_custom_install " with a conflict detected for an update!!") )
       (set #message_amikitinstalldetect   (cat "A " #string_amikit_system " with a AfA_OS installation detected for an update!") )
       (set #message_amikitinstallconflict (cat "!!A " #string_amikit_system " with a conflict AfA_OS installation detected for an update!!") )

       ;-- String for the conflict choice
       (set #string_query_choice           "The script detect a AfA_OS install/update from the old installerscript one your ")
  
       (set #string_query_choice_2         "!\n\nWhat do you want to do with the following directory(s) and file(s)")
       (set #string_query_choice_3         "\n")  ; will be filled with the Directors and Files
       (set #string_query_choice_4         "\nthat not fit in the ")
       (set #string_query_choice_5         "?")

       (set #renameextention               "_deletable")

       (set #string_choice_0               "Delete it if possible or else Rename it.")
       (set #string_choice_1               (cat "Rename it to #? \"" #renameextention "\".") )
       (set #string_choice_2_start         "Use it for the update and ignor the ")
       (set #string_choice_3_start         "Ignor it and use the ")
       (set #string_choice_3_end           " , the update will not active after reboot!")

       ;-- Strings for the delete and rename query and help
       (set #string_working_delete         "Try to delete the conflict directorys and files. Please wait its need some time!")
       (set #string_working_rename         "Try to rename the conflict directorys and files. Please wait its need some time!")
       (set #string_directory              "directory")
       (set #string_file                   "file")
       (set #ask_del                       "You are sure to delete the ")
       (set #ask_ren                       "You are sure to rename the ")
       (set #ask_ren_to                    " to ")
       (set #help_amikit_part1             "This ")
       (set #help_amikit_part2             " are not needed for an unmodifed AmiKit-system")
       (set #help_amikit_ver12             "V1.2.0")
       (set #help_amikit_ver15             "V1.5.0")
       (set #help_amikit_part3             " and newer because they are already installed")
       (set #help_amikit_locat             " but in a other location.")
       (set #help_amikit_name              " with this Name TrueType_FontManager.")
       (set #help_amikit_end               "\n\nThis new installscript support this.")

       (set #help_custom                   "This is normaly not needed if you will use the AfA_OS_libs: assign, but to the AfA_OS_Loader priority this directory will tried first so the AfA_OS_Libs: assign is not used.")

       ; -- query strings
       (set #install-where1                "Where do you want to install the test programs and documentation?\nA directory called \"")
       (set #install-where2                "\" will be created for you.")
       (set #installed-where1              "Please select the directory where do you want to update/install the testprograms and documentation.\nNo extra directory will be created!")
       (set #installed-whereskins          "Please select the directory where do you want to update/install the Skins./n The directory will created if it not exists!")
       (set #install_zune                  "Should be the new AfA_OS zune.library installed in AfA_OS_Libs?")
       (set #install_zunehelp              "\n\nNormaly this is only needed if the AfA_OS_zune packet is installed, but it has no drawbacks if not.")
       (set #install_morels_m              "Should the residentmodule morelibspace_module be copied in DEVS:?")
       (set #install_morels_m_help         "This is the residentmodule only without the loader. It can only by used together with Loadmodule, Blitzkick or Luziferin (to place it in the Flash).")
       (set #choice-yes                    "Yes")
       (set #choice-no                     "No")

       ; -- copy prompt and help strings
       (set #c_copy_prompt                 "Copy AfA_OS_Loader and morelibspace to ")
       (set #c_copy_help                   "")
       (set #libs_copy_prompt              "Copy Library for Truetypefont support to ")
       (set #libs_copy_help                "")
       (set #morelib_mod_copy_prompt       "Copy the morelibspace_module to ")
       (set #morelib_mod_copy_help         "")
       (set #testprog_copy_prompt          "Copy the testprograms to ")
       (set #testprog_copy_help            "")
       (set #docs_copy_prompt              "Copy the Documentation to ")
       (set #docs_copy_help                "")
       (set #prefsprog_copy_prompt         "Copy the Prefprograms to ")
       (set #prefsprog_copy_help           "")
       (set #skins_copy_prompt             "Copy the Skins to ")
       (set #skins_copy_help               "")
       (set #fonts_copy_prompt             "Copy the TrueTypeFonts to ")
       (set #fonts_copy_help               "")
       (set #afa_libs_copy_prompt          "Copy the AfA_OS_Librarys to ")
       (set #afa_libs_copy_help            "")
       (set #zune_lib_copy_prompt          "Copy the AfA_OS_Library zune_lib.exe to ")
       (set #zune_lib_copy_help            "")
       (set #zune_old_del_prompt           "Delete old zune_lib.exe in Optional")
       (set #zune_old_del_help             "This is only for cleanup because the new zune_lib.exe moved to Optional/AfA_OS_Libs!")
       (set #settooltype_prompt            "Try to set tooltype SkinPath of AfA_Prefs.")
       (set #settooltype_help              "It will set the tooltype SkinPath to the used path that hold the Skins so that AfA_Prefs knows how the Skins are stored and used this as default!")

       ; -- exit strings
       (set #exitstring_1                  "\n\nYou must add in and mayby change some lines in your \"s:startup-sequence\" to use AfA_OS on boot.")
       (set #exitstring_2                  "\n\nPlease read and follow the installation instructions in the Documentation.")
       (set #exitstring_3                  "\n\n!!! Dont forget to deaktivate \"PowerIcons\" !!!")
       (set #exitstring_4                  "\n\nNot all files are copy with the installer. So take too a look on the archive dir.")
       (set #updateexitstring              "\n\nThe update of AfA_OS was successfull.")
       (set #amikitexitstring              "\n\nUpdate of AfA_OS was successfull on your AmiKit-system.")
       (set #rebootstring                  "\n\nPlease Reboot to actived the new version!")

;---- german strings
(if (= @language "deutsch")
    (
       ; -- error stings
       (set #string_os                     "Falsche OS-Version (diese Software benötigt OS 40 oder besser )!")
       (set #string_error                  "Während der Installation ist ein Fehler aufgetreten. Überprüfen Sie das Protokoll, um den Fehler zu verstehen.")
       (set #installerng_used              "Du benutzt den InstallerNG für diese Installation wir müssen hier zur Sicherheit abbrechen!\n\Bitte benutze den Amiga Installer V43+ oder den Installer von Geit V1.32+ für diese Installation!")

       ;-- info message to inform the user
       (set #string_amikit_system          "AmiKit-System Installation")
       (set #string_custom_install         "Benutzerinstallation")

       (set #message_installed_NO          "Kein AfA_OS Installation vorhanden oder erkannt, führe eine erst Installation durch!")
       (set #message_installed_YES         "Eine AfA_OS Installation erkannt für ein Update!")
       (set #message_installed_CUSTOM      (cat "Eine AfA_OS " #string_custom_install " erkannt für ein Update!") )
       (set #message_installed_CONFLICT    (cat "!!Eine AfA_OS " #string_custom_install " mit einem Konflikt erkannt für ein Update!!") )
       (set #message_amikitinstalldetect   (cat "Eine " #string_amikit_system " mit AfA_OS Installation erkannt für ein Update!") )
       (set #message_amikitinstallconflict (cat "!!Eine " #string_amikit_system " mit Konflikt AfA_OS Installation erkannt für ein Update!!") )

       ;-- String for the conflict choice
       (set #string_query_choice           "Das Script hat eine AfA_OS Installation/Update vom alten Installerscript entdeckt bei ihrer ")
    
       (set #string_query_choice_2         "!\n\nWas möchten sie mit den folgenden Verzeichnis(en) und Datei(en) tun")
       (set #string_query_choice_3         "\n")  ; will be filled with the Directors and Files
       (set #string_query_choice_4         "\ndie nicht zur ")
       (set #string_query_choice_5         " passen?")

       (set #renameextention               "_löschbar")

       (set #string_choice_0               "Löschen sie wenn möglich sonst Umbenennen.")
       (set #string_choice_1                (cat "Umbenennen zu \"#?" #renameextention "\".") )
       (set #string_choice_2_start         "Benutzen fürs Update und ignorier die ")
       (set #string_choice_3_start         "Ignoriere sie und verwende die ")
       (set #string_choice_3_end           ", das Update wird dann beim Reboot nicht aktiviert!")

       ;-- Strings for the delete and rename query and help
       (set #string_working_delete         "Versuche die Konfliktverzeichnisse und -dateien zu löschen. Bitte warten dies benötigt einige Zeit!")
       (set #string_working_rename         "Versuche die Konfliktverzeichnisse und -dateien umzubennen. Bitte warten dies benötigt einige Zeit!")
       (set #string_directory              "Verzeichnis")
       (set #string_file                   "Datei")
       (set #ask_del                       "\n\nSind sie sicher mit dem Löschen des/der ")
       (set #ask_ren                       "\n\nSind sie sicher mit dem Umbenennen des/der ")
       (set #ask_ren_to                    " zu ")
       (set #help_amikit_part1             "Dies(e) ")
       (set #help_amikit_part2             " ist nicht nötig für eine ungeändertes AmiKit-System")
       (set #help_amikit_ver12             "V1.2.0")
       (set #help_amikit_ver15             "V1.5.0")
       (set #help_amikit_part3             " oder neuer da diese(s) bereits installiert sind")
       (set #help_amikit_locat             " aber in einer anderen Lokation.")
       (set #help_amikit_name              " aber mit dem Namen \"TrueType_FontManager\".")
       (set #help_amikit_end               "\n\nDieses neue Installscript unterstützt dies.")

       (set #help_custom                   "Diese Verzeichnis ist normalerweise nicht nötig wenn sie das AfA_OS_Libs: Assign benutzen wollen.\nDenn durch die Priorität des AfA_OS_Loaders wird dieses Verzeichnis zuerst verwendet wenn vorhanden und so wird dann das AfA_OS_Libs: Assign nicht benutzt!")


       ; -- query strings
       (set #install-where1                "Wo wollen sie die Dokumentation und Testprogramme installieren?\nEin Verzeichnis namens \"")
       (set #install-where2                "\" wird für dich erstellt.")
       (set #installed-where1              "Bitte wählen sie das Verzeichnis für ein Update/Installation der Testprogramme und Dokumentation durchzuführen.\nEs wird kein extra Verzeichnis dafür angelegt!")
       (set #installed-whereskins          "Bitte wählen sie das Verzeichnis für ein Update/Installation der Skins.\nDas Verzeichnis wird erstellt wenn diese nicht existiert!")
       (set #install_zune                  "Soll die neue AfA_OS zune.library auch in\nAfA_OS_Libs installiert werden?")
       (set #install_zunehelp              "Normalerweise ist dies nur nötig wenn\ndas AfA_OS_zune Paket installiert ist,\nhat aber auch keine nachteile wenn nicht.")
       (set #install_morels_m              "Soll das Residentmodule von Morelibspace nach DEVS: kopiert werden?")
       (set #install_morels_m_help         "Dies ist das Residentmodule ohne Loader es kann nur zusammen mit Loadmodul, blitzkick oder Luziferin (um es in den Flash der DENEB/HIGHWAY zulegen) verwendet werden.")
       (set #choice-yes                    "Ja")
       (set #choice-no                     "Nein")

       ; -- copy prompt and help strings
       (set #c_copy_prompt                 "Kopiere AfA_OS_Loader und morelibspace nach ")
       (set #c_copy_help                   "")
       (set #libs_copy_prompt              "Kopiere die Librarys für die Truetypefont Unterstützung nach ")
       (set #libs_copy_help                "")
       (set #morelib_mod_copy_prompt       "Kopiere das morelibspace_module nach ")
       (set #morelib_mod_copy_help         "")
       (set #testprog_copy_prompt          "Kopiere die Testprogramme nach ")
       (set #testprog_copy_help            "")
       (set #docs_copy_prompt              "Kopiere die Dokumentation nach ")
       (set #docs_copy_help                "")
       (set #prefsprog_copy_prompt         "Kopiere die Einstellungsprogramme nach ")
       (set #prefsprog_copy_help           "")
       (set #skins_copy_prompt             "Kopiere die Skins nach ")
       (set #skins_copy_help               "")
       (set #fonts_copy_prompt             "Kopiere die TrueTypeFonts nach ")
       (set #fonts_copy_help               "")
       (set #afa_libs_copy_prompt          "Kopiere die AfA_OS_Librarys nach ")
       (set #afa_libs_copy_help            "")
       (set #zune_lib_copy_prompt          "Kopiere die AfA_OS_Library zune_lib.exe nach ")
       (set #zune_lib_copy_help            "")
       (set #zune_old_del_prompt           "Lösche die alte zune_lib.exe in Optional")
       (set #zune_old_del_help             "Diese ist nur ein aufräumen denn die neue zune_lib.exe wurde nach Optional/AfA_OS_Libs verschoben!")
       (set #settooltype_prompt            "Versuche die Tooltype SkinPath von AfA_Prefs zu setzen.")
       (set #settooltype_help              "Es wird die Tooltype SkinPath auf den benutzten Pfad gesetzt der die Skins einhält so das AfA_Prefs weis wo die Skins gespeichert sind und diesen Pfad als Standart benutzt!")

       ; -- exit strings
       (set #exitstring_1                  "\n\nIn der \"s:startup-sequence\" müssen Zeilen einfügt und vielleicht geändert werden wenn du AfA_OS bereits beim Booten benutzen möchtest.")
       (set #exitstring_2                  "\n\nBitte die Installationsanweisungen der Dokumentations lesen und befolgen.")
       (set #exitstring_3                  "\n\n!!! Nicht vergessen \"PowerIcons\" zu deaktiviern !!!")
       (set #exitstring_4                  "\n\nNicht alle Dateien werden mit diesem Installer kopiert. Deshalb sehe dir auch das Archivverzeichnis an.")
       (set #updateexitstring              "\n\nDas Update von AfA_OS war erfolgreich")
       (set #amikitexitstring              "\n\nDas Update von AfA_OS auf ihrem Amikit-System war erfolgreich.")
       (set #rebootstring                  "\n\nBitte Neustarten um die neue Version zu aktivieren!")
   )
)
;/// ########## end check and set language strings ##########



; initialize control sequence ("proportional font")

(if (= @installer-version 0)

    (set #esc "")
    (set #esc "[2p")

)

; check if we are running under correct OS

(if (< (/ (getversion) 65536) 40)  ;for kick 3.1 or newer

    (
        (abort #string_os)
    )
)

; error handling

(onerror

    (if (> @ioerr 0)

        (message #string_error)
    )

    (exit (quiet))
)


;/// ########## begin test if we run with InstallerNG ##########
(if @installer-ng-version
    (
         ; yes then we must abort because of possible bug and crashs!
         (abort #installerng_used)
    )
)
;/// ########## end test if we run with InstallerNG ##########

;-------- start

;/// ########## begin predefine procedurs ##########
;---- copy librarys
(procedure p_versioncopy #copy_source #copy_destination #copy_pattern #copy_prompt #copy_help
           (if (= @user-level 2)
               (
                   (foreach #copy_source #copy_pattern
                       (
                           ;--- only for debug
                           (if (= #debug "ON")
                               (message (tackon #copy_source @each-name) ) ; for debug
                           )
                           ;---
                           (copylib
                               (source (tackon #copy_source @each-name) )
                               (dest #copy_destination)
                               (optional "fail" "askuser")
                               (prompt #copy_prompt #copy_destination)
                               (help (cat #copy_help "\n\n" @copylib-help) )
                           )
                       )
                   )
               )
               ; else
               (
                   (copyfiles
                       (source #copy_source)
                       (dest #copy_destination)
                       (pattern #copy_pattern)
                       (optional "fail" "askuser")
                       (prompt #copy_prompt #copy_destination)
                       (help (cat #copy_help "\n\n" @copyfiles-help) )
                   )
               )
           )
)
;/// ########## end predefine procedurs ##########

(welcome)


;/// ########## check if AfA_OS_Libs: Assign is set ##########
;(working #AfA_OS_existscheck)
(complete 0)

(if (= (exists #afa_os_libs_assign (noreq) ) 2)
    (
        ; expand path of the AfA_OS_Libs: Assign
        (set #afa_os_libs_path (expandpath #afa_os_libs_assign) )
        ;--- only for debug
        (if (= #debug "ON")
            (message "The Assign AfA_OS_Libs: exits and is " #afa_os_libs_path)
        )
        ;---

        ;-- check if the assigns is set to the defaultpath
        (set #afa_os_libs_systempath (tackon (expandpath "SYS:") "AfA_OS_Libs") )
        ;--- only for debug
        (if (= #debug "ON")
            (message "So looks the default AfA_OS_Libs path on this system " #afa_os_libs_systempath)
        )
        ;---

        ;--- compare expand defaultpath with assignpath to set install type
        (if (= #afa_os_libs_systempath #afa_os_libs_path)
            (
                ;- yes is the defaultpath
                (set #afa_os_installed "YES")
                ;--- only for debug
                (if (= #debug "ON")
                    (message "Install detect default AfA_OS_Libs path on this system is" #afa_os_libs_systempath)
                )
                ;---
            )
            ;else
            (
                ;check if we have a the default sys:afa_os_libs too and have than a conflict
                (if (exists #afa_os_libs_defaultpath (noreq) )
                    (
                        (set #afa_os_installed "CONFLICT")
                        ;--- only for debug
                        (if (= #debug "ON")
                            (message "Conflict install detect default AfA_OS_Libs path is " #afa_os_libs_systempath "\nand the Assign is set to " #afa_os_libs_path )
                        )
                        ;---
                    )
                    ;else
                    (
                        ;- no it is a custom install
                        (set #afa_os_installed "CUSTOM")
                        ;--- only for debug
                        (if (= #debug "ON")
                            (message "Custom install detect AfA_OS_Libs: path is " #afa_os_libs_path)
                        )
                        ;---
                   )
                )
            )
        )
    )
    ;else
    (
        ; check if default path is exists
        (if (exists #afa_os_libs_defaultpath (noreq) )
            (
                (set #afa_os_installed "YES")
                ;--- only for debug
                (if (= #debug "ON")
                    (message "Install detect default AfA_OS_Libs path on this system is" (expandpath #afa_os_libs_defaultpath) )
                )
                ;---
            )
            ;else
            (
                (set #afa_os_installed "NO")
                ;--- only for debug
                (if (= #debug "ON")
                    (message "No Install detect, so we use the default AfA_OS_Libs path " #afa_os_libs_defaultpath)
                )
                ;---
            )
        )

        (set #afa_os_libs_path #afa_os_libs_defaultpath)  ; we use default path for the afa_os libs
    )
)
;/// ########## end check if AfA_OS_Libs: Assign is set ##########


;/// ########## begin Amikit install detection ##########
;(working #Amikit_existscheck)
(complete 2)

(if (or (= #afa_os_installed "CUSTOM") (= #afa_os_installed "CONFLICT") )
    (
        ;-- get stringleng of the full path of the afa_os_libs assign
        (set #stringlen (strlen #afa_os_libs_path) )
        ;--- only for debug
        (if (= #debug "ON")
            (message "Leng of the full afa_os_libs path is " #stringlen " charaters")
        )
        ;---

        ;-- try to get parent dir out of the string if path end in "/afa_os_libs"
        (if (> #stringlen 12)
            (
                (set #cutstring (substr #afa_os_libs_path 0 (- (+ #stringlen) 12) ) )    ; remove "/afa_os_libs" from the Path
                ;--- only for debug
                (if (= #debug "ON")
                    (message "The path only is: "#cutstring)
                )
                ;---
             )
        )

        ;-- check if we run on a Amikit install
        (if (exists #amikitafa_ospath (noreq) )
            (
                ;--- only for debug
                (if (= #debug "ON")
                    (message "Amikit afa_os path exists")
                )
                ;---

; only for testing
                ; try patmach to verify
                (if (patmatch (cat (expandpath #amikitafa_ospath) "/#?")  #afa_os_libs_path)
                    (
                        (set #amikitinstalldetect "YES")
                        ;--- only for debug
                        (if (= #debug "ON")
                            (message "patmatch " (cat #amikitafa_ospath) "/#?")
                        )
                        ;---
                    )
                )


                ;-- check if we run on a Amikit
                (if (= (expandpath #amikitafa_ospath) #cutstring)
                    (
                        (set #amikitinstalldetect "YES")
                        ;--- only for debug
                        (if (= #debug "ON")
                            (message "Amikit afa_os path a equal!!!")
                        )
                        ;---

                    )
                )
            )
        )
        ;-- check for the amikit path of the skins
        (if (exists #amikit_afaskins_path (noreq) )
            (
                (set #afa_os_skins_path #amikit_afaskins_path)
                ;--- only for debug
                (if (= #debug "ON")
                    (message "Amikit Skin exits")
                )
                ;---

            )
            ;else
            ;-- check if an old amikitskin path is used
            (if (exists #amikit_afaskins_oldpath (noreq) )
                (
                    (set #afa_os_skins_path #amikit_afaskins_oldpath)
                    ;--- only for debug
                    (if (= #debug "ON")
                        (message "Amikit Skin in old path exits")
                    )
                    ;---
                )
            )
        )

        ; get Amikit Version that is used
        (if (exists (tackon "ENV:" #amikit_version_env) (noreq) )
            (
                (set #amikitversion (getenv #amikit_version_env) )
                ;--- only for debug
                (if (= #debug "ON")
                    (message "Version of Amikit is " #amikitversion )
                )
                ;---

            )
        )
    )
)
;/// ########## end Amikit install detection ##########



;/// ########## begin User install information and query ##########
(if (= #amikitinstalldetect "YES")
    (
        (if (= #afa_os_installed "CONFLICT")
            (
                (message #message_amikitinstallconflict)
            )
            ;else normal install
            (
                (message #message_amikitinstalldetect)
            )
        )
    )
    ;else
    (
        (if (= #afa_os_installed "CONFLICT")
            (
                (message #message_installed_CONFLICT)
            )
            ;else normal install
            (
                (if (= #afa_os_installed "CUSTOM")
                    (
                        (message #message_installed_CUSTOM)
                    )
                    ;else
                    (
                        (if (= #afa_os_installed "YES")
                            (
                                (message #message_installed_YES)
                            )
                        )
                    )
                )
            )
        )
    )
)
;/// ########## end User install information and query ##########


;/// ########## begin Amikit old installer conflict query ##########
;---- file query string with the dirs and files
(if (= #afa_os_installed "CONFLICT")                   ; we set it to a normal CUSTOM update
    (
        ;-- Directory SYS:AfA_OS_Libs
        (if (exists #afa_os_libs_defaultpath)
            (
               (set #string_query_choice_3 (cat #string_query_choice_3  #afa_os_libs_defaultpath "/") )
            )
        )

        (if (= #amikitinstalldetect "YES")
            (
                ;-- Directory SYS:AfA_OS
                (if (exists #afa_os_defaultpath)
                    (set #string_query_choice_3 (cat #string_query_choice_3 "\n" #afa_os_defaultpath "/") )
                )
                ;-- Directory SYS:Prefs/Presets/Skins
                (if (not (= #afa_os_skins_path #afa_os_skins_defaultpath) )
                        (
                            (if (exists #afa_os_skins_defaultpath)
                                (set #string_query_choice_3 (cat #string_query_choice_3 "\n" #afa_os_skins_defaultpath "/") )
                            )
                        )
                )
                ;-- File TTF_Manager
                (if (and (exists "SYS:Prefs/TTF_Manager") (exists "SYS:Prefs/TrueType_FontManager") )
                    (set #string_query_choice_3 (cat #string_query_choice_3 "\n" "SYS:Prefs/TTF_Manager") )
                )


                ; set strings for query prompt and choices
                (set #string_query_conflict (cat #string_query_choice #string_amikit_system #string_query_choice_2 #string_query_choice_3 #string_query_choice_4 #string_amikit_system #string_query_choice_5) )
                (set #string_choice_2 (cat #string_choice_2_start #string_amikit_system "!") )
                (set #string_choice_3 (cat #string_choice_3_start #string_amikit_system #string_choice_3_end) )
                ; set string for help
                (set #string_query_help (cat "\n\n" @askchoice-help) )
                (set #help_del_ren_afaoslibs (cat #help_amikit_part1 #string_directory #help_amikit_part2 #help_amikit_ver12 #help_amikit_part3 #help_amikit_locat #help_amikit_end  ) )
            )
            ;else
            (
                ; set string for query prompt and choices
                (set #string_query_conflict (cat #string_query_choice #string_custom_install #string_query_choice_2 #string_query_choice_3 #string_query_choice_4 #string_custom_install #string_query_choice_5) )
                (set #string_choice_2 (cat #string_choice_2_start #string_custom_install "!") )
                (set #string_choice_3 (cat #string_choice_3_start #string_custom_install #string_choice_3_end) )
                ; set string for help
                (set #string_query_help (cat #help_custom "\n\n" @askchoice-help) )
                (set #help_del_ren_afaoslibs #help_custom)
            )
        )

        ;---- query choice
        (set #conflict_handling

            (askchoice

                (prompt #string_query_conflict)

                (choices

                    (cat #esc #string_choice_0)
                    (cat #esc #string_choice_1)
                    (cat #esc #string_choice_2)
                    (cat #esc #string_choice_3)
                )

                (help #string_query_help)

                (default 1)
            )
        )

    )
)
;/// ########## end Amikit old installer conflict query ##########


;/// ########## begin Amikit old installer conflict handling ##########
(if (= #afa_os_installed "CONFLICT")                   ; we check if we have a conflict we must handle
    (
        
        ;---- if delete select then try
        (if (= #conflict_handling 0)
            (
                (working #string_working_delete)

                ;-- Directory SYS:AfA_OS_Libs
                (if (exists #afa_os_libs_defaultpath)
                    (
                        (delete #afa_os_libs_defaultpath
                            (help #help_del_ren_afaoslibs)
                            (prompt #ask_del #string_directory "\n\n" #afa_os_libs_defaultpath " ?")
                            (confirm 2)
                            (all)
                            (infos)
                        )
                    )
                )

                ;--- Amikit related
                (if (= #amikitinstalldetect "YES")
                    (
                        ;-- Directory SYS:AfA_OS
                        (if (exists #afa_os_defaultpath)
                            (
                                (delete #afa_os_defaultpath
                                    (help #help_amikit_part1 #string_directory #help_amikit_part2 #help_amikit_ver12 #help_amikit_part3 #help_amikit_locat #help_amikit_end)
                                    (prompt #ask_del #string_directory "\n\n" #afa_os_defaultpath " ?")
                                    (confirm 2)
                                    (all)
                                    (infos)
                                )
                            )
                        )
                        ;-- Directory SYS:Prefs/Presets/Skins
                        (if (and (exists #afa_os_skins_defaultpath) (not (= #afa_os_skins_path #afa_os_skins_defaultpath) ) )
                            (
                                (delete #afa_os_skins_defaultpath
                                    (help #help_amikit_part1 #string_directory #help_amikit_part2 #help_amikit_ver15 #help_amikit_part3 #help_amikit_locat #help_amikit_end)
                                    (prompt #ask_del #string_directory "\n\n" #afa_os_skins_defaultpath " ?")
                                    (confirm 2)
                                    (all)
                                    (infos)
                                )
                            )
                        )
                        ;-- File TTF_Manager
                        (if (and (exists "SYS:Prefs/TTF_Manager") (exists "SYS:Prefs/TrueType_FontManager") )
                            (
                                (delete "SYS:Prefs/TTF_Manager"
                                    (help #help_amikit_part1 #string_file #help_amikit_part2 #help_amikit_ver12 #help_amikit_part3 #help_amikit_name #help_amikit_end)
                                    (prompt #ask_del #string_file "\n\n" "SYS:Prefs/TTF_Manager" " ?")
                                    (confirm 2)
                                    (all)
                                    (infos)
                                )
                            )
                        )

                    )
                )

                (set #conflict_handling 1) ; try to rename it if Delete was not successfull because of a lock, ...

            )
        )

        ;--- if rename is select (also after delele because of maybe undeleteable Dirs and files to be save)
        (if (= #conflict_handling 1)
            (
                (working #string_working_rename)

                ;-- Directory SYS:AfA_OS_Libs
                (if (exists #afa_os_libs_defaultpath )
                    (
                        (rename #afa_os_libs_defaultpath (cat #afa_os_libs_defaultpath #renameextention)
                            (help #help_del_ren_afaoslibs)
                            (prompt #ask_ren #string_directory "\n\n" #afa_os_libs_defaultpath #ask_ren_to (cat #afa_os_libs_defaultpath #renameextention) " ?")
                            (confirm 2)
                        )
                        ;icon too
                        (if (exists (cat #afa_os_libs_defaultpath ".info") )
                            (
                                (rename (cat #afa_os_libs_defaultpath ".info") (cat #afa_os_libs_defaultpath #renameextention ".info")
                                )
                            )
                        )
                    )
                )

                ;--- Amikit related
                (if (= #amikitinstalldetect "YES")
                    (
                        ;-- Directory SYS:AfA_OS
                        (if (exists #afa_os_defaultpath)
                            (
                                (rename #afa_os_defaultpath (cat #afa_os_defaultpath #renameextention)
                                    (help #help_amikit_part1 #string_directory #help_amikit_part2 #help_amikit_ver12 #help_amikit_part3 #help_amikit_locat #help_amikit_end)
                                    (prompt #ask_ren #string_directory "\n\n" #afa_os_defaultpath #ask_ren_to (cat #afa_os_defaultpath #renameextention)" ?")
                                    (confirm 2)

                                )
                                ;icon too
                                (if (exists (cat #afa_os_defaultpath ".info") )
                                    (
                                        (rename (cat #afa_os_defaultpath ".info") (cat #afa_os_defaultpath #renameextention ".info")
                                        )
                                    )
                                )
                            )
                        )
                        ;-- Directory SYS:Prefs/Presets/Skins
                        (if (and (exists #afa_os_skins_defaultpath) (not (= #afa_os_skins_path #afa_os_skins_defaultpath) ) )
                            (
                                (rename #afa_os_skins_defaultpath (cat #afa_os_skins_defaultpath #renameextention)
                                    (help #help_amikit_part1 #string_directory #help_amikit_part2 #help_amikit_ver15 #help_amikit_part3 #help_amikit_locat #help_amikit_end)
                                    (prompt #ask_ren #string_directory "\n\n" #afa_os_skins_defaultpath #ask_ren_to (cat #afa_os_skins_defaultpath #renameextention) " ?")
                                    (confirm 2)
                                )
                                ;icon too
                                (if (exists (cat #afa_os_skins_defaultpath ".info") )
                                    (
                                        (rename (cat #afa_os_skins_defaultpath ".info") (cat #afa_os_skins_defaultpath #renameextention ".info")
                                        )
                                    )
                                )
                            )
                        )
                        ;-- File TTF_Manager
                        (if (and (exists "SYS:Prefs/TTF_Manager") (exists "SYS:Prefs/TrueType_FontManager") )
                            (
                                (rename "SYS:Prefs/TTF_Manager" (cat "SYS:Prefs/TTF_Manager" #renameextention)
                                    (help #help_amikit_part1 #string_file #help_amikit_part2 #help_amikit_ver12 #help_amikit_part3 #help_amikit_name #help_amikit_end)
                                    (prompt #ask_ren #string_file "\n\n" "SYS:Prefs/TTF_Manager" #ask_ren_to (cat "SYS:Prefs/TTF_Manager" #renameextention) " ?")
                                    (confirm 2)
                                )
                                ;icon too
                                (if (exists (cat "SYS:Prefs/TTF_Manager" ".info") )
                                    (
                                        (rename (cat "SYS:Prefs/TTF_Manager" ".info") (cat "SYS:Prefs/TTF_Manager" #renameextention ".info")
                                        )
                                    )
                                )
                            )
                        )

                    )
                )

                (set #afa_os_installed "CUSTOM")   ; we set it to a normal CUSTOM update  because there is no conflict anymore

            )
        )

        ;---- if Force is select
        (if (= #conflict_handling 2)
            (
                (set #afa_os_libs_path #afa_os_libs_defaultpath)   ; we use default path for the afa_os_libs
                (set #afa_os_installed "YES")                      ; we set it to a normal update

                (if (= #amikitinstalldetect "YES")
                    (
                        (set #afa_os_skins_path #afa_os_skins_defaultpath) ; we use default path for the skins

                        (set #amikitinstalldetect "NO")            ; we set amkit dection to NO
                    )
                )
            )
        )

        ;---- if USE CUSTOM settings / Amikitdefaults is select
        (if (= #conflict_handling 3)
            (
                (set #afa_os_installed "CUSTOM")                   ; we set it to a normal CUSTOM update

                (if (= #amikitinstalldetect "YES")
                    (
                        (set #amikitinstalldetect "YES")                   ; we set amkit dection to YES
                    )
                )
            )
        )


    )
)
;/// ########## end Amikit query choice old conflict handling ##########



;/// ########## begin set and query directorys and optionals ##########
;(working #begin_install)
(complete 4)

(if (= #amikitinstalldetect "NO")                               ;only ask if we not run on a Amikitinstall
    (
        ;------- begin set/query of dirs for normal systems -------
        ;--- test if sys:afa_os exists
        (if (exists #afa_os_defaultpath (noreq) )
            (
                (set @default-dest #afa_os_defaultpath)
            )
            ;else is not default so query
            (
                ;--- ask for destinations
                (if (= #afa_os_installed "NO")
                    (
                        ;- for Docs and testtools
                        (set #afa_os-destination
                            (askdir
                                (prompt #install-where1 @app-name #install-where2)
                                (help @askdir-help)
                                (default "SYS:")
                            )
                        )

                        (set @default-dest (tackon #afa_os-destination @app-name) )
                    )
                    ; else for a custom install
                    (
                        ;- for Docs and testtools
                        (set @default-dest
                            (askdir
                                (prompt #installed-where1)
                                (help @askdir-help)
                                (default "Sys:")
                            )
                        )

                        ;- ask for skin path if it not exists
                        (if (not (exists #afa_os_skins_path (noreq) ) )
                            (set #afa_os_skins_path
                                (askdir
                                    (prompt #installed-whereskins)
                                    (help @askdir-help)
                                    (default #afa_os_skins_defaultpath)
                                )
                            )
                        )
                    )
                )

            )
        )
        ;------ end set/query of dirs for normal systems -------
    )
    ;else
    (
        ;------ begin set dirs for Amikit systems ------
        (set @default-dest #amikitafa_ospath)              ; we run on a Amikit install
        ;------ end set dirs for Amikit systems ------
    )
)

;-------- test if allready installed or query for install zune library
(if (exists (tackon #afa_os_libs_path "zune_lib.exe") (noreq) )
    (
        (set #zunelib_install 1)
    )
    ;else is not installed so ask
    (
        ;---- query zune library
        (if (= @user-level 2)             ;if an expert
            (
                (set #zunelib_install
                    (askbool
                        (prompt #install_zune)
                        (default 1)
                        (choices #choice-yes #choice-no)
                        (help #install_zunehelp)
                    )
                )
            )
        )
    )
)

;-------- test if allready installed or query for install morelibspace_module
(if (exists "Devs:morelibspace_module" (noreq) )
    (
        (set #morelibspace_module_install 1)
    )
    ;else is not installed so ask
    (
        ;---- query morelibspace_module
        (if (= @user-level 2)             ; if an expert
            (
                (set #morelibspace_module_install
                    (askbool
                        (prompt #install_morels_m)
                        (default 1)
                        (choices #choice-yes #choice-no)
                        (help #install_morels_m_help)
                    )
                )
            )
        )
    )
)
;/// ########## end set and query directorys and optionals ##########



;/// ########## begin creating directorys if they are needed and not exists ##########
;(working #creat_dirs)
(complete 6)

;---- AfA_OS directory
(if (not (exists @default-dest (noreq) ) )
    (
        (makedir @default-dest
            (prompt "Creating directory\n" @default-dest)
            (infos)
        )
    )
)

;---- AfA_OS_Libs directory
(if (= #afa_os_installed "NO")
    (
        (makedir #afa_os_libs_path
            (prompt "Creating directory\n" #afa_os_libs_path)
            (infos)
        )
    )
)

;---- AfA_OS Skins directory
(if (not (exists #afa_os_skins_path (noreq) ) )
    (
        (makedir #afa_os_skins_path
            (prompt "Creating directory\n" #afa_os_skins_path)
            (infos)
        )
    )
)
;/// ########## end creating directorys if they are needed and not exists ##########


;/// ########## begin copy for system indepent files ##########
;---- copy c tools
;(working #Copy_c)
(complete 10)

(p_versioncopy "c" "C:" "#?" #c_copy_prompt "")
;(copyfiles
;    (source "c")
;    (dest "C:")
;    (all)
;    (optional "fail" "askuser")
;)

;---- copy librarys for fonts
;(working #copy_libs)
(complete 15)

(p_versioncopy "libs" "LIBS:" "#?" #libs_copy_prompt "")

;---- copy morelibspace_module
;(working #copy_morelibspace_module)
(complete 20)

(if (= #morelibspace_module_install 1)     ; allready exists or query answer was yes
    (
        (p_versioncopy "Optional/Devs" "Devs:" "morelibspace_module" #morelib_mod_copy_prompt "")
    )
)

;/// ########## end copy for system indepent files ##########


;/// ########## begin copy for system depent files ##########
;---- copy files for normal and amikit installes
(if (= #amikitinstalldetect "NO")
    (
        ;##### begin of copy for normal systems #####
        ;---- copy testtools
        ;(working #copy_testprog)
        (complete 25)

        (copyfiles
            (source "testprog")
            (dest @default-dest)
            (noposition)
            (all)
            (optional "fail" "askuser")
            (prompt #testprog_copy_prompt @default-dest)
            (help #testprog_copy_help "\n\n" @copyfiles-help)
        )

        ;---- copy docs
        ;(working #copy_Docs)
        (complete 30)

        (if (= @language "deutsch")
            (
                ;-- copy german docs
                (copyfiles
                    (source "Liesmich.txt")
                    (dest @default-dest)
                    (optional "fail" "askuser")
                    (infos)
                    (noposition)
                    (prompt #docs_copy_prompt @default-dest)
                    (help #docs_copy_help "\n\n" @copyfiles-help)
                )
                (copyfiles
                    (source "Docs/AfA_OS_Dokumentation.txt")
                    (dest @default-dest)
                    (optional "fail" "askuser")
                    (infos)
                    (noposition)
                    (prompt #docs_copy_prompt @default-dest)
                    (help #docs_copy_help "\n\n" @copyfiles-help)
                )
                (copyfiles
                    (source "Docs/AfA_OS_Deutsch.guide")
                    (dest @default-dest)
                    (optional "fail" "askuser")
                    (infos)
                    (noposition)
                    (prompt #docs_copy_prompt @default-dest)
                    (help #docs_copy_help "\n\n" @copyfiles-help)
                )
            )
            ;else
            (
                ;-- copy english docs
                (copyfiles
                    (source "README.txt")
                    (dest @default-dest)
                    (optional "fail" "askuser")
                    (infos)
                    (noposition)
                    (prompt #docs_copy_prompt @default-dest)
                    (help #docs_copy_help "\n\n" @copyfiles-help)
                )
                (copyfiles
                    (source "Docs/AfA_OS_Documentation.txt")
                    (dest @default-dest)
                    (optional "fail" "askuser")
                    (infos)
                    (noposition)
                    (prompt #docs_copy_prompt @default-dest)
                    (help #docs_copy_help "\n\n" @copyfiles-help)
                )
                (copyfiles
                    (source "Docs/AfA_OS_English.guide")
                    (dest @default-dest)
                    (optional "fail" "askuser")
                    (infos)
                    (noposition)
                    (prompt #docs_copy_prompt @default-dest)
                    (help #docs_copy_help "\n\n" @copyfiles-help)
                )
            )
        )

        ;---- copy AfA_OS library
        ;(working #copy_afa_os_libs)
        (complete 35)

        (p_versioncopy "AfA_OS_Libs" #afa_os_libs_path "(#?.exe|#?.kmod)" #afa_libs_copy_prompt #afa_libs_copy_help)

        ;---- copy zune library
        ;(working #copy_zune_lib)
        (complete 40)

        (if (= #zunelib_install 1)                 ; allready exists or query answer was yes
            (
                (p_versioncopy "Optional/AfA_OS_Libs" #afa_os_libs_path "zune_lib.(exe|kmod)" #zune_lib_copy_prompt #zune_lib_copy_help)
            )
        )

        ;---- copy prefstools
        ;(working #copy_prefs)
        (complete 45)

        (copyfiles
            (source "Prefs")
            (dest "Sys:Prefs/")
            (files)                       ; files only no dirs
            (pattern "#?")                ; all
            (optional "fail" "askuser")
            (prompt #prefsprog_copy_prompt "Sys:Prefs/")
            (help #prefsprog_copy_help "\n\n" @copyfiles-help)
        )

        ;---- copy skins
        ;(working #copy_prefs)
        (complete 50)
        (copyfiles
            (source "Prefs/Presets/Skins")
            (dest #afa_os_skins_path)
            (all)
            (optional "fail" "askuser")
            (prompt #skins_copy_prompt #afa_os_skins_path)
            (help #skins_copy_help "\n\n" @copyfiles-help)
        )

        ;---- copy fonts
        ;(working #copy_fonts)
        (complete 95)

        (copyfiles
            (source "Fonts")
            (dest "Fonts:")
            (all)
            (optional "nofail" "askuser") ; nofail because of problems (abort of the script) when font is in use mostly on Amikitsystems
            (prompt #fonts_copy_prompt "Fonts:")
            (help #fonts_copy_help "\n\n" @copyfiles-help)
        )
        ;##### end of copy for normal systems #####
    )
    ;else                    ;we run on a Amikit install
    (
        ;##### begin of install for an Amikit install #####
        ;---- copy/update AfA_OS miscs for amikit
        ;(working #copy_testtools)
        (complete 25)

        (copyfiles
            (source "")
            (pattern "(logo|Optional|patchprogs|testprog|Liesmich.txt|Readme.txt)")
            (dest @default-dest)
            (optional "fail" "askuser")
            (prompt #testprog_copy_prompt @default-dest)
            (help #testprog_copy_help "\n\n" @copyfiles-help)
        )

        ;---- copy/update AfA_OS Docs for amikit
        ;(working #copy_Docs)
        (complete 40)

        (copyfiles
            (source "Docs")
            (dest (tackon @default-dest "Docs") )
            (optional "fail" "askuser")
            (files)
            (pattern "~(#?.info)") ; noicons to prevent overwrite of the exists Icons
            (prompt #docs_copy_prompt @default-dest)
            (help #docs_copy_help "\n\n" @copyfiles-help)
        )

        ;---- copy/update the afa_os_libs for amikit
        ;(working #copy_afa_os_libs)
        (complete 45)

        (if (exists (tackon #afa_os_libs_path "picture_datatype.exe") (noreq) )
            (
                ;with picture_datatype.exe active
                (p_versioncopy "AfA_OS_Libs" #afa_os_libs_path "(#?.exe|#?.kmod)" #afa_libs_copy_prompt #afa_libs_copy_help)
            )
            ;else
            (
                ;with picture_datatype.exe disabled
                (p_versioncopy "AfA_OS_Libs" #afa_os_libs_path "(#?lib.exe|#?lib.kmod)" #afa_libs_copy_prompt #afa_libs_copy_help)
                (p_versioncopy "AfA_OS_Libs" (tackon #afa_os_libs_path "disabled") "(#?datatype.exe|#?datatype.kmod)" #afa_libs_copy_prompt #afa_libs_copy_help)
            )
        )

        ;---- copy/update zune_lib.exe if is active
        (if (= #zunelib_install 1)                 ; allready exists or query answer was yes
            (
                (p_versioncopy "Optional/AfA_OS_Libs" #afa_os_libs_path "(#?.exe|#?.kmod)" #zune_lib_copy_prompt #zune_lib_copy_help)
            )
        )

        ;---- copy prefstools
        ;(working #copy_Prefs)
        (complete 50)

        (copyfiles
            (source "Prefs/AfA_Prefs")
            (dest "Sys:Prefs/")
            (optional "fail" "askuser")
            (prompt #prefsprog_copy_prompt "Sys:Prefs/")
            (help #prefsprog_copy_help "\n\n" @copyfiles-help)
        )

        (copyfiles
            (source "Prefs/TTF_Manager")
            (dest "Sys:Prefs/")
            (newname "TrueType_FontManager")       ; rename it to match the amikitname
            (optional "fail" "askuser")
            (prompt #prefsprog_copy_prompt "Sys:Prefs/")
            (help #prefsprog_copy_help "\n\n" @copyfiles-help)
        )

        ;---- copy skins
        ;(working #copy_Prefs)
        (complete 55)

        ;---- copy all skins execept Tree_Hugger
        (copyfiles
            (source "Prefs/Presets/Skins")
            (dest #afa_os_skins_path)
            (pattern "~(Tree_Hugger)")     ; copy all execept the Tree_Hugger skin
            (optional "fail" "askuser")
            (prompt #skins_copy_prompt #afa_os_skins_path)
            (help #skins_copy_help "\n\n" @copyfiles-help)
        )

        ;---- copy Tree_Hugger skin to Tree Hugger to be compitble with Amikit Morpheus
        (copyfiles
            (source "Prefs/Presets/Skins/Tree_Hugger")
            (dest (tackon #afa_os_skins_path "TreeHugger") )
            (all)
            (optional "fail" "askuser")
            (prompt #skins_copy_prompt #afa_os_skins_path)
            (help #skins_copy_help "\n\n" @copyfiles-help)
        )
        ;---- Cleanup rests from older versions
        ;-- delete "Optional/zune_lib.exe"
        (if (exists (tackon @default-dest "Optional/zune_lib.exe") (noreq) )
            (
                (delete (tackon @default-dest "Optional/zune_lib.exe")
                        (optional "oknodelete")
                        (prompt #zune_old_del_prompt )
                        (help #zune_old_del_help)
                )
            )
        )
        ;##### end of install for an Amikit install #####
    )
)
;/// ########## end copy for system depent files ##########


;/// ########## begin set the Skinpath tooltype if needed ##########
;---- try to set the Skinpath tooltype if the skinpath is not the default one only by a update
(if (and (not (= #amikitinstalldetect "NO") ) (not (= #afa_os_skins_path #afa_os_skins_defaultpath) ) )
    (
        (tooltype
            (dest "Sys:Prefs/AfA_Prefs")
            (settooltype "SkinPath" #afa_os_skins_path)
            (prompt #settooltype_prompt)
            (help #settooltype_help)
        )
    )
)
;/// ########## end set the Skinpath tooltype if needed ##########


;-------- END

;/// ######### begin exit of the script ##########
;(working #install_end)
(complete 100)

(if (= #amikitinstalldetect "NO")
    (
        ;we don't run under Amikit install
        (if (= #afa_os_installed "NO")
            (
                 ; we have a new install
                (exit (cat #exitstring_1 #exitstring_2 #exitstring_3 #exitstring_4) )
                
            )
            ;else
            (
                ; we have a update
                (exit (cat #updateexitstring #rebootstring) )
            )
        )
    )
    ;else
    (
        ;-- we run under Amikit install
        (exit (cat #amikitexitstring #rebootstring) )
    )
)
;/// ######### end exit of the script ##########
