2 ; $VER: Install-MCC 1.5 (21.5.2012)
4 ; $Id: Install-MCC 904 2012-12-20 16:07:58Z damato $
8 ; 1.0 25.05.2010: initial release
9 ; 1.1 26.05.2010: easier definition of supported languages
10 ; 1.2 26.05.2010: added support for multiple catalog files per language
11 ; and added british english as supported language
12 ; 1.3 27.05.2010: the supported languages are now collected dynamically
13 ; instead of being defined statically. Furthermore the
14 ; .mcc name must be specified in the script's icon as
15 ; application name. This makes it possible to use the
16 ; script for arbitrary classes without modification.
17 ; 1.4 11.06.2010: extended the final message that a reboot might be
18 ; necessary to be able to use the just installed version.
19 ; 1.5 21.05.2012: fixed the wrong selection of the builtin language.
20 ; 1.6 20.12.2013: changed MorphOS desription to include 3.x
22 ;----------------------------------------------------------------------------
23 ; /// language bit definition, do not change these!!
31 (set #lang_norwegian 7)
34 (set #lang_finnish 10)
35 (set #lang_hungarian 11)
37 (set #lang_turkish 13)
38 (set #lang_russian 14)
40 (set #lang_english_british 16)
41 (set #lang_maximum 17)
44 ;----------------------------------------------------------------------------
45 ; /// default language detection
47 (while (<> @language (select #i "deutsch" @language))
50 (if (= #i 1) ; LANGUAGE
51 (set #language "english")
52 (set #language @language)
56 (set #defaultLanguages %1000000000000000)
57 (while (<> #language (select #i "czech" "russian" "türkçe" "greek" "magyar" "suomi" "polski" "svenska" "norsk" "nederlands" "italiano" "dansk" "español" "français" "deutsch" #language))
60 (set #defaultLanguages (shiftright #defaultLanguages 1))
63 ; always add english as default language
64 (set #defaultLanguages (bitor #defaultLanguages (shiftleft 1 #lang_english)))
66 ; scan the Locale/Catalogs directory for supported languages
67 (set #supportedLanguages %0000000000000000)
68 (foreach "Locale/Catalogs" "#?"
70 (while (<> @each-name (select #i "english" "german" "french" "spanish" "danish" "italian" "dutch" "norwegian" "swedish" "polish" "finnish" "hungarian" "greek" "turkish" "russian" "czech" @each-name))
73 (if (<> #lang_maximum #i)
74 (set #supportedLanguages (bitor #supportedLanguages (shiftleft 1 #i)))
77 ; always add english as default supported language
78 (set #supportedLanguages (bitor #supportedLanguages (shiftleft 1 #lang_english)))
80 ;----------------------------------------------------------------------------
82 (if (= #language "english")
84 (set #acknowledgeOS (cat "Please acknowledge the automatic\n"
85 "detection of your operating system:"))
86 (set #lang_catalog (cat "Which catalog file do you want to install?\n"
87 "(English language is built-in)"))
89 @app-name " has been successfully installed.\n"
91 "A reboot might be necessary to\n"
92 "finish this installation!"))
98 (if (= #language "deutsch")
100 (set #acknowledgeOS (cat "Bitte bestätigen Sie die automatische\n"
101 "Ermittlung Ihres Betriebssystems:"))
102 (set #lang_catalog (cat "Welche catalog-Datei wollen Sie installieren?\n"
103 "(Englisch ist eingebaut)"))
105 @app-name " wurde erfolgreich installiert.\n"
107 "Gegebenenfalls ist ein Neustart des Systems\n"
108 "nötig, um die Installation abzuschließen!"))
113 ;----------------------------------------------------------------------------
114 ; /// Checking environment
115 (set EXEC_ver (getversion "exec.library" (resident)))
116 (set NEWLIB_ver (getversion "newlib.library" (resident)))
117 (set AROS_ver (getversion "aros.library" (resident)))
119 ; we use newlib.library to check whether we are running on AmigaOS 4.x
120 (if (>= NEWLIB_ver (* 4 65536))
121 (set #detectedSystem 1)
123 ; we are not running on AmigaOS 4.x
124 (if (>= AROS_ver (* 40 65536))
125 (set #detectedSystem 3)
127 ; we are not running on AROS
128 ; now check if we are running on MorphOS (exec.library V50+) or on AmigaOS 3.x
129 (if (>= EXEC_ver (* 50 65536))
130 (set #detectedSystem 2)
131 (set #detectedSystem 0)
140 (prompt #acknowledgeOS)
141 (help @askchoice-help)
142 (choices "AmigaOS 3.x"
144 "MorphOS 1.x/2.x/3.x"
149 (default #detectedSystem)
152 ; finally convert the system number into a string for easier understanding
154 (select #detectedSystem "os3" "os4" "mos" "aros-i386" "aros-ppc" "aros-x86_64")
157 (if (= #detectedSystem "os4")
158 ; AmigaOS 4.x uses english locale names only
160 (set #cat_name_english "english")
161 (set #cat_name_german "german")
162 (set #cat_name_french "french")
163 (set #cat_name_spanish "spanish")
164 (set #cat_name_danish "danish")
165 (set #cat_name_italian "italian")
166 (set #cat_name_dutch "dutch")
167 (set #cat_name_norwegian "norwegian")
168 (set #cat_name_swedish "swedish")
169 (set #cat_name_polish "polish")
170 (set #cat_name_finnish "finnish")
171 (set #cat_name_hungarian "hungarian")
172 (set #cat_name_greek "greek")
173 (set #cat_name_turkish "turkish")
174 (set #cat_name_russian "russian")
175 (set #cat_name_czech "czech")
176 (set #cat_name_english_british "english-british")
178 ; all other systems use localized locale names
180 (set #cat_name_english "english")
181 (set #cat_name_german "deutsch")
182 (set #cat_name_french "français")
183 (set #cat_name_spanish "español")
184 (set #cat_name_danish "dansk")
185 (set #cat_name_italian "italiano")
186 (set #cat_name_dutch "nederlands")
187 (set #cat_name_norwegian "norsk")
188 (set #cat_name_swedish "svenska")
189 (set #cat_name_polish "polski")
190 (set #cat_name_finnish "suomio")
191 (set #cat_name_hungarian "magyar")
192 (set #cat_name_greek "greek")
193 (set #cat_name_turkish "türkçe")
194 (set #cat_name_russian "russian")
195 (set #cat_name_czech "czech")
196 (set #cat_name_english_british "english-british")
200 ; set up the source and destination path
201 (if (= #detectedSystem "os3")
203 (set #MCC_source "Libs/MUI/AmigaOS3")
204 (set #MCC_dest "MUI:libs/mui")
207 (if (= #detectedSystem "os4")
209 (set #MCC_source "Libs/MUI/AmigaOS4")
210 (set #MCC_dest "MUI:libs/mui")
213 (if (= #detectedSystem "mos")
215 (set #MCC_source "Libs/MUI/MorphOS")
216 (set #MCC_dest "SYS:Classes/MUI")
219 (if (= #detectedSystem "aros-i386")
221 (set #MCC_source "Libs/MUI/AROS-i386")
222 (set #MCC_dest "SYS:Classes/Zune")
225 (if (= #detectedSystem "aros-ppc")
227 (set #MCC_source "Libs/MUI/AROS-ppc")
228 (set #MCC_dest "SYS:Classes/Zune")
231 (if (= #detectedSystem "aros-x86_64")
233 (set #MCC_source "Libs/MUI/AROS-x86_64")
234 (set #MCC_dest "SYS:Classes/Zune")
239 ; /// Let's ask user for anything
244 (prompt #lang_catalog)
245 (help @askoptions-help)
247 (if (in #supportedLanguages #lang_english)
248 (cat #prop "English")
251 (if (in #supportedLanguages #lang_german)
252 (cat #prop "Deutsch")
255 (if (in #supportedLanguages #lang_french)
256 (cat #prop "Français")
259 (if (in #supportedLanguages #lang_spanish)
260 (cat #prop "Español")
263 (if (in #supportedLanguages #lang_danish)
267 (if (in #supportedLanguages #lang_italian)
268 (cat #prop "Italiano")
271 (if (in #supportedLanguages #lang_dutch)
272 (cat #prop "Nederlands")
275 (if (in #supportedLanguages #lang_norwegian)
279 (if (in #supportedLanguages #lang_swedish)
280 (cat #prop "Svenska")
283 (if (in #supportedLanguages #lang_polish)
287 (if (in #supportedLanguages #lang_finnish)
291 (if (in #supportedLanguages #lang_hungarian)
295 (if (in #supportedLanguages #lang_greek)
296 (cat #prop "ÅëëçíéêÜ")
299 (if (in #supportedLanguages #lang_turkish)
303 (if (in #supportedLanguages #lang_russian)
304 (cat #prop "Russian")
307 (if (in #supportedLanguages #lang_czech)
311 (if (and (in #supportedLanguages #lang_english_british) (= #detectedSystem "os4"))
312 (cat #prop "English (british)")
316 (default #defaultLanguages)
324 ; copy the .mcc and .mcp files
325 (foreach #MCC_source "#?.mc?"
328 (source (tackon #MCC_source @each-name))
337 ; check if there were any catalogs selected at all
338 (if (<> 0 catalog_lang)
340 ; copy the .cd files for people wanting to translate
341 (foreach "Locale" "#?_mcp.cd"
343 (source (tackon "Locale" @each-name))
344 (dest "LOCALE:Catalogs")
345 (help @copyfiles-help)
349 ; german catalog file
350 (if (in catalog_lang #lang_german)
352 (makedir (tackon "LOCALE:Catalogs" #cat_name_german))
354 (foreach "Locale/Catalogs/german" "#?_mcp.catalog"
356 (source (tackon "Locale/Catalogs/german" @each-name))
357 (dest (tackon "LOCALE:Catalogs" #cat_name_german))
358 (help @copyfiles-help)
364 ; french catalog file
365 (if (in catalog_lang #lang_french)
367 (makedir (tackon "LOCALE:Catalogs" #cat_name_french))
369 (foreach "Locale/Catalogs/french" "#?_mcp.catalog"
371 (source (tackon "Locale/Catalogs/french" @each-name))
372 (dest (tackon "LOCALE:Catalogs" #cat_name_french))
373 (help @copyfiles-help)
379 ; spanish catalog file
380 (if (in catalog_lang #lang_spanish)
382 (makedir (tackon "LOCALE:Catalogs" #cat_name_spanish))
384 (foreach "Locale/Catalogs/spanish" "#?_mcp.catalog"
386 (source (tackon "Locale/Catalogs/spanish" @each-name))
387 (dest (tackon "LOCALE:Catalogs" #cat_name_spanish))
388 (help @copyfiles-help)
394 ; danish catalog file
395 (if (in catalog_lang #lang_danish)
397 (makedir (tackon "LOCALE:Catalogs" #cat_name_danish))
399 (foreach "Locale/Catalogs/danish" "#?_mcp.catalog"
401 (source (tackon "Locale/Catalogs/danish" @each-name))
402 (dest (tackon "LOCALE:Catalogs" #cat_name_danish))
403 (help @copyfiles-help)
409 ; italian catalog file
410 (if (in catalog_lang #lang_italian)
412 (makedir (tackon "LOCALE:Catalogs" #cat_name_italian))
414 (foreach "Locale/Catalogs/italian" "#?_mcp.catalog"
416 (source (tackon "Locale/Catalogs/italian" @each-name))
417 (dest (tackon "LOCALE:Catalogs" #cat_name_italian))
418 (help @copyfiles-help)
425 (if (in catalog_lang #lang_dutch)
427 (makedir (tackon "LOCALE:Catalogs" #cat_name_dutch))
429 (foreach "Locale/Catalogs/dutch" "#?_mcp.catalog"
431 (source (tackon "Locale/Catalogs/dutch" @each-name))
432 (dest (tackon "LOCALE:Catalogs" #cat_name_dutch))
433 (help @copyfiles-help)
439 ; norwegian catalog file
440 (if (in catalog_lang #lang_norwegian)
442 (makedir (tackon "LOCALE:Catalogs" #cat_name_norwegian))
444 (foreach "Locale/Catalogs/norwegian" "#?_mcp.catalog"
446 (source (tackon "Locale/Catalogs/norwegian" @each-name))
447 (dest (tackon "LOCALE:Catalogs" #cat_name_norwegian))
448 (help @copyfiles-help)
454 ; swedish catalog file
455 (if (in catalog_lang #lang_swedish)
457 (makedir (tackon "LOCALE:Catalogs" #cat_name_swedish))
459 (foreach "Locale/Catalogs/swedish" "#?_mcp.catalog"
461 (source (tackon "Locale/Catalogs/swedish" @each-name))
462 (dest (tackon "LOCALE:Catalogs" #cat_name_swedish))
463 (help @copyfiles-help)
469 ; polish catalog file
470 (if (in catalog_lang #lang_polish)
472 (makedir (tackon "LOCALE:Catalogs" #cat_name_polish))
474 (foreach "Locale/Catalogs/polish" "#?_mcp.catalog"
476 (source (tackon "Locale/Catalogs/polish" @each-name))
477 (dest (tackon "LOCALE:Catalogs" #cat_name_polish))
478 (help @copyfiles-help)
484 ; finnish catalog file
485 (if (in catalog_lang #lang_finnish)
487 (makedir (tackon "LOCALE:Catalogs" #cat_name_finnish))
489 (foreach "Locale/Catalogs/finnish" "#?_mcp.catalog"
491 (source (tackon "Locale/Catalogs/finnish" @each-name))
492 (dest (tackon "LOCALE:Catalogs" #cat_name_finnish))
493 (help @copyfiles-help)
499 ; hungarian catalog file
500 (if (in catalog_lang #lang_hungarian)
502 (makedir (tackon "LOCALE:Catalogs" #cat_name_hungarian))
504 (foreach "Locale/Catalogs/hungarian" "#?_mcp.catalog"
506 (source (tackon "Locale/Catalogs/hungarian" @each-name))
507 (dest (tackon "LOCALE:Catalogs" #cat_name_hungarian))
508 (help @copyfiles-help)
515 (if (in catalog_lang #lang_greek)
517 (makedir (tackon "LOCALE:Catalogs" #cat_name_greek))
519 (foreach "Locale/Catalogs/greek" "#?_mcp.catalog"
521 (source (tackon "Locale/Catalogs/greek" @each-name))
522 (dest (tackon "LOCALE:Catalogs" #cat_name_greek))
523 (help @copyfiles-help)
529 ; turkish catalog file
530 (if (in catalog_lang #lang_turkish)
532 (makedir (tackon "LOCALE:Catalogs" #cat_name_turkish))
534 (foreach "Locale/Catalogs/turkish" "#?_mcp.catalog"
536 (source (tackon "Locale/Catalogs/turkish" @each-name))
537 (dest (tackon "LOCALE:Catalogs" #cat_name_turkish))
538 (help @copyfiles-help)
544 ; russian catalog file
545 (if (in catalog_lang #lang_russian)
547 (makedir (tackon "LOCALE:Catalogs" #cat_name_russian))
549 (foreach "Locale/Catalogs/russian" "#?_mcp.catalog"
551 (source (tackon "Locale/Catalogs/russian" @each-name))
552 (dest (tackon "LOCALE:Catalogs" #cat_name_russian))
553 (help @copyfiles-help)
560 (if (in catalog_lang #lang_czech)
562 (makedir (tackon "LOCALE:Catalogs" #cat_name_czech))
564 (foreach "Locale/Catalogs/czech" "#?_mcp.catalog"
566 (source (tackon "Locale/Catalogs/czech" @each-name))
567 (dest (tackon "LOCALE:Catalogs" #cat_name_czech))
568 (help @copyfiles-help)
574 ; english-british catalog file, only AmigaOS4.x can handle this
575 (if (and (in catalog_lang #lang_english_british) (= #detectedSystem "os4"))
577 (makedir (tackon "LOCALE:Catalogs" #cat_name_english_british))
579 (foreach "Locale/Catalogs/english-british" "#?_mcp.catalog"
581 (source (tackon "Locale/Catalogs/english-british" @each-name))
582 (dest (tackon "LOCALE:Catalogs" #cat_name_english_british))
583 (help @copyfiles-help)
595 ; /// ********************
596 ;----------------------------------------------------------------------------