├── SIC_1.2.sh
└── SIC_1.5.sh
/SIC_1.2.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # SIC.sh
4 | #
5 | #
6 | # Created by Duncan McCracken on 05/06/11.
7 | # Email Bug Reports to duncan.mccracken@mondada.com.au
8 | #
9 | # Thanks to: Tomos Tyler; Charles Edge and Alan Gordon for their feedback and
10 | # ideas when this was a personal project.
11 | #
12 | # Copyright 2011 Mondada Pty Ltd. All rights reserved.
13 | #
14 | # Changes in 1.2rc10
15 | # Added code to enable the language chooser in vanilla images created by install.
16 | # Added a rudimentary progress indicator to the install package function.
17 | # Added an additional line to the image cleanup to remove the Spotlight folder.
18 | # Changed the default image size to match a 64 GB SSD, to ensure the images will
19 | # restore to smaller drives.
20 | #
21 | # Changes in 1.2rc9
22 | # Updated the source selection function to differentiate between installers
23 | # and devices in the create image section - thanks Mika Viikki.
24 | #
25 | # Changes in 1.2rc8
26 | # Lion install.
27 | # Fixed an issue with the FirstBootPath, not being prefixed with the target
28 | # volume - thanks Mika Viikki.
29 | # Updated the code for calculating the device name when imaging a device, if
30 | # there are more than the standard partitions created by the installation
31 | # process - thanks Mika Viikki.
32 | # Updated the code that validates the packages against the currently mounted
33 | # image to avoid it skipping packages in some situations - thanks Mika Viikki.
34 | #
35 | # Changes in 1.2rc7
36 | # Updated the naming of exported masters, to retain original build and append
37 | # the update build to the filename.
38 | # Updated behaviour when exiting 'level 2' menus to not retain the selections,
39 | # this seems to yield a faster workflow and avoids snow/lion variances.
40 | # Updated Remote Management function to issue kickstart command on first boot
41 | # - thanks Mark Hatch.
42 | # Updated create image function to eliminate a 'resource busy' error when
43 | # running SIC under Lion.
44 | # Added support for the additional languages in Lion.
45 | # Updated the references to the GeoKit.framework to use the target image
46 | # rather than the current running system.
47 | # Updated attach image function to use a different mechanism to calculate the
48 | # volume name, which eliminates an error in Lion, and allows for clean-up of
49 | # the recovery partition - thanks Mika Viikki.
50 | #
51 | # Changes in 1.2rc6
52 | # Credit given where credit was due. :)
53 | # Fixed a bug that caused a few errors on first run, while setting default
54 | # preferences.
55 | # Adjusted the code for setting password on Lion systems (supressed a false
56 | # error, which is generated by code that was intended to handle snow leopard
57 | # behaviour) - thanks Mark Hatch.
58 | # Tuned some of the behaviours relating to image and package selection to
59 | # prevent constant mounting / unmounting of images, and retained selection of
60 | # the last installed package.
61 | # Added a Press any key to the completion of the package install to allow the
62 | # viewing of results.
63 | # Added a check to prevent system configuration of a server image, this does
64 | # not end well.
65 | #
66 | # Changes in 1.2rc5
67 | # Added code to create the Packages directory, if it doesn't exist.
68 | #
69 | # Changes in 1.2rc4
70 | # Updated create image function to create the library folder prior to imaging a
71 | # device - Thanks Erik Berglund.
72 | # Change the default response for custom package install to "No".
73 | # Added code to check the build number prior to export and update name
74 | # accordingly.
75 | #
76 | # Changes in 1.2rc3
77 | # Added Install Package Feature.
78 | # Updated Create Image menu to auto detect install or device.
79 | # Updated menu functions to hide disabled items.
80 | # Updated validation of image size function to allow floating point numbers.
81 | # Updated create image from device to handle resource busy error - Thanks
82 | # Erik Berglund.
83 | #
84 | # To Do, this version
85 | # Add support for additional languages in Lion.
86 | #
87 | # Proposed features for version 1.5
88 | # Add Software Update settings option.
89 | # Add support for "install package at system startup".
90 | # Record package install history.
91 | # Update auto-login function for user creation, when multiple accounts exist.
92 | # Add support for multiple configuration (shadow) files.
93 | # Add support for Directory binding.
94 | # Add support for a directory-based administrative group.
95 | # Add unattended option.
96 | # Add help section.
97 |
98 | # The following default variables are used if the system fails to get a property
99 | # These can all be set in preferences, there is no need to edit the script
100 |
101 | # Image Library Path
102 | LibraryPath="/Users/Shared/SIC/Library"
103 | # Export Path
104 | ExportPath="/Users/Shared/SIC/Masters"
105 | # Package Path
106 | PackagePath="/Users/Shared/SIC/Packages"
107 | # Image Size (GB)
108 | ImageSize="56.5"
109 | minImageSize="5"
110 | maxImageSize="2048"
111 | # Volume Name
112 | VolumeName="Macintosh HD"
113 | # Main Language
114 | AppleLanguage="en"
115 | # Country Name
116 | CountryName="U.S."
117 | # Keyboard Layout
118 | AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.US"
119 | InputMode=""
120 | # Set date and time automatically
121 | ntpdDisabled="true"
122 | # Time Zone
123 | TimezoneAuto="false"
124 | # Remote Login
125 | sshdDisabled="true"
126 | # Remote Management
127 | RemoteManagement="false"
128 | # Computer Name
129 | ComputerName="Model and MAC Address"
130 | # Full Name
131 | RealName="Local Administrator"
132 | # Account name
133 | RecordName="localadmin"
134 | # User ID
135 | UniqueID=501
136 | # Group ID
137 | PrimaryGroupID=20
138 | # Password
139 | Password=""
140 | # Automatic Login
141 | AutoLogin="false"
142 | # Password Hint
143 | AuthenticationHint=""
144 | # Login shell
145 | UserShell="/bin/bash"
146 | # Home Directory
147 | NFSHomeDirectory="/var/localadmin"
148 |
149 | # FirstBoot Script Path
150 | FirstBootPath="/usr/libexec/FirstBoot"
151 |
152 | # ${0}: Path to this script
153 | scriptName=`basename "${0}"`
154 |
155 | # Version
156 | SICVersion="1.2rc12"
157 |
158 | function display_Title {
159 | # ${1}: Title
160 | clear
161 | # printf "\033c"
162 | printf "\033[1mSystem Image Creator (SIC) ${SICVersion}\033[m\n"
163 | printf "\n\033[1m${1}\033[m\n\n"
164 | }
165 |
166 | function display_Options {
167 | # ${1}: Text above selection list
168 | # ${2}: Text for prompt
169 | printf "${1}\n\n"
170 | PS3=`printf "\n${2}"`
171 | }
172 |
173 | function press_anyKey {
174 | # ${1}: Message to display above prompt
175 | if [ -n "${1}" ] ; then echo "${1}" ; echo ; fi
176 | read -sn 1 -p "Press any key to continue..." anyKey < /dev/tty
177 | echo
178 | }
179 |
180 | function set_osName {
181 | # ${1}: System Minor Version
182 | case ${1} in
183 | 7 ) osName="lion" ;;
184 | 6 ) osName="snowleopard" ;;
185 | 5 ) osName="leopard" ;;
186 | * ) osName="" ;;
187 | esac
188 | }
189 |
190 | function privelege_Check {
191 | if [ `id -u` -ne 0 ] ; then
192 | echo "${scriptName} must be run with root privileges, exiting."
193 | exit 1
194 | fi
195 | }
196 |
197 | function get_LibraryPath {
198 | prefLibraryPath=`defaults read ~/Library/Preferences/au.com.mondada.SIC "LibraryPath" 2>/dev/null`
199 | if [ -n "${prefLibraryPath}" ] ; then
200 | if [ -e "${prefLibraryPath}" ] ; then
201 | LibraryPath="${prefLibraryPath}"
202 | else
203 | printf "Warning: Library Path missing, reverting to default\n"
204 | fi
205 | fi
206 | echo "LibraryPath: ${LibraryPath}"
207 | }
208 |
209 | function get_ExportPath {
210 | prefExportPath=`defaults read ~/Library/Preferences/au.com.mondada.SIC "ExportPath" 2>/dev/null`
211 | if [ -n "${prefExportPath}" ] ; then
212 | if [ -e "${prefExportPath}" ] ; then
213 | ExportPath="${prefExportPath}"
214 | else
215 | printf "Warning: Export Path missing, reverting to default\n"
216 | fi
217 | fi
218 | echo "ExportPath: ${ExportPath}"
219 | }
220 |
221 | function get_PackagePath {
222 | prefPackagePath=`defaults read ~/Library/Preferences/au.com.mondada.SIC "PackagePath" 2>/dev/null`
223 | if [ -n "${prefPackagePath}" ] ; then
224 | if [ -e "${prefPackagePath}" ] ; then
225 | PackagePath="${prefPackagePath}"
226 | else
227 | printf "Warning: Export Path missing, reverting to default\n"
228 | fi
229 | fi
230 | echo "PackagePath: ${PackagePath}"
231 | }
232 |
233 | function save_LibraryPath {
234 | defaults write ~/Library/Preferences/au.com.mondada.SIC "LibraryPath" -string "${LibraryPath}"
235 | }
236 |
237 | function save_ExportPath {
238 | defaults write ~/Library/Preferences/au.com.mondada.SIC "ExportPath" -string "${ExportPath}"
239 | }
240 |
241 | function save_PackagePath {
242 | defaults write ~/Library/Preferences/au.com.mondada.SIC "PackagePath" -string "${PackagePath}"
243 | }
244 |
245 | function display_LibraryPath {
246 | echo "Library Path: ${LibraryPath}"
247 | }
248 |
249 | function display_ExportPath {
250 | echo "Export Path: ${ExportPath}"
251 | }
252 |
253 | function display_PackagePath {
254 | echo "Package Path: ${PackagePath}"
255 | }
256 |
257 | function check_Path {
258 | # ${1}: Path to validate
259 | validPath=0
260 | # Check for invalid characters
261 | escapedPath="${1//[\$\(\)\[\]\`\~\?\*\#\\\!\|\'\"]/_}"
262 | if [ "${1}" != "${escapedPath}" ] ; then
263 | printf "\nThe specified path cannot contain the following characters: \033[1m\$()[]\`~?*#\!|'\"\033[m\n" ; validPath=1 ; return 1
264 | fi
265 | # Check that it's absolute
266 | relativePath=`echo "${1}" | awk -F "/" '{print $1}'`
267 | if [ -n "${relativePath}" ] ; then
268 | printf "\nThe specified path must be absolute, please enter an absolute path\n" ; validPath=1 ; return 1
269 | fi
270 | # Check the volume exists
271 | if echo "${1}" | grep -q "/Volumes/" ; then
272 | volumeName=`echo "${1}" | awk -F "/Volumes/" '{print $NF}' | awk -F "/" '{print $1}'`
273 | if [ ! -d "/Volumes/${volumeName}" ] ; then
274 | printf "\nThe specified volume cannot be found, please enter a valid path\n" ; validPath=1 ; return 1
275 | fi
276 | fi
277 | # Check that the path is unique
278 | if [ "${1}" == "${LibraryPath}" ] || [ "${1}" == "${ExportPath}" ] ; then
279 | printf "\nThe library and export paths cannot be the same, please enter a unique path\n" ; validPath=1 ; return 1
280 | fi
281 | return 0
282 | }
283 |
284 | function set_LibraryPath {
285 | display_Title "Library Path"
286 | printf "Library Path (${LibraryPath}): " ; read newLibraryPath
287 | if [ -z "${newLibraryPath}" ] || [ "${newLibraryPath}" == "${LibraryPath}" ] ; then return 0 ; fi
288 | check_Path "${newLibraryPath}"
289 | while [ ${validPath} -ne 0 ] ; do
290 | printf "\nLibrary Path (${LibraryPath}): " ; read newLibraryPath
291 | if [ -z "${newLibraryPath}" ] || [ "${newLibraryPath}" == "${LibraryPath}" ] ; then return 0 ; fi
292 | check_Path "${newLibraryPath}"
293 | done
294 | LibraryPath="${newLibraryPath}"
295 | }
296 |
297 | function set_ExportPath {
298 | display_Title "Export Path"
299 | printf "Export Path (${ExportPath}): " ; read newExportPath
300 | if [ -z "${newExportPath}" ] || [ "${newExportPath}" == "${ExportPath}" ] ; then return 0 ; fi
301 | check_Path "${newExportPath}"
302 | while [ ${validPath} -ne 0 ] ; do
303 | printf "\nExport Path (${ExportPath}): " ; read newExportPath
304 | if [ -z "${newExportPath}" ] || [ "${newExportPath}" == "${ExportPath}" ] ; then return 0 ; fi
305 | check_Path "${newExportPath}"
306 | done
307 | ExportPath="${newExportPath}"
308 | }
309 |
310 | function set_PackagePath {
311 | display_Title "Package Path"
312 | printf "Package Path (${PackagePath}): " ; read newPackagePath
313 | if [ -z "${newPackagePath}" ] || [ "${newPackagePath}" == "${PackagePath}" ] ; then return 0 ; fi
314 | check_Path "${newPackagePath}"
315 | while [ ${validPath} -ne 0 ] ; do
316 | printf "\nExport Path (${PackagePath}): " ; read newPackagePath
317 | if [ -z "${newPackagePath}" ] || [ "${newPackagePath}" == "${PackagePath}" ] ; then return 0 ; fi
318 | check_Path "${newPackagePath}"
319 | done
320 | PackagePath="${newPackagePath}"
321 | }
322 |
323 | function get_DefaultPaths {
324 | get_LibraryPath
325 | get_ExportPath
326 | get_PackagePath
327 | }
328 |
329 | function save_DefaultPaths {
330 | save_LibraryPath
331 | save_ExportPath
332 | save_PackagePath
333 | }
334 |
335 | function display_DefaultPaths {
336 | display_LibraryPath
337 | display_ExportPath
338 | display_PackagePath
339 | }
340 |
341 | function menu_DefaultPaths {
342 | pathOptions=( "Library Path" "Export Path" "Package Path" "Previous Menu" )
343 | while [ "${pathOption}" != "Previous Menu" ] ; do
344 | display_Title "Default Paths"
345 | display_DefaultPaths
346 | echo
347 | display_Options "Options" "Select an option: "
348 | select pathOption in "${pathOptions[@]}" ; do
349 | case "${pathOption}" in
350 | "Library Path" ) set_LibraryPath ; pathOption="" ; break ;;
351 | "Export Path" ) set_ExportPath ; pathOption="" ; break ;;
352 | "Package Path" ) set_PackagePath ; pathOption="" ; break ;;
353 | "Previous Menu" ) break ;;
354 | esac
355 | done
356 | done
357 | pathOption=""
358 | }
359 |
360 | function get_ImageSize {
361 | prefImageSize=`defaults read ~/Library/Preferences/au.com.mondada.SIC "ImageSize" 2>/dev/null`
362 | if [ -n "${prefImageSize}" ] ; then ImageSize="${prefImageSize}" ; fi
363 | echo "ImageSize: ${ImageSize}"
364 | }
365 |
366 | function save_ImageSize {
367 | defaults write ~/Library/Preferences/au.com.mondada.SIC "ImageSize" -float "${ImageSize}"
368 | }
369 |
370 | function display_ImageSize {
371 | echo "Image Size: ${ImageSize} GB"
372 | }
373 |
374 | function check_Size {
375 | # ${1}: Size to validate
376 | validSize=0
377 | # Remove invalid characters
378 | newImageSize="${1//[^0-9.]/}"
379 | # Validate the clean string to ensure its numeric
380 | isValid=$( echo "scale=0; ${newImageSize}/${newImageSize} + 1" | bc -l 2>/dev/null )
381 | if [ ${isValid} -gt 1 ] ; then
382 | # Check that it's larger than 5 GB
383 | if [ $( echo "${newImageSize} < ${minImageSize}" | bc 2>/dev/null ) -ne 0 ] ; then printf "\nMac OS X requires at least \033[1m${minImageSize}\033[m GB of free space to install.\n" ; ImageSize="${minImageSize}" ; validSize=1 ; return 1 ; fi
384 | # Check that it's smaller than 2 TB
385 | if [ $( echo "${newImageSize} > ${maxImageSize}" | bc 2>/dev/null ) -ne 0 ] ; then printf "\nThe maximum image size is \033[1m${maxImageSize}\033[m GB.\n" ; ImageSize="${maxImageSize}" ; validSize=1 ; return 1 ; fi
386 | return 0
387 | else
388 | printf "\n\033[1m${1}\033[m is not a valid value, please enter a numeric value.\n" ; validSize=1 ; return 1
389 | fi
390 | }
391 |
392 | function set_ImageSize {
393 | display_Title "Image Size"
394 | printf "Image Size (${ImageSize}): " ; read newImageSize
395 | if [ -z "${newImageSize}" ] || [ "${newImageSize}" == "${ImageSize}" ] ; then return 0 ; fi
396 | check_Size "${newImageSize}"
397 | while [ ${validSize} -ne 0 ] ; do
398 | printf "\nImage Size (${ImageSize}): " ; read newImageSize
399 | if [ -z "${newImageSize}" ] || [ "${newImageSize}" == "${ImageSize}" ] ; then return 0 ; fi
400 | check_Size "${newImageSize}"
401 | done
402 | ImageSize="${newImageSize}"
403 | }
404 |
405 | function get_VolumeName {
406 | prefVolumeName=`defaults read ~/Library/Preferences/au.com.mondada.SIC "VolumeName" 2>/dev/null`
407 | if [ -n "${prefVolumeName}" ] ; then VolumeName="${prefVolumeName}" ; fi
408 | echo "VolumeName: ${VolumeName}"
409 | }
410 |
411 | function save_VolumeName {
412 | defaults write ~/Library/Preferences/au.com.mondada.SIC "VolumeName" -string "${VolumeName}"
413 | }
414 |
415 | function display_VolumeName {
416 | echo "Volume Name: ${VolumeName}"
417 | }
418 |
419 | function check_VolumeName {
420 | # ${1}: Volume Name to validate
421 | validName=0
422 | # Check for invalid characters
423 | escapedName="${1//[\$\(\)\[\]\`\~\?\*\#\\\!\|\'\"]/_}"
424 | if [ "${1}" != "${escapedName}" ] ; then printf "\nThe volume name cannot contain the following characters: \033[1m\$()[]\`~?*#\!|'\"\033[m\n" ; validName=1 ; return 1 ; fi
425 | return 0
426 | }
427 |
428 | function set_VolumeName {
429 | display_Title "Volume Name"
430 | printf "Volume Name (${VolumeName}): " ; read newVolumeName
431 | if [ -z "${newVolumeName}" ] || [ "${newVolumeName}" == "${VolumeName}" ] ; then return 0 ; fi
432 | newVolumeName="${newVolumeName//\//:}"
433 | check_VolumeName "${newVolumeName}"
434 | while [ ${validName} -ne 0 ] ; do
435 | printf "Volume Name (${VolumeName}): " ; read newVolumeName
436 | if [ -z "${newVolumeName}" ] || [ "${newVolumeName}" == "${VolumeName}" ] ; then return 0 ; fi
437 | newVolumeName="${newVolumeName//\//:}"
438 | check_VolumeName "${newVolumeName}"
439 | done
440 | VolumeName="${newVolumeName}"
441 | }
442 |
443 | function get_ImageSettings {
444 | get_ImageSize
445 | get_VolumeName
446 | }
447 |
448 | function save_ImageSettings {
449 | save_ImageSize
450 | save_VolumeName
451 | }
452 |
453 | function display_ImageSettings {
454 | display_ImageSize
455 | display_VolumeName
456 | }
457 |
458 | function menu_ImageSettings {
459 | imageOptions=( "Image Size" "Volume Name" "Previous Menu" )
460 | while [ "${imageOption}" != "Previous Menu" ] ; do
461 | display_Title "Image Settings"
462 | display_ImageSettings
463 | echo
464 | display_Options "Options" "Select an option: "
465 | select imageOption in "${imageOptions[@]}" ; do
466 | case "${imageOption}" in
467 | "Image Size" ) set_ImageSize ; imageOption="" ; break ;;
468 | "Volume Name" ) set_VolumeName ; imageOption="" ; break ;;
469 | "Previous Menu" ) break ;;
470 | esac
471 | done
472 | done
473 | imageOption=""
474 | }
475 |
476 | function set_AppleLanguage {
477 | # ${1}: mainLanguage
478 | case "${1}" in
479 | "English" ) AppleLanguage="en" ; defaultCountryNames=( "United States" "Canada" "United Kingdom" "Australia" "New Zealand" "Ireland" ) ; UserTemplate="English" ;;
480 | "Japanese" ) AppleLanguage="ja" ; defaultCountryNames=( "Japan" ) ; UserTemplate="Japanese" ;;
481 | "French" ) AppleLanguage="fr" ; defaultCountryNames=( "Belgium" "Canada" "France" "Luxembourg" "Switzerland" ) ; UserTemplate="French" ;;
482 | "German" ) AppleLanguage="de" ; defaultCountryNames=( "Germany" "Luxembourg" "Austria" "Switzerland" ) ; UserTemplate="German" ;;
483 | "Spanish" ) AppleLanguage="es" ; defaultCountryNames=( "Antigua and Barbuda" "Argentina" "Chile" "Costa Rica" "Spain" "Philippines" "Mexico" "Panama" "Dominican Republic" "Venezuela" ) ; UserTemplate="Spanish" ;;
484 | "Italian" ) AppleLanguage="it" ; defaultCountryNames=( "Italy" ) ; UserTemplate="Italian" ;;
485 | "Dutch" ) AppleLanguage="nl" ; defaultCountryNames=( "Netherlands" "Belgium" ) ; UserTemplate="Dutch" ;;
486 | "Swedish" ) AppleLanguage="sv" ; defaultCountryNames=( "Sweden" ) ; UserTemplate="sv" ;;
487 | "Norwegian" ) AppleLanguage="nb" ; defaultCountryNames=( "Norway" ) ; UserTemplate="no" ;;
488 | "Danish" ) AppleLanguage="da" ; defaultCountryNames=( "Denmark" ) ; UserTemplate="da" ;;
489 | "Finnish" ) AppleLanguage="fi" ; defaultCountryNames=( "Finland" ) ; UserTemplate="fi" ;;
490 | "Polish" ) AppleLanguage="pl" ; defaultCountryNames=( "Poland" ) ; UserTemplate="pl" ;;
491 | "Portuguese" ) AppleLanguage="pt" ; defaultCountryNames=( "Brazil" "Portugal" ) ; UserTemplate="pt" ;;
492 | "Portuguese (Portugal)" ) AppleLanguage="pt-PT" ; defaultCountryNames=( "Portugal" ) ; UserTemplate="pt_PT" ;;
493 | "Russian" ) AppleLanguage="ru" ; defaultCountryNames=( "Russia" "Belarus" "Estonia" "Kazakhstan" "Kyrgyzstan" "Latvia" "Svalbard and Jan Mayen" "Tajikistan" "Ukraine" "Uzbekistan" ) ; UserTemplate="ru" ;;
494 | "Chinese (Simplified)" ) AppleLanguage="zh-Hans" ; defaultCountryNames=( "China" ) ; UserTemplate="zh_CN" ;;
495 | "Chinese (Traditional)" ) AppleLanguage="zh-Hant" ; defaultCountryNames=( "China" ) ; UserTemplate="zh_TW" ;;
496 | "Korean" ) AppleLanguage="ko" ; defaultCountryNames=( "South Korea" ) ; UserTemplate="ko" ;;
497 | esac
498 | }
499 |
500 | function set_mainLanguage {
501 | # ${1}: AppleLanguage
502 | case "${1}" in
503 | "en" ) mainLanguage="English" ;;
504 | "ja" ) mainLanguage="Japanese" ;;
505 | "fr" ) mainLanguage="French" ;;
506 | "de" ) mainLanguage="German" ;;
507 | "es" ) mainLanguage="Spanish" ;;
508 | "it" ) mainLanguage="Italian" ;;
509 | "nl" ) mainLanguage="Dutch" ;;
510 | "sv" ) mainLanguage="Swedish" ;;
511 | "nb" ) mainLanguage="Norwegian" ;;
512 | "da" ) mainLanguage="Danish" ;;
513 | "fi" ) mainLanguage="Finnish" ;;
514 | "pl" ) mainLanguage="Polish" ;;
515 | "pt" ) mainLanguage="Portuguese" ;;
516 | "pt-PT" ) mainLanguage="Portuguese (Portugal)" ;;
517 | "ru" ) mainLanguage="Russian" ;;
518 | "zh-Hans" ) mainLanguage="Chinese (Simplified)" ;;
519 | "zh-Hant" ) mainLanguage="Chinese (Traditional)" ;;
520 | "ko" ) mainLanguage="Korean" ;;
521 | "ar" ) mainLanguage="Arabic" ;;
522 | "cs" ) mainLanguage="Czech" ;;
523 | "hu" ) mainLanguage="Hungarian" ;;
524 | esac
525 | set_AppleLanguage "${mainLanguage}"
526 | }
527 |
528 | function get_AppleLanguage {
529 | prefAppleLanguage=`defaults read ~/Library/Preferences/au.com.mondada.SIC "AppleLanguage" 2>/dev/null`
530 | if [ -z "${prefAppleLanguage}" ] ; then prefAppleLanguage=`/usr/libexec/PlistBuddy -c "Print ':AppleLanguages:0'" "/Library/Preferences/.GlobalPreferences.plist" 2>/dev/null` ; fi
531 | if [ -n "${prefAppleLanguage}" ] ; then AppleLanguage="${prefAppleLanguage}" ; fi
532 | echo "AppleLanguage: ${AppleLanguage}"
533 | set_mainLanguage "${AppleLanguage}"
534 | }
535 |
536 | function save_AppleLanguage {
537 | defaults write ~/Library/Preferences/au.com.mondada.SIC "AppleLanguage" -string "${AppleLanguage}"
538 | }
539 |
540 | function display_mainLanguage {
541 | echo "Language: ${mainLanguage}"
542 | }
543 |
544 | function set_Languages {
545 | if [ -n "${targDisk}" ] ; then
546 | Languages=( "English" )
547 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.ja.plist" ] ; then Languages=( "${Languages[@]}" "Japanese" ) ; fi
548 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.fr.plist" ] ; then Languages=( "${Languages[@]}" "French" ) ; fi
549 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.de.plist" ] ; then Languages=( "${Languages[@]}" "German" ) ; fi
550 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.es.plist" ] ; then Languages=( "${Languages[@]}" "Spanish" ) ; fi
551 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.it.plist" ] ; then Languages=( "${Languages[@]}" "Italian" ) ; fi
552 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.pt.plist" ] ; then Languages=( "${Languages[@]}" "Portuguese" ) ; fi
553 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.pt_PT.plist" ] ; then Languages=( "${Languages[@]}" "Portuguese (Portugal)" ) ; fi
554 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.nl.plist" ] ; then Languages=( "${Languages[@]}" "Dutch" ) ; fi
555 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.sv.plist" ] ; then Languages=( "${Languages[@]}" "Swedish" ) ; fi
556 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.no.plist" ] ; then Languages=( "${Languages[@]}" "Norwegian" ) ; fi
557 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.da.plist" ] ; then Languages=( "${Languages[@]}" "Danish" ) ; fi
558 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.fi.plist" ] ; then Languages=( "${Languages[@]}" "Finnish" ) ; fi
559 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.ru.plist" ] ; then Languages=( "${Languages[@]}" "Russian" ) ; fi
560 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.pl.plist" ] ; then Languages=( "${Languages[@]}" "Polish" ) ; fi
561 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.tr.plist" ] ; then Languages=( "${Languages[@]}" "Turkish" ) ; fi
562 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.zh_CN.plist" ] ; then Languages=( "${Languages[@]}" "Chinese (Simplified)" ) ; fi
563 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.zh_TW.plist" ] ; then Languages=( "${Languages[@]}" "Chinese (Traditional)" ) ; fi
564 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.ko.plist" ] ; then Languages=( "${Languages[@]}" "Korean" ) ; fi
565 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.ar.plist" ] ; then Languages=( "${Languages[@]}" "Arabic" ) ; fi
566 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.cs.plist" ] ; then Languages=( "${Languages[@]}" "Czech" ) ; fi
567 | if [ -e "/Volumes/${targDisk}/private/var/db/receipts/com.apple.MacOSX.lang.hu.plist" ] ; then Languages=( "${Languages[@]}" "Hungarian" ) ; fi
568 | else
569 | Languages=( "English" "Japanese" "French" "German" "Spanish" "Italian" "Portuguese" "Portuguese (Portugal)" "Dutch" "Swedish" "Norwegian" "Danish" "Finnish" "Russian" "Polish" "Chinese (Simplified)" "Chinese (Traditional)" "Korean" )
570 | fi
571 | langAvailable=0 ; for Element in "${Languages[@]}" ; do if [ "${Language}" == "${Element}" ] ; then langAvailable=1 ; break ; fi ; done
572 | if [ ${langAvailable} -eq 0 ] ; then Language="${Languages[0]}" ; fi
573 | }
574 |
575 | function select_mainLanguage {
576 | set_Languages
577 | display_Title "Select Language"
578 | display_mainLanguage
579 | display_Options "Languages" "Select the main language you wish to use: "
580 | select newLanguage in "${Languages[@]}" ; do
581 | if [ -n "${newLanguage}" ] ; then break ; fi
582 | done
583 | mainLanguage="${newLanguage}" ; newLanguage=""
584 | set_AppleLanguage "${mainLanguage}"
585 | }
586 |
587 | function set_Country {
588 | case "${1}" in
589 | "United States" ) Country="US" ; defaultKeyboardLayouts=( "U.S." "Canadian English" ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
590 | "Canada" ) Country="CA" ; defaultKeyboardLayouts=( "U.S." "British" "Canadian English" "Canadian French - CSA" ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=6094817 ;;
591 | "United Kingdom" ) Country="GB" ; defaultKeyboardLayouts=( "U.S." "British" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2643743 ;;
592 | "Australia" ) Country="AU" ; defaultKeyboardLayouts=( "U.S." "Australian" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2172517 ;;
593 | "New Zealand" ) Country="NZ" ; defaultKeyboardLayouts=( "U.S." "Australian" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2179537 ;;
594 | "Ireland" ) Country="IE" ; defaultKeyboardLayouts=( "U.S." "British" "Irish" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2964574 ;;
595 | "Afghanistan" ) Country="AF" ; defaultKeyboardLayouts=( "U.S." "Afghan Dari" "Afghan Pashto" "Afghan Uzbek " ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1138958 ;;
596 | "Albania" ) Country="AL" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3183875 ;;
597 | "Algeria" ) Country="DZ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2507480 ;;
598 | "American Samoa" ) Country="AS" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5881576 ;;
599 | "Andorra" ) Country="AD" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3041563 ;;
600 | "Angola" ) Country="AO" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2240449 ;;
601 | "Anguilla" ) Country="AI" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3573374 ;;
602 | "Antarctica" ) Country="AQ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
603 | "Antigua and Barbuda" ) Country="AG" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3576022 ;;
604 | "Argentina" ) Country="AR" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3435910 ;;
605 | "Armenia" ) Country="AM" ; defaultKeyboardLayouts=( "U.S." "Armenian - HM QWERTY" "Armenian - Western QWERTY" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=616052 ;;
606 | "Aruba" ) Country="AW" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3577154 ;;
607 | "Austria" ) Country="AT" ; defaultKeyboardLayouts=( "U.S." "Austrian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2761369 ;;
608 | "Azerbaijan" ) Country="AZ" ; defaultKeyboardLayouts=( "U.S." "Azeri" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=587084 ;;
609 | "Bahamas" ) Country="BS" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3571824 ;;
610 | "Bahrain" ) Country="BH" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=290340 ;;
611 | "Bangladesh" ) Country="BD" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1185241 ;;
612 | "Barbados" ) Country="BB" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3374036 ;;
613 | "Belarus" ) Country="BY" ; defaultKeyboardLayouts=( "U.S." "Byelorussian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=625144 ;;
614 | "Belgium" ) Country="BE" ; defaultKeyboardLayouts=( "U.S." "Belgian" "French" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2800866 ;;
615 | "Belize" ) Country="BZ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3582672 ;;
616 | "Benin" ) Country="BJ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2392087 ;;
617 | "Bermuda" ) Country="BM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3573197 ;;
618 | "Bhutan" ) Country="BT" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1252416 ;;
619 | "Bolivia" ) Country="BO" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3911925 ;;
620 | "Bosnia and Herzegovina" ) Country="BA" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3191281 ;;
621 | "Botswana" ) Country="BW" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=933773 ;;
622 | "Bouvet Island" ) Country="BV" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
623 | "Brazil" ) Country="BR" ; defaultKeyboardLayouts=( "U.S." "Brazilian" "U.S. International - PC" ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3469058 ;;
624 | "British Indian Ocean Territory" ) Country="IO" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
625 | "British Virgin Islands" ) Country="VG" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3577430 ;;
626 | "Brunei" ) Country="BN" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1820906 ;;
627 | "Bulgaria" ) Country="BG" ; defaultKeyboardLayouts=( "U.S." "Bulgarian" "Bulgarian - Phonetic" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=727011 ;;
628 | "Burkina Faso" ) Country="BF" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2357048 ;;
629 | "Burundi" ) Country="BI" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=425378 ;;
630 | "Cambodia" ) Country="KH" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1821306 ;;
631 | "Cameroon" ) Country="CM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2220957 ;;
632 | "Cape Verde" ) Country="CV" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3374333 ;;
633 | "Cayman Islands" ) Country="KY" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3580661 ;;
634 | "Central African Republic" ) Country="CF" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2389853 ;;
635 | "Chad" ) Country="TD" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2427123 ;;
636 | "Chile" ) Country="CL" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3871336 ;;
637 | "China" ) Country="CN" ; defaultKeyboardLayouts=( "U.S." "Chinese - Simplified" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1816670 ;;
638 | "Christmas Island" ) Country="CX" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2078127 ;;
639 | "Cocos Islands" ) Country="CC" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
640 | "Cocos [Keeling] Islands" ) Country="CC" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
641 | "Colombia" ) Country="CO" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3688689 ;;
642 | "Comoros" ) Country="KM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=921772 ;;
643 | "Congo - Brazzaville" ) Country="CG" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2260535 ;;
644 | "Congo - Kinshasa" ) Country="CD" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2314302 ;;
645 | "Cook Islands" ) Country="CK" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=4035715 ;;
646 | "Costa Rica" ) Country="CR" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3621849 ;;
647 | "Côte d'Ivoire" ) Country="CI" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2279755 ;;
648 | "Croatia" ) Country="HR" ; defaultKeyboardLayouts=( "U.S." "Croatian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3186886 ;;
649 | "Cyprus" ) Country="CY" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=146268 ;;
650 | "Czech Republic" ) Country="CZ" ; defaultKeyboardLayouts=( "U.S." "Czech - QWERTY" "Czech" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3067696 ;;
651 | "Denmark" ) Country="DK" ; defaultKeyboardLayouts=( "U.S." "Danish" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2618425 ;;
652 | "Djibouti" ) Country="DJ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=223817 ;;
653 | "Dominica" ) Country="DM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3575635 ;;
654 | "Dominican Republic" ) Country="DO" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3492908 ;;
655 | "Ecuador" ) Country="EC" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3652462 ;;
656 | "Egypt" ) Country="EG" ; defaultKeyboardLayouts=( "U.S." "Arabic" "Arabic - PC" "Arabic - QWERTY" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=360630 ;;
657 | "El Salvador" ) Country="SV" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3583361 ;;
658 | "Equatorial Guinea" ) Country="GQ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2309527 ;;
659 | "Eritrea" ) Country="ER" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=343300 ;;
660 | "Estonia" ) Country="EE" ; defaultKeyboardLayouts=( "U.S." "Estonian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=588409 ;;
661 | "Ethiopia" ) Country="ET" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=344979 ;;
662 | "Falkland Islands" ) Country="FK" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3426691 ;;
663 | "Faroe Islands" ) Country="FO" ; defaultKeyboardLayouts=( "U.S." "Faroese" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2611396 ;;
664 | "Fiji" ) Country="FJ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2198148 ;;
665 | "Finland" ) Country="FI" ; defaultKeyboardLayouts=( "U.S." "Finnish" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=658225 ;;
666 | "France" ) Country="FR" ; defaultKeyboardLayouts=( "U.S." "French" "French - Numerical" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2988507 ;;
667 | "French Guiana" ) Country="GF" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3382160 ;;
668 | "French Polynesia" ) Country="PF" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=4033936 ;;
669 | "French Southern Territories" ) Country="TF" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
670 | "Gabon" ) Country="GA" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2399697 ;;
671 | "Gambia" ) Country="GM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2413876 ;;
672 | "Georgia" ) Country="GE" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=611717 ;;
673 | "Germany" ) Country="DE" ; defaultKeyboardLayouts=( "U.S." "German" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2950159 ;;
674 | "Ghana" ) Country="GH" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2306104 ;;
675 | "Gibraltar" ) Country="GI" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2411585 ;;
676 | "Greece" ) Country="GR" ; defaultKeyboardLayouts=( "U.S." "Greek" "Greek Polytonic" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=264371 ;;
677 | "Greenland" ) Country="GL" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3421319 ;;
678 | "Grenada" ) Country="GD" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3579925 ;;
679 | "Guadeloupe" ) Country="GP" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3579732 ;;
680 | "Guam" ) Country="GU" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=4044012 ;;
681 | "Guatemala" ) Country="GT" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3598132 ;;
682 | "Guinea" ) Country="GN" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2422465 ;;
683 | "Guinea-Bissau" ) Country="GW" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2374775 ;;
684 | "Guyana" ) Country="GY" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3378644 ;;
685 | "Haiti" ) Country="HT" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3718426 ;;
686 | "Heard Island and McDonald Islands" ) Country="HM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
687 | "Honduras" ) Country="HN" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3600949 ;;
688 | "Hong Kong SAR China" ) Country="HK" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1819729 ;;
689 | "Hungary" ) Country="HU" ; defaultKeyboardLayouts=( "U.S." "Hungarian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3054643 ;;
690 | "Iceland" ) Country="IS" ; defaultKeyboardLayouts=( "U.S." "Icelandic" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3413829 ;;
691 | "India" ) Country="IN" ; defaultKeyboardLayouts=( "U.S." "Devanagari" "Devanagari - QWERTY" "Gurmukhi" "Gurmukhi -QWERTY" "Gujarati" "Gujarati - QWERTY" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1261481 ;;
692 | "Indonesia" ) Country="ID" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1642911 ;;
693 | "Iraq" ) Country="IQ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=98182 ;;
694 | "Israel" ) Country="IL" ; defaultKeyboardLayouts=( "U.S." "Hebrew" "Hebrew - QWERTY" ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
695 | "Italy" ) Country="IT" ; defaultKeyboardLayouts=( "U.S." "Italian - Pro" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3169070 ;;
696 | "Ivory Coast" ) Country="CI" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2279755 ;;
697 | "Jamaica" ) Country="JM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3489854 ;;
698 | "Japan" ) Country="JP" ; defaultKeyboardLayouts=( "U.S." "Kotoeri" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1850147 ;;
699 | "Jordan" ) Country="JO" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=250441 ;;
700 | "Kazakhstan" ) Country="KZ" ; defaultKeyboardLayouts=( "U.S." "Kazakh" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1526273 ;;
701 | "Kenya" ) Country="KE" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=184745 ;;
702 | "Kiribati" ) Country="KI" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2110257 ;;
703 | "Kuwait" ) Country="KW" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=285787 ;;
704 | "Kyrgyzstan" ) Country="KG" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1528675 ;;
705 | "Laos" ) Country="LA" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1651944 ;;
706 | "Latvia" ) Country="LV" ; defaultKeyboardLayouts=( "U.S." "Latvian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=456172 ;;
707 | "Lebanon" ) Country="LB" ; defaultKeyboardLayouts=( "U.S." "Arabic" "Arabic - PC" "Arabic - QWERTY" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=276781 ;;
708 | "Lesotho" ) Country="LS" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=932505 ;;
709 | "Liberia" ) Country="LR" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2274895 ;;
710 | "Liechtenstein" ) Country="LI" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3042030 ;;
711 | "Lithuania" ) Country="LT" ; defaultKeyboardLayouts=( "U.S." "Lithuanian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=593116 ;;
712 | "Luxembourg" ) Country="LU" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2960316 ;;
713 | "Macau SAR China" ) Country="MO" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1821274 ;;
714 | "Macedonia" ) Country="MK" ; defaultKeyboardLayouts=( "U.S." "Macedonian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=785842 ;;
715 | "Madagascar" ) Country="MG" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=1070940 ;;
716 | "Malawi" ) Country="MW" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=927967 ;;
717 | "Malaysia" ) Country="MY" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1735161 ;;
718 | "Maldives" ) Country="MV" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1282027 ;;
719 | "Mali" ) Country="ML" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2460596 ;;
720 | "Malta" ) Country="MT" ; defaultKeyboardLayouts=( "U.S." "Maltese" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2562305 ;;
721 | "Marshall Islands" ) Country="MH" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2113779 ;;
722 | "Martinique" ) Country="MQ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3570675 ;;
723 | "Mauritania" ) Country="MR" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2377450 ;;
724 | "Mauritius" ) Country="MU" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=934154 ;;
725 | "Mayotte" ) Country="YT" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=921815 ;;
726 | "Mexico" ) Country="MX" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3530597 ;;
727 | "Micronesia" ) Country="FM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2081986 ;;
728 | "Moldova" ) Country="MD" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=618426 ;;
729 | "Monaco" ) Country="MC" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2993458 ;;
730 | "Mongolia" ) Country="MN" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2028462 ;;
731 | "Montenegro" ) Country="ME" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3193044 ;;
732 | "Montserrat" ) Country="MS" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3578069 ;;
733 | "Morocco" ) Country="MA" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2538475 ;;
734 | "Mozambique" ) Country="MZ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=1040652 ;;
735 | "Myanmar" ) Country="MM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1298824 ;;
736 | "Myanmar [Burma]" ) Country="MM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1298824 ;;
737 | "Namibia" ) Country="NA" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3352136 ;;
738 | "Nauru" ) Country="NR" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
739 | "Nepal" ) Country="NP" ; defaultKeyboardLayouts=( "U.S." "Nepali" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1283240 ;;
740 | "Netherlands" ) Country="NL" ; defaultKeyboardLayouts=( "U.S." "Dutch" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2759794 ;;
741 | "Netherlands Antilles" ) Country="AN" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3513090 ;;
742 | "New Caledonia" ) Country="NC" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2139521 ;;
743 | "Nicaragua" ) Country="NI" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3617763 ;;
744 | "Niger" ) Country="NE" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2440485 ;;
745 | "Nigeria" ) Country="NG" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2352778 ;;
746 | "Niue" ) Country="NU" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=4036284 ;;
747 | "Norfolk Island" ) Country="NF" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2161314 ;;
748 | "Northern Mariana Islands" ) Country="MP" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
749 | "Norway" ) Country="NO" ; defaultKeyboardLayouts=( "U.S." "Norwegian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3143244 ;;
750 | "Oman" ) Country="OM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=287286 ;;
751 | "Pakistan" ) Country="PK" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1176615 ;;
752 | "Palau" ) Country="PW" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1559446 ;;
753 | "Palestinian Territory" ) Country="PS" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
754 | "Palestinian Territories" ) Country="PS" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
755 | "Panama" ) Country="PA" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3703443 ;;
756 | "Papua New Guinea" ) Country="PG" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2088122 ;;
757 | "Paraguay" ) Country="PY" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3439389 ;;
758 | "Peru" ) Country="PE" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3936456 ;;
759 | "Philippines" ) Country="PH" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1701668 ;;
760 | "Pitcairn" ) Country="PN" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=4030723 ;;
761 | "Pitcairn Islands" ) Country="PN" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=4030723 ;;
762 | "Poland" ) Country="PL" ; defaultKeyboardLayouts=( "U.S." "Polish Pro" "Polish" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=756135 ;;
763 | "Portugal" ) Country="PT" ; defaultKeyboardLayouts=( "U.S." "Portuguese" "Brazilian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2267057 ;;
764 | "Puerto Rico" ) Country="PR" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=4568127 ;;
765 | "Qatar" ) Country="QA" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=290030 ;;
766 | "Reunion" ) Country="RE" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=935264 ;;
767 | "Réunion" ) Country="RE" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=935264 ;;
768 | "Romania" ) Country="RO" ; defaultKeyboardLayouts=( "U.S." "Romanian - Standard" "Romanian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=683506 ;;
769 | "Russia" ) Country="RU" ; defaultKeyboardLayouts=( "U.S." "Russian" "Russian - Phonetic" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=524901 ;;
770 | "Rwanda" ) Country="RW" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=202061 ;;
771 | "Saint Helena" ) Country="SH" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3370903 ;;
772 | "Saint Kitts and Nevis" ) Country="KN" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3575551 ;;
773 | "Saint Lucia" ) Country="LC" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3576812 ;;
774 | "Saint Pierre and Miquelon" ) Country="PM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3424934 ;;
775 | "Saint Vincent and the Grenadines" ) Country="VC" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3577887 ;;
776 | "Samoa" ) Country="WS" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=4035413 ;;
777 | "San Marino" ) Country="SM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3168070 ;;
778 | "Sao Tome and Principe" ) Country="ST" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2410763 ;;
779 | "São Tomé and Príncipe" ) Country="ST" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2410763 ;;
780 | "Saudi Arabia" ) Country="SA" ; defaultKeyboardLayouts=( "U.S." "Arabic" "Arabic - PC" "Arabic - QWERTY" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=108410 ;;
781 | "Senegal" ) Country="SN" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2253354 ;;
782 | "Serbia" ) Country="RS" ; defaultKeyboardLayouts=( "U.S." "Serbian" "Serbian - Latin" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=792680 ;;
783 | "Seychelles" ) Country="SC" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=241131 ;;
784 | "Sierra Leone" ) Country="SL" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2409306 ;;
785 | "Singapore" ) Country="SG" ; defaultKeyboardLayouts=( "U.S." "Chinese - Simplified" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1880252 ;;
786 | "Slovakia" ) Country="SK" ; defaultKeyboardLayouts=( "U.S." "Slovak" "Slovak - QWERTY" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3060972 ;;
787 | "Slovenia" ) Country="SI" ; defaultKeyboardLayouts=( "U.S." "Slovenian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3196359 ;;
788 | "Solomon Islands" ) Country="SB" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2108502 ;;
789 | "Somalia" ) Country="SO" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=53654 ;;
790 | "South Africa" ) Country="ZA" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=964137 ;;
791 | "South Georgia and the South Sandwich Islands" ) Country="GS" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3426466 ;;
792 | "South Korea" ) Country="KR" ; defaultKeyboardLayouts=( "U.S." "Hangul" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1835848 ;;
793 | "Spain" ) Country="ES" ; defaultKeyboardLayouts=( "U.S." "Spanish - ISO" "Spanish" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=3117735 ;;
794 | "Sri Lanka" ) Country="LK" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1248991 ;;
795 | "Suriname" ) Country="SR" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3383330 ;;
796 | "Svalbard and Jan Mayen" ) Country="SJ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2729907 ;;
797 | "Swaziland" ) Country="SZ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=934985 ;;
798 | "Sweden" ) Country="SE" ; defaultKeyboardLayouts=( "U.S." "Swedish - Pro" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2673730 ;;
799 | "Switzerland" ) Country="CH" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2661552 ;;
800 | "Taiwan" ) Country="TW" ; defaultKeyboardLayouts=( "U.S." "Chinese - Traditional" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1668341 ;;
801 | "Tajikistan" ) Country="TJ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1221874 ;;
802 | "Tanzania" ) Country="TZ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=160196 ;;
803 | "Thailand" ) Country="TH" ; defaultKeyboardLayouts=( "U.S." "Thai" "Thai - PattaChote" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1609350 ;;
804 | "Togo" ) Country="TG" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2365267 ;;
805 | "Tokelau" ) Country="TK" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
806 | "Tonga" ) Country="TO" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=4032402 ;;
807 | "Trinidad and Tobago" ) Country="TT" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3573890 ;;
808 | "Tunisia" ) Country="TN" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=2464470 ;;
809 | "Turkey" ) Country="TR" ; defaultKeyboardLayouts=( "U.S." "Turkish" "Turkish - QWERTY" "Turkish - QWERTY PC" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=323786 ;;
810 | "Turkmenistan" ) Country="TM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=162183 ;;
811 | "Turks and Caicos Islands" ) Country="TC" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3576994 ;;
812 | "Tuvalu" ) Country="TV" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2110394 ;;
813 | "U.S. Minor Outlying Islands" ) Country="UM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
814 | "U.S. Virgin Islands" ) Country="VI" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
815 | "Uganda" ) Country="UG" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=232422 ;;
816 | "Ukraine" ) Country="UA" ; defaultKeyboardLayouts=( "U.S." "Ukrainian" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=703448 ;;
817 | "United Arab Emirates" ) Country="AE" ; defaultKeyboardLayouts=( "U.S." "Arabic" "Arabic - PC" "Arabic - QWERTY" ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=292968 ;;
818 | "United States Minor Outlying Islands" ) Country="UM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
819 | "Uruguay" ) Country="UY" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3441575 ;;
820 | "Uzbekistan" ) Country="UZ" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1512569 ;;
821 | "Vanuatu" ) Country="VU" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=2135171 ;;
822 | "Vatican" ) Country="VA" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=6691831 ;;
823 | "Vatican City" ) Country="VA" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=6691831 ;;
824 | "Venezuela" ) Country="VE" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=3646738 ;;
825 | "Vietnam" ) Country="VN" ; defaultKeyboardLayouts=( "U.S." "Vietnamese" ) ; defaultNTPServer="time.asia.apple.com" ; defaultGeonameID=1581130 ;;
826 | "Wallis and Futuna" ) Country="WF" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
827 | "Western Sahara" ) Country="EH" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.apple.com" ; defaultGeonameID=5341145 ;;
828 | "Yemen" ) Country="YE" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=71137 ;;
829 | "Zambia" ) Country="ZM" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=909137 ;;
830 | "Zimbabwe" ) Country="ZW" ; defaultKeyboardLayouts=( "U.S." ) ; defaultNTPServer="time.euro.apple.com" ; defaultGeonameID=890299 ;;
831 | esac
832 | defaultKeyboardLayouts=( "${defaultKeyboardLayouts[@]}" "Show All" )
833 | AppleLocale="${AppleLanguage}_${Country}"
834 | }
835 |
836 | function get_CountryName {
837 | prefCountryName=`defaults read ~/Library/Preferences/au.com.mondada.SIC "CountryName" 2>/dev/null`
838 | if [ -z "${prefCountryName}" ] ; then prefCountryName=`/usr/libexec/PlistBuddy -c "Print ':Address:CountryName'" "/var/db/.AppleSetupDone" 2>/dev/null` ; fi
839 | if [ -n "${prefCountryName}" ] ; then CountryName="${prefCountryName}" ; fi
840 | echo "CountryName: ${CountryName}"
841 | set_Country "${CountryName}"
842 | }
843 |
844 | function save_CountryName {
845 | defaults write ~/Library/Preferences/au.com.mondada.SIC "CountryName" -string "${CountryName}"
846 | }
847 |
848 | function display_CountryName {
849 | echo "Country Name: ${CountryName}"
850 | }
851 |
852 | function select_CountryName {
853 | CountryNames=( "${defaultCountryNames[@]}" "Show All" )
854 | display_Title "Select Country"
855 | display_CountryName
856 | display_Options "Countries" "Select the country or region you wish to use: "
857 | select newCountryName in "${CountryNames[@]}" ; do
858 | while [ "${newCountryName}" == "Show All" ] ; do
859 | if [ -n "${targDisk}" ] ; then
860 | osMinorVersion=`defaults read "/Volumes/${targDisk}/System/Library/CoreServices/SystemVersion" ProductVersion | awk -F "." '{print $2}'`
861 | else
862 | osMinorVersion=`defaults read "/System/Library/CoreServices/SystemVersion" ProductVersion | awk -F "." '{print $2}'`
863 | fi
864 | case ${osMinorVersion} in
865 | 7 ) allCountryNames=( "United States" "Canada" "United Kingdom" "Australia" "New Zealand" "Ireland" "Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" "Angola" "Anguilla" "Antarctica" "Antigua and Barbuda" "Argentina" "Armenia" "Aruba" "Austria" "Azerbaijan" "Bahamas" "Bahrain" "Bangladesh" "Barbados" "Belarus" "Belgium" "Belize" "Benin" "Bermuda" "Bhutan" "Bolivia" "Bosnia and Herzegovina" "Botswana" "Bouvet Island" "Brazil" "British Indian Ocean Territory" "British Virgin Islands" "Brunei" "Bulgaria" "Burkina Faso" "Burundi" "Cambodia" "Cameroon" "Cape Verde" "Cayman Islands" "Central African Republic" "Chad" "Chile" "China" "Christmas Island" "Cocos [Keeling] Islands" "Colombia" "Comoros" "Congo - Brazzaville" "Congo - Kinshasa" "Cook Islands" "Costa Rica" "Côte d'Ivoire" "Croatia" "Cyprus" "Czech Republic" "Denmark" "Djibouti" "Dominica" "Dominican Republic" "Ecuador" "Egypt" "El Salvador" "Equatorial Guinea" "Eritrea" "Estonia" "Ethiopia" "Falkland Islands" "Faroe Islands" "Fiji" "Finland" "France" "French Guiana" "French Polynesia" "French Southern Territories" "Gabon" "Gambia" "Georgia" "Germany" "Ghana" "Gibraltar" "Greece" "Greenland" "Grenada" "Guadeloupe" "Guam" "Guatemala" "Guinea" "Guinea-Bissau" "Guyana" "Haiti" "Heard Island and McDonald Islands" "Honduras" "Hong Kong SAR China" "Hungary" "Iceland" "India" "Indonesia" "Iraq" "Israel" "Italy" "Jamaica" "Japan" "Jordan" "Kazakhstan" "Kenya" "Kiribati" "Kuwait" "Kyrgyzstan" "Laos" "Latvia" "Lebanon" "Lesotho" "Liberia" "Liechtenstein" "Lithuania" "Luxembourg" "Macau SAR China" "Macedonia" "Madagascar" "Malawi" "Malaysia" "Maldives" "Mali" "Malta" "Marshall Islands" "Martinique" "Mauritania" "Mauritius" "Mayotte" "Mexico" "Micronesia" "Moldova" "Monaco" "Mongolia" "Montenegro" "Montserrat" "Morocco" "Mozambique" "Myanmar [Burma]" "Namibia" "Nauru" "Nepal" "Netherlands" "Netherlands Antilles" "New Caledonia" "Nicaragua" "Niger" "Nigeria" "Niue" "Norfolk Island" "Northern Mariana Islands" "Norway" "Oman" "Pakistan" "Palau" "Palestinian Territories" "Panama" "Papua New Guinea" "Paraguay" "Peru" "Philippines" "Pitcairn Islands" "Poland" "Portugal" "Puerto Rico" "Qatar" "Réunion" "Romania" "Russia" "Rwanda" "Saint Helena" "Saint Kitts and Nevis" "Saint Lucia" "Saint Pierre and Miquelon" "Saint Vincent and the Grenadines" "Samoa" "San Marino" "São Tomé and Príncipe" "Saudi Arabia" "Senegal" "Serbia" "Seychelles" "Sierra Leone" "Singapore" "Slovakia" "Slovenia" "Solomon Islands" "Somalia" "South Africa" "South Georgia and the South Sandwich Islands" "South Korea" "Spain" "Sri Lanka" "Suriname" "Svalbard and Jan Mayen" "Swaziland" "Sweden" "Switzerland" "Taiwan" "Tajikistan" "Tanzania" "Thailand" "Togo" "Tokelau" "Tonga" "Trinidad and Tobago" "Tunisia" "Turkey" "Turkmenistan" "Turks and Caicos Islands" "Tuvalu" "U.S. Minor Outlying Islands" "U.S. Virgin Islands" "Uganda" "Ukraine" "United Arab Emirates" "Uruguay" "Uzbekistan" "Vanuatu" "Vatican City" "Venezuela" "Vietnam" "Wallis and Futuna" "Western Sahara" "Yemen" "Zambia" "Zimbabwe" ) ;;
866 | * ) allCountryNames=( "United States" "Canada" "United Kingdom" "Australia" "New Zealand" "Ireland" "Afghanistan" "Albania" "Algeria" "American Samoa" "Andorra" "Angola" "Anguilla" "Antarctica" "Antigua and Barbuda" "Argentina" "Armenia" "Aruba" "Austria" "Azerbaijan" "Bahamas" "Bahrain" "Bangladesh" "Barbados" "Belarus" "Belgium" "Belize" "Benin" "Bermuda" "Bhutan" "Bolivia" "Bosnia and Herzegovina" "Botswana" "Bouvet Island" "Brazil" "British Indian Ocean Territory" "British Virgin Islands" "Brunei" "Bulgaria" "Burkina Faso" "Burundi" "Cambodia" "Cameroon" "Cape Verde" "Cayman Islands" "Central African Republic" "Chad" "Chile" "China" "Christmas Island" "Cocos Islands" "Colombia" "Comoros" "Congo - Brazzaville" "Congo - Kinshasa" "Cook Islands" "Costa Rica" "Croatia" "Cyprus" "Czech Republic" "Denmark" "Djibouti" "Dominica" "Dominican Republic" "Ecuador" "Egypt" "El Salvador" "Equatorial Guinea" "Eritrea" "Estonia" "Ethiopia" "Falkland Islands" "Faroe Islands" "Fiji" "Finland" "France" "French Guiana" "French Polynesia" "French Southern Territories" "Gabon" "Gambia" "Georgia" "Germany" "Ghana" "Gibraltar" "Greece" "Greenland" "Grenada" "Guadeloupe" "Guam" "Guatemala" "Guinea" "Guinea-Bissau" "Guyana" "Haiti" "Heard Island and McDonald Islands" "Honduras" "Hong Kong SAR China" "Hungary" "Iceland" "India" "Indonesia" "Iraq" "Israel" "Italy" "Ivory Coast" "Jamaica" "Japan" "Jordan" "Kazakhstan" "Kenya" "Kiribati" "Kuwait" "Kyrgyzstan" "Laos" "Latvia" "Lebanon" "Lesotho" "Liberia" "Liechtenstein" "Lithuania" "Luxembourg" "Macau SAR China" "Macedonia" "Madagascar" "Malawi" "Malaysia" "Maldives" "Mali" "Malta" "Marshall Islands" "Martinique" "Mauritania" "Mauritius" "Mayotte" "Mexico" "Micronesia" "Moldova" "Monaco" "Mongolia" "Montserrat" "Morocco" "Mozambique" "Myanmar" "Namibia" "Nauru" "Nepal" "Netherlands" "Netherlands Antilles" "New Caledonia" "Nicaragua" "Niger" "Nigeria" "Niue" "Norfolk Island" "Northern Mariana Islands" "Norway" "Oman" "Pakistan" "Palau" "Palestinian Territory" "Panama" "Papua New Guinea" "Paraguay" "Peru" "Philippines" "Pitcairn" "Poland" "Portugal" "Puerto Rico" "Qatar" "Reunion" "Romania" "Russia" "Rwanda" "Saint Helena" "Saint Kitts and Nevis" "Saint Lucia" "Saint Pierre and Miquelon" "Saint Vincent and the Grenadines" "Samoa" "San Marino" "Sao Tome and Principe" "Saudi Arabia" "Senegal" "Seychelles" "Sierra Leone" "Singapore" "Slovakia" "Slovenia" "Solomon Islands" "Somalia" "South Africa" "South Georgia and the South Sandwich Islands" "South Korea" "Spain" "Sri Lanka" "Suriname" "Svalbard and Jan Mayen" "Swaziland" "Sweden" "Switzerland" "Taiwan" "Tajikistan" "Tanzania" "Thailand" "Togo" "Tokelau" "Tonga" "Trinidad and Tobago" "Tunisia" "Turkey" "Turkmenistan" "Turks and Caicos Islands" "Tuvalu" "U.S. Virgin Islands" "Uganda" "Ukraine" "United Arab Emirates" "United States Minor Outlying Islands" "Uruguay" "Uzbekistan" "Vanuatu" "Vatican" "Venezuela" "Vietnam" "Wallis and Futuna" "Western Sahara" "Yemen" "Zambia" "Zimbabwe" ) ;;
867 | esac
868 | CountryNames=( "${defaultCountryNames[@]}" )
869 | for Element in "${allCountryNames[@]}" ; do
870 | addCountryName=1
871 | for defaultCountryName in "${defaultCountryNames[@]}" ; do if [ "${Element}" == "${defaultCountryName}" ] ; then addCountryName=0 ; break ; fi ; done
872 | if [ ${addCountryName} -eq 1 ] ; then CountryNames=( "${CountryNames[@]}" "${Element}" ) ; fi
873 | done
874 | display_Title "Select Country"
875 | display_CountryName
876 | display_Options "Countries" "Select the country or region you wish to use: "
877 | select newCountryName in "${CountryNames[@]}" ; do
878 | if [ -n "${newCountryName}" ] ; then break ; fi
879 | done
880 | done
881 | if [ -n "${newCountryName}" ] ; then break ; fi
882 | done
883 | CountryName="${newCountryName}" ; newCountryName=""
884 | set_Country "${CountryName}"
885 | }
886 |
887 | function set_InputSources {
888 | unset TypingStyles[@]
889 | unset BundleIDs[@]
890 | unset InputModes[@]
891 | unset InputSourceKinds[@]
892 | unset KeyboardLayoutIDs[@]
893 | unset KeyboardLayoutNames[@]
894 | case "${1}" in
895 | "U.S." ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.US" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=0 ; KeyboardLayoutNames[0]="U.S." ;;
896 | "Afghan Dari" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.AfghanDari" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-2902 ; KeyboardLayoutNames[0]="Afghan Dari" ;;
897 | "Afghan Pashto" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.AfghanPashto" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-2904 ; KeyboardLayoutNames[0]="Afghan Pashto" ;;
898 | "Afghan Uzbek" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.AfghanUzbek" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-2903 ; KeyboardLayoutNames[0]="Afghan Uzbek" ;;
899 | "Arabic" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Arabic" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-17920 ; KeyboardLayoutNames[0]="Arabic" ;;
900 | "Arabic - PC" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.ArabicPC" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-17921 ; KeyboardLayoutNames[0]="Arabic PC" ;;
901 | "Arabic - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Arabic-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-18000 ; KeyboardLayoutNames[0]="Arabic-QWERTY" ;;
902 | "Armenian - HM QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Armenian-HMQWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-28161 ; KeyboardLayoutNames[0]="Armenian-HM QWERTY" ;;
903 | "Armenian - Western QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Armenian-WesternQWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-28164 ; KeyboardLayoutNames[0]="Armenian-Western QWERTY" ;;
904 | "Australian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Australian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=15 ; KeyboardLayoutNames[0]="Australian" ;;
905 | "Austrian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Austrian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=92 ; KeyboardLayoutNames[0]="Austrian" ;;
906 | "Azeri" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Azeri" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-49 ; KeyboardLayoutNames[0]="Azeri" ;;
907 | "Belgian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Belgian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=6 ; KeyboardLayoutNames[0]="Belgian" ;;
908 | "Brazilian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Brazilian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=71 ; KeyboardLayoutNames[0]="Brazilian" ;;
909 | "British" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.British" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=2 ; KeyboardLayoutNames[0]="British" ;;
910 | "Bulgarian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Bulgarian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=19528 ; KeyboardLayoutNames[0]="Bulgarian" ;;
911 | "Bulgarian - Phonetic" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Bulgarian-Phonetic" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=19529 ; KeyboardLayoutNames[0]="Bulgarian - Phonetic" ;;
912 | "Byelorussian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Byelorussian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=19517 ; KeyboardLayoutNames[0]="Byelorussian" ;;
913 | "Canadian English" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Canadian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=29 ; KeyboardLayoutNames[0]="Canadian" ;;
914 | "Canadian French - CSA" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Canadian-CSA" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=80 ; KeyboardLayoutNames[0]="Canadian - CSA" ;;
915 | "Cherokee - Nation" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Cherokee-Nation" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-26112 ; KeyboardLayoutNames[0]="Cherokee-Nation" ;;
916 | "Cherokee - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Cherokee-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-26113 ; KeyboardLayoutNames[0]="Cherokee-QWERTY" ;;
917 | "Chinese - Simplified" ) TypingStyles=( "Pinyin - Simplified" "Wubi Hua" "Wubi Xing" ) ; AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.US" ; AppleDefaultAsciiInputSource=0 ;;
918 | "Chinese - Traditional" ) TypingStyles=( "Zhuyin" "Cangjie" "Dayi Pro" "Jianyi" "Pinyin - Traditional" ) ; AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.US" ; AppleDefaultAsciiInputSource=0 ;;
919 | "Croatian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Croatian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-68 ; KeyboardLayoutNames[0]="Croatian" ;;
920 | "Croatian - PC" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Croatian-PC" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-69 ; KeyboardLayoutNames[0]="Croatian-PC" ;;
921 | "Czech" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Czech" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=30776 ; KeyboardLayoutNames[0]="Czech" ;;
922 | "Czech - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Czech-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=30778 ; KeyboardLayoutNames[0]="Czech-QWERTY" ;;
923 | "Danish" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Danish" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=9 ; KeyboardLayoutNames[0]="Danish" ;;
924 | "Devanagari" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Devanagari" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-20480 ; KeyboardLayoutNames[0]="Devanagari" ;;
925 | "Devanagari - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Devanagari-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-20481 ; KeyboardLayoutNames[0]="Devanagari-QWERTY" ;;
926 | "Dutch" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Dutch" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=26 ; KeyboardLayoutNames[0]="Dutch" ;;
927 | "Dvorak" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Dvorak" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=16300 ; KeyboardLayoutNames[0]="Dvorak" ;;
928 | "Dvorak - Left" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Dvorak-Left" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=16302 ; KeyboardLayoutNames[0]="Dvorak - Left" ;;
929 | "Dvorak - Qwerty ⌘" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.DVORAK-QWERTYCMD" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=16301 ; KeyboardLayoutNames[0]="DVORAK - QWERTY CMD" ;;
930 | "Dvorak - Right" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Dvorak-Right" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=16303 ; KeyboardLayoutNames[0]="Dvorak - Right" ;;
931 | "Estonian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Estonian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=30764 ; KeyboardLayoutNames[0]="Estonian" ;;
932 | "Faroese" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Faroese" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-47 ; KeyboardLayoutNames[0]="Faroese" ;;
933 | "Finnish" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Finnish" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=17 ; KeyboardLayoutNames[0]="Finnish" ;;
934 | "Finnish Extended" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.FinnishExtended" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-17 ; KeyboardLayoutNames[0]="Finnish Extended" ;;
935 | "Finnish Sami - PC" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.FinnishSami-PC" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-18 ; KeyboardLayoutNames[0]="FinnishSami-PC" ;;
936 | "French" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.French" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=1 ; KeyboardLayoutNames[0]="French" ;;
937 | "French - Numerical" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.French-numerical" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=1111 ; KeyboardLayoutNames[0]="French - numerical" ;;
938 | "German" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.German" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=3 ; KeyboardLayoutNames[0]="German" ;;
939 | "Greek" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Greek" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-18944 ; KeyboardLayoutNames[0]="Greek" ;;
940 | "Greek Polytonic" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.GreekPolytonic" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-18945 ; KeyboardLayoutNames[0]="Greek Polytonic" ;;
941 | "Gujarati" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Gujarati" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-21504 ; KeyboardLayoutNames[0]="Gujarati" ;;
942 | "Gujarati - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Gujarati-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-21505 ; KeyboardLayoutNames[0]="Gujarati-QWERTY" ;;
943 | "Gurmukhi" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Gurmukhi" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-20992 ; KeyboardLayoutNames[0]="Gurmukhi" ;;
944 | "Gurmukhi - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Gurmukhi-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-20993 ; KeyboardLayoutNames[0]="Gurmukhi-QWERTY" ;;
945 | "Hangul" ) TypingStyles=( "3-Set Korean" "2-Set Korean" "HNC Romaja" "390 Sebulshik" "GongjinCheong Romaja" ) ; AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.US" ; AppleDefaultAsciiInputSource=0 ;;
946 | "Hawaiian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Hawaiian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-50 ; KeyboardLayoutNames[0]="Hawaiian" ;;
947 | "Hebrew" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Hebrew" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-18432 ; KeyboardLayoutNames[0]="Hebrew" ;;
948 | "Hebrew - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Hebrew-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-18500 ; KeyboardLayoutNames[0]="Hebrew-QWERTY" ;;
949 | "Hungarian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Hungarian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=30763 ; KeyboardLayoutNames[0]="Hungarian" ;;
950 | "Icelandic" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Icelandic" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-21 ; KeyboardLayoutNames[0]="Icelandic" ;;
951 | "Inuktitut - Nunavut" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Inuktitut-Nunavut" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-30604 ; KeyboardLayoutNames[0]="Inuktitut-Nunavut" ;;
952 | "Inuktitut - Nutaaq" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Inuktitut-Nutaaq" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-30602 ; KeyboardLayoutNames[0]="Inuktitut-Nutaaq" ;;
953 | "Inuktitut - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Inuktitut-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-30600 ; KeyboardLayoutNames[0]="Inuktitut-QWERTY" ;;
954 | "Inuttitut Nunavik" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.InuttitutNunavik" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-30603 ; KeyboardLayoutNames[0]="Inuttitut Nunavik" ;;
955 | "Irish" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Irish" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=50 ; KeyboardLayoutNames[0]="Irish" ;;
956 | "Irish Extended" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.IrishExtended" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-500 ; KeyboardLayoutNames[0]="Irish Extended" ;;
957 | "Italian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Italian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=4 ; KeyboardLayoutNames[0]="Italian" ;;
958 | "Italian - Pro" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Italian-Pro" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=223 ; KeyboardLayoutNames[0]="Italian - Pro" ;;
959 | "Jawi - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Jawi-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-19000 ; KeyboardLayoutNames[0]="Jawi-QWERTY" ;;
960 | "Kazakh" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Kazakh" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-19501 ; KeyboardLayoutNames[0]="Kazakh" ;;
961 | "Kotoeri" ) TypingStyles=( "Romaji" "Kana" ) ; AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.US" ;;
962 | "Latvian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Latvian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=30765 ; KeyboardLayoutNames[0]="Latvian" ;;
963 | "Lithuanian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Lithuanian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=30761 ; KeyboardLayoutNames[0]="Lithuanian" ;;
964 | "Macedonian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Macedonian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=19523 ; KeyboardLayoutNames[0]="Macedonian" ;;
965 | "Maltese" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Maltese" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-501 ; KeyboardLayoutNames[0]="Maltese" ;;
966 | "Maori" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Maori" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-51 ; KeyboardLayoutNames[0]="Maori" ;;
967 | "Nepali" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Nepali" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-20484 ; KeyboardLayoutNames[0]="Nepali" ;;
968 | "Northern Sami" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.NorthernSami" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-1200 ; KeyboardLayoutNames[0]="Northern Sami" ;;
969 | "Norwegian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Norwegian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=12 ; KeyboardLayoutNames[0]="Norwegian" ;;
970 | "Norwegian Extended" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.NorwegianExtended" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-12 ; KeyboardLayoutNames[0]="Norwegian Extended" ;;
971 | "Norwegian Sami - PC" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.NorwegianSami-PC" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-13 ; KeyboardLayoutNames[0]="NorwegianSami-PC" ;;
972 | "Persian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Persian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-17960 ; KeyboardLayoutNames[0]="Persian" ;;
973 | "Persian - ISIRI 2901" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Persian-ISIRI2901" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-2901 ; KeyboardLayoutNames[0]="Persian-ISIRI 2901" ;;
974 | "Persian - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Persian-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-1959 ; KeyboardLayoutNames[0]="Persian-QWERTY" ;;
975 | "Polish" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Polish" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=30762 ; KeyboardLayoutNames[0]="Polish" ;;
976 | "Polish Pro" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.PolishPro" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=30788 ; KeyboardLayoutNames[0]="Polish Pro" ;;
977 | "Portuguese" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Portuguese" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=10 ; KeyboardLayoutNames[0]="Portuguese" ;;
978 | "Romanian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Romanian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-39 ; KeyboardLayoutNames[0]="Romanian" ;;
979 | "Romanian - Standard" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Romanian-Standard" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-38 ; KeyboardLayoutNames[0]="Romanian-Standard" ;;
980 | "Russian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Russian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=19456 ; KeyboardLayoutNames[0]="Russian" ;;
981 | "Russian - PC" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.RussianWin" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=19458 ; KeyboardLayoutNames[0]="RussianWin" ;;
982 | "Russian - Phonetic" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Russian-Phonetic" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=19457 ; KeyboardLayoutNames[0]="Russian - Phonetic" ;;
983 | "Sami - PC" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Sami-PC" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-1201 ; KeyboardLayoutNames[0]="Sami-PC" ;;
984 | "Serbian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Serbian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=19521 ; KeyboardLayoutNames[0]="Serbian" ;;
985 | "Serbian - Latin" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Serbian-Latin" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-19521 ; KeyboardLayoutNames[0]="Serbian-Latin" ;;
986 | "Slovak" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Slovak" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=30777 ; KeyboardLayoutNames[0]="Slovak" ;;
987 | "Slovak - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Slovak-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=30779 ; KeyboardLayoutNames[0]="Slovak-QWERTY" ;;
988 | "Slovenian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Slovenian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-66 ; KeyboardLayoutNames[0]="Slovenian" ;;
989 | "Spanish" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Spanish" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=8 ; KeyboardLayoutNames[0]="Spanish" ;;
990 | "Spanish - ISO" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Spanish-ISO" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=87 ; KeyboardLayoutNames[0]="Spanish - ISO" ;;
991 | "Swedish" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Swedish" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=224 ; KeyboardLayoutNames[0]="Swedish" ;;
992 | "Swedish - Pro" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Swedish-Pro" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=7 ; KeyboardLayoutNames[0]="Swedish - Pro" ;;
993 | "Swedish Sami - PC" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.SwedishSami-PC" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-15 ; KeyboardLayoutNames[0]="SwedishSami-PC" ;;
994 | "Swiss French" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.SwissFrench" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=18 ; KeyboardLayoutNames[0]="Swiss French" ;;
995 | "Swiss German" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.SwissGerman" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=19 ; KeyboardLayoutNames[0]="Swiss German" ;;
996 | "Tamil Input Method" ) TypingStyles=( "Anjal" "Tamil99" ) ; AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.US" ; AppleDefaultAsciiInputSource=0 ;;
997 | "Thai" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Thai" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-26624 ; KeyboardLayoutNames[0]="Thai" ;;
998 | "Thai - PattaChote" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Thai-PattaChote" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-26626 ; KeyboardLayoutNames[0]="Thai-PattaChote" ;;
999 | "Tibetan - Otani" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.TibetanOtaniUS" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-26628 ; KeyboardLayoutNames[0]="TibetanOtaniUS" ;;
1000 | "Tibetan - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Tibetan-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-26625 ; KeyboardLayoutNames[0]="Tibetan-QWERTY" ;;
1001 | "Tibetan - Wylie" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Tibetan-Wylie" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-2398 ; KeyboardLayoutNames[0]="Tibetan-Wylie" ;;
1002 | "Turkish" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Turkish" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-24 ; KeyboardLayoutNames[0]="Turkish" ;;
1003 | "Turkish - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Turkish-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-35 ; KeyboardLayoutNames[0]="Turkish-QWERTY" ;;
1004 | "Turkish - QWERTY PC" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Turkish-QWERTY-PC" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-36 ; KeyboardLayoutNames[0]="Turkish-QWERTY-PC" ;;
1005 | "U.S. Extended" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.USExtended" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-2 ; KeyboardLayoutNames[0]="US Extended" ;;
1006 | "U.S. International - PC" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.USInternational-PC" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=15000 ; KeyboardLayoutNames[0]="USInternational-PC" ;;
1007 | "Ukrainian" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Ukrainian" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=19518 ; KeyboardLayoutNames[0]="Ukrainian" ;;
1008 | "Unicode Hex Input" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.UnicodeHexInput" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-1 ; KeyboardLayoutNames[0]="Unicode Hex Input" ;;
1009 | "Uyghur - QWERTY" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Uyghur-QWERTY" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-27000 ; KeyboardLayoutNames[0]="Uyghur-QWERTY" ;;
1010 | "Vietnamese" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Vietnamese" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-31232 ; KeyboardLayoutNames[0]="Vietnamese" ;;
1011 | "Vietnamese Unikey" ) TypingStyles=( "Simple Telex" "VNI" "VIQR" "Telex" ) ; AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.US" ;;
1012 | "Welsh" ) AppleCurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Welsh" ; AppleDefaultAsciiInputSource=0 ; AppleSelectedInputSources=0 ; InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=-790 ; KeyboardLayoutNames[0]="Welsh" ;;
1013 | esac
1014 | }
1015 |
1016 | function set_TypingStyle {
1017 | case "${1}" in
1018 | "Chinese - Simplified" )
1019 | InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=0 ; KeyboardLayoutNames[0]="U.S."
1020 | BundleIDs[1]="com.apple.inputmethod.SCIM" ; InputModes[1]="com.apple.inputmethod.SCIM.ITABC" ; InputSourceKinds[1]="Input Mode"
1021 | BundleIDs[2]="com.apple.inputmethod.SCIM" ; InputModes[2]="com.apple.inputmethod.SCIM.WBH" ; InputSourceKinds[2]="Input Mode"
1022 | BundleIDs[3]="com.apple.inputmethod.SCIM" ; InputModes[3]="com.apple.inputmethod.SCIM.WBX" ; InputSourceKinds[3]="Input Mode"
1023 | BundleIDs[4]="com.apple.inputmethod.SCIM" ; InputSourceKinds[4]="Keyboard Input Method"
1024 | BundleIDs[5]="com.apple.inputmethod.ChineseHandwriting" ; InputSourceKinds[5]="Non Keyboard Input Method"
1025 | case "${2}" in
1026 | "Pinyin - Simplified" ) AppleSelectedInputSources=1 ;;
1027 | "Wubi Hua" ) AppleSelectedInputSources=2 ;;
1028 | "Wubi Xing" ) AppleSelectedInputSources=3 ;;
1029 | esac ;;
1030 | "Chinese - Traditional" )
1031 | InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=0 ; KeyboardLayoutNames[0]="U.S."
1032 | BundleIDs[1]="com.apple.inputmethod.TCIM" ; InputModes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; InputSourceKinds[1]="Input Mode"
1033 | BundleIDs[2]="com.apple.inputmethod.TCIM" ; InputModes[2]="com.apple.inputmethod.TCIM.Cangjie" ; InputSourceKinds[2]="Input Mode"
1034 | BundleIDs[3]="com.apple.inputmethod.TCIM" ; InputModes[3]="com.apple.inputmethod.TCIM.Dayi" ; InputSourceKinds[3]="Input Mode"
1035 | BundleIDs[4]="com.apple.inputmethod.TCIM" ; InputModes[4]="com.apple.inputmethod.TCIM.Jianyi" ; InputSourceKinds[4]="Input Mode"
1036 | BundleIDs[5]="com.apple.inputmethod.TCIM" ; InputModes[5]="com.apple.inputmethod.TCIM.Pinyin" ; InputSourceKinds[5]="Input Mode"
1037 | BundleIDs[6]="com.apple.inputmethod.TCIM" ; InputSourceKinds[6]="Keyboard Input Method"
1038 | BundleIDs[7]="com.apple.inputmethod.ChineseHandwriting" ; InputSourceKinds[7]="Non Keyboard Input Method"
1039 | case "${2}" in
1040 | "Zhuyin" ) AppleSelectedInputSources=1 ;;
1041 | "Cangjie" ) AppleSelectedInputSources=2 ;;
1042 | "Dayi Pro" ) AppleSelectedInputSources=3 ;;
1043 | "Jianyi" ) AppleSelectedInputSources=4 ;;
1044 | "Pinyin - Traditional" ) AppleSelectedInputSources=5 ;;
1045 | esac ;;
1046 | "Hangul" )
1047 | InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=0 ; KeyboardLayoutNames[0]="U.S."
1048 | BundleIDs[1]="com.apple.inputmethod.Korean" ; InputModes[1]="com.apple.inputmethod.Korean.3SetKorean" ; InputSourceKinds[1]="Input Mode"
1049 | BundleIDs[2]="com.apple.inputmethod.Korean" ; InputModes[2]="com.apple.inputmethod.Korean.2SetKorean" ; InputSourceKinds[2]="Input Mode"
1050 | BundleIDs[3]="com.apple.inputmethod.Korean" ; InputModes[3]="com.apple.inputmethod.Korean.HNCRomaja" ; InputSourceKinds[3]="Input Mode"
1051 | BundleIDs[4]="com.apple.inputmethod.Korean" ; InputModes[4]="com.apple.inputmethod.Korean.390Sebulshik" ; InputSourceKinds[4]="Input Mode"
1052 | BundleIDs[5]="com.apple.inputmethod.Korean" ; InputModes[5]="com.apple.inputmethod.Korean.GongjinCheongRomaja" ; InputSourceKinds[5]="Input Mode"
1053 | BundleIDs[6]="com.apple.inputmethod.Korean" ; InputSourceKinds[6]="Keyboard Input Method"
1054 | case "${2}" in
1055 | "3-Set Korean" ) AppleSelectedInputSources=1 ;;
1056 | "2-Set Korean" ) AppleSelectedInputSources=2 ;;
1057 | "HNC Romaja" ) AppleSelectedInputSources=3 ;;
1058 | "390 Sebulshik" ) AppleSelectedInputSources=4 ;;
1059 | "GongjinCheong Romaja" ) AppleSelectedInputSources=5 ;;
1060 | esac ;;
1061 | "Kotoeri" )
1062 | BundleIDs[0]="com.apple.inputmethod.Kotoeri" ; InputModes[0]="com.apple.inputmethod.Japanese" ; InputSourceKinds[0]="Input Mode"
1063 | BundleIDs[1]="com.apple.inputmethod.Kotoeri" ; InputModes[1]="com.apple.inputmethod.Japanese.placename" ; InputSourceKinds[1]="Input Mode"
1064 | BundleIDs[2]="com.apple.inputmethod.Kotoeri" ; InputModes[2]="com.apple.inputmethod.Roman" ; InputSourceKinds[2]="Input Mode"
1065 | BundleIDs[3]="com.apple.inputmethod.Kotoeri" ; InputModes[3]="com.apple.inputmethod.Japanese.Katakana" ; InputSourceKinds[3]="Input Mode"
1066 | BundleIDs[4]="com.apple.inputmethod.Kotoeri" ; InputModes[4]="com.apple.inputmethod.Japanese.firstname" ; InputSourceKinds[4]="Input Mode"
1067 | BundleIDs[5]="com.apple.inputmethod.Kotoeri" ; InputModes[5]="com.apple.inputmethod.Japanese.lastname" ; InputSourceKinds[5]="Input Mode"
1068 | BundleIDs[6]="com.apple.inputmethod.Kotoeri" ; InputModes[6]="Keyboard Input Method"
1069 | case "${2}" in
1070 | "Romaji" ) AppleSelectedInputSources=2 ;;
1071 | "Kana" ) AppleSelectedInputSources=2 ;;
1072 | esac ;;
1073 | "Tamil Input Method" )
1074 | InputSourceKinds[0]="Keyboard Layout" ; KeyboardLayoutIDs[0]=0 ; KeyboardLayoutNames[0]="U.S."
1075 | BundleIDs[1]="com.apple.inputmethod.Tamil" ; InputModes[1]="com.apple.inputmethod.Tamil.AnjalIM" ; InputSourceKinds[1]="Input Mode"
1076 | BundleIDs[2]="com.apple.inputmethod.Tamil" ; InputModes[2]="com.apple.inputmethod.Tamil.Tamil99" ; InputSourceKinds[2]="Input Mode"
1077 | BundleIDs[3]="com.apple.inputmethod.Tamil" ; InputSourceKinds[3]="Keyboard Input Method"
1078 | case "${2}" in
1079 | "Anjal" ) AppleSelectedInputSources=1 ;;
1080 | "Tamil99" ) AppleSelectedInputSources=2 ;;
1081 | esac ;;
1082 | "Vietnamese Unikey" )
1083 | BundleIDs[0]="com.apple.inputmethod.VietnameseIM" ; InputModes[0]="com.apple.inputmethod.VietnameseSimpleTelex" ; InputSourceKinds[0]="Input Mode"
1084 | BundleIDs[1]="com.apple.inputmethod.VietnameseIM" ; InputSourceKinds[1]="Keyboard Input Method"
1085 | case "${2}" in
1086 | "Simple Telex" ) AppleSelectedInputSources=0 ;;
1087 | "VNI" ) BundleIDs[2]="com.apple.inputmethod.VietnameseIM" ; InputModes[2]="com.apple.inputmethod.VietnameseVNI" ; InputSourceKinds[2]="Input Mode" ; AppleSelectedInputSources=0 ;;
1088 | "VIQR" ) BundleIDs[2]="com.apple.inputmethod.VietnameseIM" ; InputModes[2]="com.apple.inputmethod.VietnameseVIQR" ; InputSourceKinds[2]="Input Mode" ; AppleSelectedInputSources=0 ;;
1089 | "Telex" ) BundleIDs[2]="com.apple.inputmethod.VietnameseIM" ; InputModes[2]="com.apple.inputmethod.VietnameseTelex" ; InputSourceKinds[2]="Input Mode" ; AppleSelectedInputSources=0 ;;
1090 | esac ;;
1091 | esac
1092 | }
1093 |
1094 | function set_KeyboardLayout {
1095 | # ${1}: AppleCurrentKeyboardLayoutInputSourceID
1096 | # ${2}: InputMode
1097 | case "${1}" in
1098 | "com.apple.keylayout.US" )
1099 | case "${2}" in
1100 | "com.apple.inputmethod.SCIM.ITABC" ) KeyboardLayout="Chinese - Simplified" ; TypingStyle="Pinyin - Simplified" ;;
1101 | "com.apple.inputmethod.SCIM.WBH" ) KeyboardLayout="Chinese - Simplified" ; TypingStyle="Wubi Hua" ;;
1102 | "com.apple.inputmethod.SCIM.WBX" ) KeyboardLayout="Chinese - Simplified" ; TypingStyle="Wubi Xing" ;;
1103 | "com.apple.inputmethod.TCIM.Zhuyin" ) KeyboardLayout="Chinese - Traditional" ; TypingStyle="Zhuyin" ;;
1104 | "com.apple.inputmethod.TCIM.Cangjie" ) KeyboardLayout="Chinese - Traditional" ; TypingStyle="Cangjie" ;;
1105 | "com.apple.inputmethod.TCIM.Dayi" ) KeyboardLayout="Chinese - Traditional" ; TypingStyle="Dayi Pro" ;;
1106 | "com.apple.inputmethod.TCIM.Jianyi" ) KeyboardLayout="Chinese - Traditional" ; TypingStyle="Jianyi" ;;
1107 | "com.apple.inputmethod.TCIM.Pinyin" ) KeyboardLayout="Chinese - Traditional" ; TypingStyle="Pinyin - Traditional" ;;
1108 | "com.apple.inputmethod.Korean.3SetKorean" ) KeyboardLayout="Hangul" ; TypingStyle="3-Set Korean" ;;
1109 | "com.apple.inputmethod.Korean.2SetKorean" ) KeyboardLayout="Hangul" ; TypingStyle="2-Set Korean" ;;
1110 | "com.apple.inputmethod.Korean.HNCRomaja" ) KeyboardLayout="Hangul" ; TypingStyle="HNC Romaja" ;;
1111 | "com.apple.inputmethod.Korean.390Sebulshik" ) KeyboardLayout="Hangul" ; TypingStyle="390 Sebulshik" ;;
1112 | "com.apple.inputmethod.Korean.GongjinCheongRomaja" ) KeyboardLayout="Hangul" ; TypingStyle="GongjinCheong Romaja" ;;
1113 | "com.apple.inputmethod.Roman" ) KeyboardLayout="Kotoeri" ; TypingStyle="Romaji" ;;
1114 | "com.apple.inputmethod.Japanese.Katakana" ) KeyboardLayout="Kotoeri" ; TypingStyle="Kana" ;;
1115 | "com.apple.inputmethod.Tamil.AnjalIM" ) KeyboardLayout="Tamil Input Method" ; TypingStyle="Anjal" ;;
1116 | "com.apple.inputmethod.Tamil.Tamil99" ) KeyboardLayout="Tamil Input Method" ; TypingStyle="Tamil99" ;;
1117 | "com.apple.inputmethod.VietnameseSimpleTelex" ) KeyboardLayout="Vietnamese Unikey" ; TypingStyle="Simple Telex" ;;
1118 | "com.apple.inputmethod.VietnameseVNI" ) KeyboardLayout="Vietnamese Unikey" ; TypingStyle="VNI" ;;
1119 | "com.apple.inputmethod.VietnameseVIQR" ) KeyboardLayout="Vietnamese Unikey" ; TypingStyle="VIQR" ;;
1120 | "com.apple.inputmethod.VietnameseTelex" ) KeyboardLayout="Vietnamese Unikey" ; TypingStyle="Telex" ;;
1121 | "" ) KeyboardLayout="U.S." ;;
1122 | esac ;;
1123 | "com.apple.keylayout.AfghanDari" ) KeyboardLayout="Afghan Dari" ;;
1124 | "com.apple.keylayout.AfghanPashto" ) KeyboardLayout="Afghan Pashto" ;;
1125 | "com.apple.keylayout.AfghanUzbek" ) KeyboardLayout="Afghan Uzbek" ;;
1126 | "com.apple.keylayout.Arabic" ) KeyboardLayout="Arabic" ;;
1127 | "com.apple.keylayout.Arabic-QWERTY" ) KeyboardLayout="Arabic - QWERTY" ;;
1128 | "com.apple.keylayout.ArabicPC" ) KeyboardLayout="Arabic - PC" ;;
1129 | "com.apple.keylayout.Armenian-HMQWERTY" ) KeyboardLayout="Armenian - HM QWERTY" ;;
1130 | "com.apple.keylayout.Armenian-WesternQWERTY" ) KeyboardLayout="Armenian - Western QWERTY" ;;
1131 | "com.apple.keylayout.Australian" ) KeyboardLayout="Australian" ;;
1132 | "com.apple.keylayout.Austrian" ) KeyboardLayout="Austrian" ;;
1133 | "com.apple.keylayout.Azeri" ) KeyboardLayout="Azeri" ;;
1134 | "com.apple.keylayout.Belgian" ) KeyboardLayout="Belgian" ;;
1135 | "com.apple.keylayout.Brazilian" ) KeyboardLayout="Brazilian" ;;
1136 | "com.apple.keylayout.British" ) KeyboardLayout="British" ;;
1137 | "com.apple.keylayout.Bulgarian" ) KeyboardLayout="Bulgarian" ;;
1138 | "com.apple.keylayout.Bulgarian-Phonetic" ) KeyboardLayout="Bulgarian - Phonetic" ;;
1139 | "com.apple.keylayout.Byelorussian" ) KeyboardLayout="Byelorussian" ;;
1140 | "com.apple.keylayout.Canadian" ) KeyboardLayout="Canadian English" ;;
1141 | "com.apple.keylayout.Canadian-CSA" ) KeyboardLayout="Canadian French - CSA" ;;
1142 | "com.apple.keylayout.Cherokee-Nation" ) KeyboardLayout="Cherokee - Nation" ;;
1143 | "com.apple.keylayout.Cherokee-QWERTY" ) KeyboardLayout="Cherokee - QWERTY" ;;
1144 | "com.apple.keylayout.Croatian" ) KeyboardLayout="Croatian" ;;
1145 | "com.apple.keylayout.Croatian-PC" ) KeyboardLayout="Croatian - PC" ;;
1146 | "com.apple.keylayout.Czech" ) KeyboardLayout="Czech" ;;
1147 | "com.apple.keylayout.Czech-QWERTY" ) KeyboardLayout="Czech - QWERTY" ;;
1148 | "com.apple.keylayout.Danish" ) KeyboardLayout="Danish" ;;
1149 | "com.apple.keylayout.Devanagari" ) KeyboardLayout="Devanagari" ;;
1150 | "com.apple.keylayout.Devanagari-QWERTY" ) KeyboardLayout="Devanagari - QWERTY" ;;
1151 | "com.apple.keylayout.Dutch" ) KeyboardLayout="Dutch" ;;
1152 | "com.apple.keylayout.Dvorak" ) KeyboardLayout="Dvorak" ;;
1153 | "com.apple.keylayout.Dvorak-Left" ) KeyboardLayout="Dvorak - Left" ;;
1154 | "com.apple.keylayout.DVORAK-QWERTYCMD" ) KeyboardLayout="Dvorak - Qwerty ⌘" ;;
1155 | "com.apple.keylayout.Dvorak-Right" ) KeyboardLayout="Dvorak - Right" ;;
1156 | "com.apple.keylayout.Estonian" ) KeyboardLayout="Estonian" ;;
1157 | "com.apple.keylayout.Faroese" ) KeyboardLayout="Faroese" ;;
1158 | "com.apple.keylayout.Finnish" ) KeyboardLayout="Finnish" ;;
1159 | "com.apple.keylayout.FinnishExtended" ) KeyboardLayout="Finnish Extended" ;;
1160 | "com.apple.keylayout.FinnishSami-PC" ) KeyboardLayout="Finnish Sami - PC" ;;
1161 | "com.apple.keylayout.French" ) KeyboardLayout="French" ;;
1162 | "com.apple.keylayout.French-numerical" ) KeyboardLayout="French - Numerical" ;;
1163 | "com.apple.keylayout.German" ) KeyboardLayout="German" ;;
1164 | "com.apple.keylayout.Greek" ) KeyboardLayout="Greek" ;;
1165 | "com.apple.keylayout.GreekPolytonic" ) KeyboardLayout="Greek Polytonic" ;;
1166 | "com.apple.keylayout.Gujarati" ) KeyboardLayout="Gujarati" ;;
1167 | "com.apple.keylayout.Gujarati-QWERTY" ) KeyboardLayout="Gujarati - QWERTY" ;;
1168 | "com.apple.keylayout.Gurmukhi" ) KeyboardLayout="Gurmukhi" ;;
1169 | "com.apple.keylayout.Gurmukhi-QWERTY" ) KeyboardLayout="Gurmukhi - QWERTY" ;;
1170 | "com.apple.keylayout.Hawaiian" ) KeyboardLayout="Hawaiian" ;;
1171 | "com.apple.keylayout.Hebrew" ) KeyboardLayout="Hebrew" ;;
1172 | "com.apple.keylayout.Hebrew-QWERTY" ) KeyboardLayout="Hebrew - QWERTY" ;;
1173 | "com.apple.keylayout.Hungarian" ) KeyboardLayout="Hungarian" ;;
1174 | "com.apple.keylayout.Icelandic" ) KeyboardLayout="Icelandic" ;;
1175 | "com.apple.keylayout.Inuktitut-Nunavut" ) KeyboardLayout="Inuktitut - Nunavut" ;;
1176 | "com.apple.keylayout.Inuktitut-Nutaaq" ) KeyboardLayout="Inuktitut - Nutaaq" ;;
1177 | "com.apple.keylayout.Inuktitut-QWERTY" ) KeyboardLayout="Inuktitut - QWERTY" ;;
1178 | "com.apple.keylayout.InuttitutNunavik" ) KeyboardLayout="Inuttitut Nunavik" ;;
1179 | "com.apple.keylayout.Irish" ) KeyboardLayout="Irish" ;;
1180 | "com.apple.keylayout.IrishExtended" ) KeyboardLayout="Irish Extended" ;;
1181 | "com.apple.keylayout.Italian" ) KeyboardLayout="Italian" ;;
1182 | "com.apple.keylayout.Italian-Pro" ) KeyboardLayout="Italian - Pro" ;;
1183 | "com.apple.keylayout.Jawi-QWERTY" ) KeyboardLayout="Jawi - QWERTY" ;;
1184 | "com.apple.keylayout.Kazakh" ) KeyboardLayout="Kazakh" ;;
1185 | "com.apple.keylayout.Latvian" ) KeyboardLayout="Latvian" ;;
1186 | "com.apple.keylayout.Lithuanian" ) KeyboardLayout="Lithuanian" ;;
1187 | "com.apple.keylayout.Macedonian" ) KeyboardLayout="Macedonian" ;;
1188 | "com.apple.keylayout.Maltese" ) KeyboardLayout="Maltese" ;;
1189 | "com.apple.keylayout.Maori" ) KeyboardLayout="Maori" ;;
1190 | "com.apple.keylayout.Nepali" ) KeyboardLayout="Nepali" ;;
1191 | "com.apple.keylayout.NorthernSami" ) KeyboardLayout="Northern Sami" ;;
1192 | "com.apple.keylayout.Norwegian" ) KeyboardLayout="Norwegian" ;;
1193 | "com.apple.keylayout.NorwegianExtended" ) KeyboardLayout="Norwegian Extended" ;;
1194 | "com.apple.keylayout.NorwegianSami-PC" ) KeyboardLayout="Norwegian Sami - PC" ;;
1195 | "com.apple.keylayout.Persian" ) KeyboardLayout="Persian" ;;
1196 | "com.apple.keylayout.Persian-ISIRI2901" ) KeyboardLayout="Persian - ISIRI 2901" ;;
1197 | "com.apple.keylayout.Persian-QWERTY" ) KeyboardLayout="Persian - QWERTY" ;;
1198 | "com.apple.keylayout.Polish" ) KeyboardLayout="Polish" ;;
1199 | "com.apple.keylayout.PolishPro" ) KeyboardLayout="Polish Pro" ;;
1200 | "com.apple.keylayout.Portuguese" ) KeyboardLayout="Portuguese" ;;
1201 | "com.apple.keylayout.Romanian" ) KeyboardLayout="Romanian" ;;
1202 | "com.apple.keylayout.Romanian-Standard" ) KeyboardLayout="Romanian - Standard" ;;
1203 | "com.apple.keylayout.Russian" ) KeyboardLayout="Russian" ;;
1204 | "com.apple.keylayout.Russian-Phonetic" ) KeyboardLayout="Russian - Phonetic" ;;
1205 | "com.apple.keylayout.RussianWin" ) KeyboardLayout="Russian - PC" ;;
1206 | "com.apple.keylayout.Sami-PC" ) KeyboardLayout="Sami - PC" ;;
1207 | "com.apple.keylayout.Serbian" ) KeyboardLayout="Serbian" ;;
1208 | "com.apple.keylayout.Serbian-Latin" ) KeyboardLayout="Serbian - Latin" ;;
1209 | "com.apple.keylayout.Slovak" ) KeyboardLayout="Slovak" ;;
1210 | "com.apple.keylayout.Slovak-QWERTY" ) KeyboardLayout="Slovak - QWERTY" ;;
1211 | "com.apple.keylayout.Slovenian" ) KeyboardLayout="Slovenian" ;;
1212 | "com.apple.keylayout.Spanish" ) KeyboardLayout="Spanish" ;;
1213 | "com.apple.keylayout.Spanish-ISO" ) KeyboardLayout="Spanish - ISO" ;;
1214 | "com.apple.keylayout.Swedish" ) KeyboardLayout="Swedish" ;;
1215 | "com.apple.keylayout.Swedish-Pro" ) KeyboardLayout="Swedish - Pro" ;;
1216 | "com.apple.keylayout.SwedishSami-PC" ) KeyboardLayout="Swedish Sami - PC" ;;
1217 | "com.apple.keylayout.SwissFrench" ) KeyboardLayout="Swiss French" ;;
1218 | "com.apple.keylayout.SwissGerman" ) KeyboardLayout="Swiss German" ;;
1219 | "com.apple.keylayout.Thai" ) KeyboardLayout="Thai" ;;
1220 | "com.apple.keylayout.Thai-PattaChote" ) KeyboardLayout="Thai - PattaChote" ;;
1221 | "com.apple.keylayout.Tibetan-QWERTY" ) KeyboardLayout="Tibetan - QWERTY" ;;
1222 | "com.apple.keylayout.Tibetan-Wylie" ) KeyboardLayout="Tibetan - Wylie" ;;
1223 | "com.apple.keylayout.TibetanOtaniUS" ) KeyboardLayout="Tibetan - Otani" ;;
1224 | "com.apple.keylayout.Turkish" ) KeyboardLayout="Turkish" ;;
1225 | "com.apple.keylayout.Turkish-QWERTY" ) KeyboardLayout="Turkish - QWERTY" ;;
1226 | "com.apple.keylayout.Turkish-QWERTY-PC" ) KeyboardLayout="Turkish - QWERTY PC" ;;
1227 | "com.apple.keylayout.Ukrainian" ) KeyboardLayout="Ukrainian" ;;
1228 | "com.apple.keylayout.UnicodeHexInput" ) KeyboardLayout="Unicode Hex Input" ;;
1229 | "com.apple.keylayout.USExtended" ) KeyboardLayout="U.S. Extended" ;;
1230 | "com.apple.keylayout.USInternational-PC" ) KeyboardLayout="U.S. International - PC" ;;
1231 | "com.apple.keylayout.Uyghur-QWERTY" ) KeyboardLayout="Uyghur - QWERTY" ;;
1232 | "com.apple.keylayout.Vietnamese" ) KeyboardLayout="Vietnamese" ;;
1233 | "com.apple.keylayout.Welsh" ) KeyboardLayout="Welsh" ;;
1234 | esac
1235 | set_InputSources "${KeyboardLayout}"
1236 | if [ -n "${TypingStyle}" ] ; then set_TypingStyle "${KeyboardLayout}" "${TypingStyle}" ; fi
1237 | }
1238 |
1239 | function get_Keyboard {
1240 | prefAppleCurrentKeyboardLayoutInputSourceID=`defaults read ~/Library/Preferences/au.com.mondada.SIC "AppleCurrentKeyboardLayoutInputSourceID" 2>/dev/null`
1241 | if [ -z "${prefAppleCurrentKeyboardLayoutInputSourceID}" ] ; then AppleCurrentKeyboardLayoutInputSourceID=`defaults read "/Library/Preferences/com.apple.HIToolbox" "AppleCurrentKeyboardLayoutInputSourceID" 2>/dev/null` ; fi
1242 | if [ -n "${prefAppleCurrentKeyboardLayoutInputSourceID}" ] ; then AppleCurrentKeyboardLayoutInputSourceID="${prefAppleCurrentKeyboardLayoutInputSourceID}" ; fi
1243 | echo "AppleCurrentKeyboardLayoutInputSourceID: ${AppleCurrentKeyboardLayoutInputSourceID}"
1244 | prefInputMode=`defaults read ~/Library/Preferences/au.com.mondada.SIC "InputMode" 2>/dev/null`
1245 | if [ -z "${prefInputMode}" ] ; then prefInputMode=`/usr/libexec/PlistBuddy -c "Print ':AppleSelectedInputSources:0:Input Mode'" "/Library/Preferences/com.apple.HIToolbox.plist" 2>/dev/null` ; fi
1246 | if [ -n "${prefInputMode}" ] ; then InputMode="${prefInputMode}" ; fi
1247 | echo "InputMode: ${InputMode}"
1248 | set_KeyboardLayout "${AppleCurrentKeyboardLayoutInputSourceID}" "${InputMode}"
1249 | }
1250 |
1251 | function save_Keyboard {
1252 | defaults write ~/Library/Preferences/au.com.mondada.SIC "AppleCurrentKeyboardLayoutInputSourceID" -string "${AppleCurrentKeyboardLayoutInputSourceID}"
1253 | if [ -n "${InputMode}" ] ; then
1254 | defaults write ~/Library/Preferences/au.com.mondada.SIC "InputMode" -string "${InputMode}"
1255 | else
1256 | defaults delete ~/Library/Preferences/au.com.mondada.SIC "InputMode" 2>/dev/null
1257 | fi
1258 | }
1259 |
1260 | function display_Keyboard {
1261 | echo "Keyboard Layout: ${KeyboardLayout}"
1262 | if [ -n "${TypingStyle}" ] ; then echo "Preferred typing style: ${TypingStyle}" ; fi
1263 | }
1264 |
1265 | function select_Keyboard {
1266 | KeyboardLayouts=( "${defaultKeyboardLayouts[@]}" )
1267 | display_Title "Select Keyboard"
1268 | display_Keyboard
1269 | display_Options "Keyboard layouts" "Choose a keyboard layout: "
1270 | select newKeyboardLayout in "${KeyboardLayouts[@]}" ; do
1271 | while [ "${newKeyboardLayout}" == "Show All" ] ; do
1272 | KeyboardLayouts=( "U.S." "Afghan Dari" "Afghan Pashto" "Afghan Uzbek" "Arabic" "Arabic - PC" "Arabic - QWERTY" "Armenian - HM QWERTY" "Armenian - Western QWERTY" "Australian" "Austrian" "Azeri" "Belgian" "Brazilian" "British" "Bulgarian" "Bulgarian - Phonetic" "Byelorussian" "Canadian English" "Canadian French - CSA" "Cherokee - Nation" "Cherokee - QWERTY" "Chinese - Simplified" "Chinese - Traditional" "Croatian" "Croatian - PC" "Czech" "Czech - QWERTY" "Dutch" "Dvorak" "Dvorak - Left" "Dvorak - Qwerty ⌘" "Dvorak - Right" "Estonian" "Faroese" "Finnish" "Finnish Extended" "Finnish - Sami - PC" "French" "French - Numerical" "German" "Greek" "Greek Polytonic" "Gujarati" "Gujarati - QWERTY" "Gurmukhi" "Gurmukhi - QWERTY" "Hangul" "Hawaiian" "Hebrew" "Hebrew - QWERTY" "Hungarian" "Icelandic" "Inuktitut - Nunavut" "Inuktitut - Nutaaq" "Inuktitut - QWERTY" "Inuttitut Nunavik" "Irish" "Irish Extended" "Italian" "Italian - Pro" "Jawi - QWERTY" "Kazakh" "Kotoeri" "Latvian" "Lithuanian" "Macedonian" "Maltese" "Maori" "Nepali" "Northern Sami" "Norwegian" "Norwegian Extended" "Norwegian Sami - PC" "Persian" "Persian - ISIRI 2901" "Persian - QWERTY" "Polish" "Polish Pro" "Portuguese" "Romanian" "Romanian - Standard" "Russian" "Russian - PC" "Russian - Phonetic" "Sami - PC" "Serbian" "Serbian - Latin" "Slovak" "Slovak - QWERTY" "Slovenian" "Spanish" "Spanish ISO" "Swedish" "Swedish - Pro" "Swedish Sami - PC" "Swiss French" "Swiss German" "Tamil Input Method" "Thai" "Thai - PattaChote" "Tibetan - Otani" "Tibetan - QWERTY" "Tibetan - Wylie" "Turkish" "Turkish - QWERTY" "Turkish - QWERTY PC" "U.S. Extended" "U.S. International - PC" "Ukrainian" "Unicode Hex Input" "Uyghur - QWERTY" "Vietnamese" "Vietnamese Unikey" "Welsh" )
1273 | display_Title "Select Keyboard"
1274 | display_Keyboard
1275 | display_Options "Keyboard layouts" "Choose a keyboard layout: "
1276 | select newKeyboardLayout in "${KeyboardLayouts[@]}" ; do
1277 | if [ -n "${newKeyboardLayout}" ] ; then break ; fi
1278 | done
1279 | done
1280 | if [ -n "${newKeyboardLayout}" ] ; then break ; fi
1281 | done
1282 | if [ "${newKeyboardLayout}" != "${KeyboardLayout}" ] ; then TypingStyle="" ; fi
1283 | KeyboardLayout="${newKeyboardLayout}" ; newKeyboardLayout=""
1284 | set_InputSources "${KeyboardLayout}"
1285 | if [ ${#TypingStyles[@]} -gt 0 ] ; then
1286 | display_Title "Select Keyboard"
1287 | display_Keyboard
1288 | if [ -z "${TypingStyle}" ] ; then echo "Preferred typing style: " ; fi
1289 | display_Options "Typing styles" "Which typing style do you prefer? "
1290 | select newTypingStyle in "${TypingStyles[@]}" ; do
1291 | if [ -n "${newTypingStyle}" ] ; then break ; fi
1292 | done
1293 | TypingStyle="${newTypingStyle}" ; newTypingStyle=""
1294 | set_TypingStyle "${KeyboardLayout}" "${TypingStyle}"
1295 | fi
1296 | }
1297 |
1298 | function set_NTPServerName {
1299 | case "${1}" in
1300 | "time.apple.com" ) NTPServerName="Apple Americas/U.S. (time.apple.com)" ;;
1301 | "time.asia.apple.com" ) NTPServerName="Apple Asia (time.asia.apple.com)" ;;
1302 | "time.euro.apple.com" ) NTPServerName="Apple Europe (time.euro.apple.com)" ;;
1303 | * ) NTPServerName="${1}" ;;
1304 | esac
1305 | }
1306 |
1307 | function set_NTPServer {
1308 | case "${1}" in
1309 | "Apple Americas/U.S. (time.apple.com)" ) NTPServer="time.apple.com" ;;
1310 | "Apple Asia (time.asia.apple.com)" ) NTPServer="time.asia.apple.com" ;;
1311 | "Apple Europe (time.euro.apple.com)" ) NTPServer="time.euro.apple.com" ;;
1312 | * ) NTPServer="${1}" ;;
1313 | esac
1314 | }
1315 |
1316 | function get_NTPServer {
1317 | prefntpdDisabled=`/usr/libexec/PlistBuddy -c "Print ':ntpdDisabled'" ~/Library/Preferences/au.com.mondada.SIC.plist 2>/dev/null`
1318 | if [ ${?} -ne 0 ] ; then prefntpdDisabled=`/usr/libexec/PlistBuddy -c "Print ':org.ntp.ntpd:Disabled'" "/var/db/launchd.db/com.apple.launchd/overrides.plist" 2>/dev/null` ; fi
1319 | if [ ${?} -ne 0 ] ; then prefntpdDisabled="" ; fi
1320 | if [ -n "${prefntpdDisabled}" ] ; then ntpdDisabled="${prefntpdDisabled}" ; fi
1321 | echo "ntpdDisabled: ${ntpdDisabled}"
1322 | prefNTPServer=`defaults read ~/Library/Preferences/au.com.mondada.SIC "NTPServer" 2>/dev/null`
1323 | if [ -z "${prefNTPServer}" ] ; then prefNTPServer=`cat "/etc/ntp.conf" | awk -F "server " '{print $NF}'` ; fi
1324 | if [ -n "${prefNTPServer}" ] ; then NTPServer="${prefNTPServer}" ; fi
1325 | echo "NTPServer: ${NTPServer}"
1326 | set_NTPServerName "${NTPServer}"
1327 | }
1328 |
1329 | function save_NTPServer {
1330 | defaults write ~/Library/Preferences/au.com.mondada.SIC "ntpdDisabled" -bool "${ntpdDisabled}"
1331 | defaults write ~/Library/Preferences/au.com.mondada.SIC "NTPServer" -string "${NTPServer}"
1332 | }
1333 |
1334 | function display_NTPServer {
1335 | echo "Network Time Server: ${NTPServerName}"
1336 | printf " ["
1337 | if [ "${ntpdDisabled}" == "false" ] ; then printf "*" ; else printf " " ; fi
1338 | echo "] Set date and time automatically"
1339 | }
1340 |
1341 | function select_NTPServer {
1342 | while [ -z "${setAutomatically}" ] ; do
1343 | display_Title "Date and Time"
1344 | display_NTPServer
1345 | echo
1346 | read -sn 1 -p "Set date and time automatically (Y/n)? " setAutomatically < /dev/tty
1347 | echo
1348 | if [ -z "${setAutomatically}" ] ; then setAutomatically="y" ; fi
1349 | case "${setAutomatically}" in
1350 | "Y" | "y" )
1351 | ntpdDisabled="false"
1352 | NTPServerNames=( "Apple Americas/U.S. (time.apple.com)" "Apple Asia (time.asia.apple.com)" "Apple Europe (time.euro.apple.com)" "Other..." )
1353 | display_Title "Date and Time"
1354 | display_NTPServer
1355 | display_Options "NTP Servers" "Select your network time server: "
1356 | select newNTPServerName in "${NTPServerNames[@]}" ; do
1357 | while [ "${newNTPServerName}" == "Other..." ] ; do
1358 | display_Title "Date and Time"
1359 | display_NTPServer
1360 | printf "\nNetwork time server (${defaultNTPServer}): "
1361 | read newNTPServerName
1362 | if [ -z "${newNTPServerName}" ] ; then set_NTPServerName "${defaultNTPServer}" ; fi
1363 | done
1364 | if [ -n "${newNTPServerName}" ] ; then break ; fi
1365 | done
1366 | NTPServerName="${newNTPServerName}"
1367 | set_NTPServer "${NTPServerName}" ;;
1368 | "N" | "n" )
1369 | ntpdDisabled="true"
1370 | NTPServer="${defaultNTPServer}"
1371 | set_NTPServerName "${NTPServer}" ;;
1372 | * ) setAutomatically="" ;;
1373 | esac
1374 | done
1375 | setAutomatically=""
1376 | }
1377 |
1378 | function set_TimeZoneDisplayName {
1379 | # ${1}: ZTIMEZONENAME
1380 | case "${1}" in
1381 | "Pacific/Niue" ) TimeZoneDisplayName="Niue Time" ;;
1382 | "Pacific/Pago_Pago" | "Pacific/Apia" ) TimeZoneDisplayName="Samoa Standard Time" ;;
1383 | "Pacific/Rarotonga" ) TimeZoneDisplayName="Cook Islands Time" ;;
1384 | "Pacific/Honolulu" ) TimeZoneDisplayName="Hawaii-Aleutian Standard Time" ;;
1385 | "Pacific/Tahiti" ) TimeZoneDisplayName="Tahiti Time" ;;
1386 | "America/Juneau" ) TimeZoneDisplayName="Alaska Standard Time" ;;
1387 | "America/Vancouver" | "America/Whitehorse" | "America/Tijuana" | "America/Los_Angeles" ) TimeZoneDisplayName="Pacific Standard Time" ;;
1388 | "Pacific/Pitcairn" ) TimeZoneDisplayName="Pitcairn Time" ;;
1389 | "America/Edmonton" | "America/Dawson_Creek" | "America/Yellowknife" | "America/Mazatlan" | "America/Hermosillo" | "America/Chihuahua" | "America/Phoenix" | "America/Denver" | "America/Boise" ) TimeZoneDisplayName="Mountain Standard Time" ;;
1390 | "America/Belize" | "America/Winnipeg" | "America/Regina" | "America/Swift_Current" | "America/Costa_Rica" | "America/Guatemala" | "America/Tegucigalpa" | "America/Mexico_City" | "America/Monterrey" | "America/Merida" | "America/Cancun" | "America/Managua" | "America/El_Salvador" | "America/Chicago" | "America/Indiana/Tell_City" | "America/North_Dakota/New_Salem" ) TimeZoneDisplayName="Central Standard Time" ;;
1391 | "America/Caracas" ) TimeZoneDisplayName="Venezuela Time" ;;
1392 | "America/Bogota" ) TimeZoneDisplayName="Columbia Time" ;;
1393 | "America/Havana" ) TimeZoneDisplayName="Cuba Standard Time" ;;
1394 | "America/Nassau" | "America/Montreal" | "America/Toronto" | "America/Nipigon" | "America/Thunder_Bay" | "America/Port-au-Prince" | "America/Jamaica" | "America/Cayman" | "America/Panama" | "America/Grand_Turk" | "America/New_York" | "America/Indiana/Indianapolis" | "America/Kentucky/Monticello" | "America/Indiana/Vincennes" | "America/Kentucky/Louisville" | "America/Detroit" ) TimeZoneDisplayName="Eastern Standard Time" ;;
1395 | "America/Guayaquil" ) TimeZoneDisplayName="Ecuador Time" ;;
1396 | "America/Lima" ) TimeZoneDisplayName="Peru Time" ;;
1397 | "America/St_Johns" ) TimeZoneDisplayName="Newfoundland Standard Time" ;;
1398 | "America/Manaus" | "America/Cuiaba" | "America/Campo_Grande" | "America/Porto_Velho" | "America/Boa_Vista" | "America/Rio_Branco" ) TimeZoneDisplayName="Amazon Time" ;;
1399 | "America/Antigua" | "America/Anguilla" | "America/Curacao" | "America/Aruba" | "America/Barbados" | "America/Guadeloupe" | "Atlantic/Bermuda" | "America/Moncton" | "America/Halifax" | "America/Glace_Bay" | "America/Dominica" | "America/Santo_Domingo" | "America/Grenada" | "America/St_Kitts" | "America/St_Lucia" | "America/Martinique" | "America/Montserrat" | "America/Puerto_Rico" | "America/Port_of_Spain" | "America/St_Vincent" | "America/Tortola" | "America/St_Thomas" ) TimeZoneDisplayName="Atlantic Standard Time" ;;
1400 | "America/La_Paz" ) TimeZoneDisplayName="Bolivia Time" ;;
1401 | "America/Santiago" ) TimeZoneDisplayName="Chile Time" ;;
1402 | "Atlantic/Stanley" ) TimeZoneDisplayName="Falkland Islands Time" ;;
1403 | "America/Guyana" ) TimeZoneDisplayName="Guyana Time" ;;
1404 | "America/Asuncion" ) TimeZoneDisplayName="Paraguay Time" ;;
1405 | "America/Argentina/Buenos_Aires" | "America/Argentina/Cordoba" | "America/Argentina/Tucuman" | "America/Argentina/Ushuaia" | "America/Argentina/Rio_Gallegos" | "America/Argentina/Jujuy" | "America/Argentina/Mendoza" | "America/Argentina/San_Juan" | "America/Argentina/Catamarca" | "America/Argentina/La_Rioja" ) TimeZoneDisplayName="Argentina Time" ;;
1406 | "America/Belem" | "America/Recife" | "America/Fortaleza" | "America/Maceio" | "America/Araguaina" | "America/Bahia" | "America/Sao_Paulo" ) TimeZoneDisplayName="Brasilia Time" ;;
1407 | "America/Cayenne" ) TimeZoneDisplayName="French Guiana Time" ;;
1408 | "America/Miquelon" ) TimeZoneDisplayName="Pierre an Miquelon Standard Time" ;;
1409 | "America/Paramaribo" ) TimeZoneDisplayName="Suriname Time" ;;
1410 | "America/Montevideo" ) TimeZoneDisplayName="Uruguay Time" ;;
1411 | "America/Godthab" ) TimeZoneDisplayName="West Greenland Time" ;;
1412 | "America/Noronha" ) TimeZoneDisplayName="Fernando de Noronha Time" ;;
1413 | "Atlantic/South_Georgia" ) TimeZoneDisplayName="South Georgia Time" ;;
1414 | "Atlantic/Azores" ) TimeZoneDisplayName="Azores Time" ;;
1415 | "Atlantic/Cape_Verde" ) TimeZoneDisplayName="Cape Verde Time" ;;
1416 | "Africa/Ouagadougou" | "Africa/Abidjan" | "Europe/London" | "Europe/Guernsey" | "Africa/Accra" | "Africa/Banjul" | "Africa/Conakry" | "Africa/Bissau" | "Europe/Dublin" | "Europe/Isle_of_Man" | "Atlantic/Reykjavik" | "Europe/Jersey" | "Africa/Monrovia" | "Africa/Bamako" | "Africa/Nouakchott" | "Atlantic/St_Helena" | "Africa/Freetown" | "Africa/Dakar" | "Africa/Sao_Tome" | "Africa/Lome" ) TimeZoneDisplayName="Greenwich Mean Time" ;;
1417 | "Africa/El_Aaiun" | "Atlantic/Canary" | "Atlantic/Faroe" | "Africa/Casablanca" | "Europe/Lisbon" | "Atlantic/Madeira" ) TimeZoneDisplayName="Western European Time" ;;
1418 | "Europe/Andorra" | "Europe/Tirane" | "Europe/Vienna" | "Europe/Sarajevo" | "Europe/Brussels" | "Europe/Zurich" | "Europe/Paris" | "Europe/Prague" | "Europe/Berlin" | "Europe/Copenhagen" | "Africa/Algiers" | "Europe/Madrid" | "Africa/Ceuta" | "Europe/Gibraltar" | "Europe/Zagreb" | "Europe/Budapest" | "Europe/Rome" | "Europe/Vaduz" | "Europe/Luxembourg" | "Europe/Monaco" | "Europe/Podgorica" | "Europe/Skopje" | "Europe/Malta" | "Europe/Amsterdam" | "Europe/Oslo" | "Europe/Warsaw" | "Europe/Belgrade" | "Europe/Stockholm" | "Europe/Ljubljana" | "Arctic/Longyearbyen" | "Europe/Bratislava" | "Europe/San_Marino" | "Africa/Tunis" | "Europe/Vatican" ) TimeZoneDisplayName="Central European Time" ;;
1419 | "Africa/Luanda" | "Africa/Porto-Novo" | "Africa/Kinshasa" | "Africa/Bangui" | "Africa/Brazzaville" | "Africa/Douala" | "Africa/Libreville" | "Africa/Malabo" | "Africa/Windhoek" | "Africa/Niamey" | "Africa/Lagos" | "Africa/Ndjamena" ) TimeZoneDisplayName="West Africa Time" ;;
1420 | "Africa/Bujumbura" | "Africa/Gaborone" | "Africa/Lubumbashi" | "Africa/Blantyre" | "Africa/Maputo" | "Africa/Kigali" | "Africa/Lusaka" | "Africa/Harare" ) TimeZoneDisplayName="Central Africa Time" ;;
1421 | "Europe/Sofia" | "Europe/Minsk" | "Asia/Nicosia" | "Europe/Tallinn" | "Africa/Cairo" | "Europe/Helsinki" | "Europe/Athens" | "Asia/Amman" | "Asia/Beirut" | "Europe/Vilnius" | "Europe/Riga" | "Africa/Tripoli" | "Europe/Chisinau" | "Asia/Gaza" | "Europe/Bucharest" | "Europe/Kaliningrad" | "Asia/Damascus" | "Europe/Istanbul" | "Europe/Simferopol" | "Europe/Zaporozhye" | "Europe/Kiev" | "Europe/Uzhgorod" ) TimeZoneDisplayName="Eastern European Time" ;;
1422 | "Asia/Jerusalem" ) TimeZoneDisplayName="Israel Standard Time" ;;
1423 | "Africa/Maseru" | "Africa/Mbabane" | "Africa/Johannesburg" ) TimeZoneDisplayName="South Africa Standard Time" ;;
1424 | "Asia/Bahrain" | "Asia/Baghdad" | "Asia/Kuwait" | "Asia/Qatar" | "Asia/Riyadh" | "Asia/Aden" ) TimeZoneDisplayName="Arabian Standard Time" ;;
1425 | "Africa/Djibouti" | "Africa/Asmara" | "Africa/Addis_Ababa" | "Africa/Nairobi" | "Indian/Comoro" | "Indian/Antananarivo" | "Africa/Khartoum" | "Africa/Mogadishu" | "Africa/Dar_es_Salaam" | "Africa/Kampala" | "Indian/Mayotte" ) TimeZoneDisplayName="East Africa Time" ;;
1426 | "Europe/Moscow" ) TimeZoneDisplayName="Moscow Standard Time" ;;
1427 | "Europe/Volgograd" ) TimeZoneDisplayName="Volgograd Time" ;;
1428 | "Asia/Tehran" ) TimeZoneDisplayName="Iran Standard Time" ;;
1429 | "Asia/Yerevan" ) TimeZoneDisplayName="Armenia Time" ;;
1430 | "Asia/Baku" ) TimeZoneDisplayName="Azerbaijan Time" ;;
1431 | "Asia/Tbilisi" ) TimeZoneDisplayName="Georgia Time" ;;
1432 | "Asia/Dubai" | "Asia/Muscat" ) TimeZoneDisplayName="Gulf Standard Time" ;;
1433 | "Indian/Mauritius" ) TimeZoneDisplayName="Mauritius Time" ;;
1434 | "Indian/Reunion" ) TimeZoneDisplayName="Reunion Time" ;;
1435 | "Europe/Samara" ) TimeZoneDisplayName="Samara Time" ;;
1436 | "Indian/Mahe" ) TimeZoneDisplayName="Seychelles Time" ;;
1437 | "Asia/Kabul" ) TimeZoneDisplayName="Afghanistan Time" ;;
1438 | "Indian/Maldives" ) TimeZoneDisplayName="Maldives Time" ;;
1439 | "Asia/Karachi" ) TimeZoneDisplayName="Pakistan Time" ;;
1440 | "Asia/Dushanbe" ) TimeZoneDisplayName="Tajikistan Time" ;;
1441 | "Asia/Ashgabat" ) TimeZoneDisplayName="Turkmenistan Time" ;;
1442 | "Asia/Samarkand" | "Asia/Tashkent" ) TimeZoneDisplayName="Uzbekistan Time" ;;
1443 | "Asia/Oral" | "Asia/Aqtau" | "Asia/Aqtobe" ) TimeZoneDisplayName="West Kazakhstan Standard Time" ;;
1444 | "Asia/Yekaterinburg" ) TimeZoneDisplayName="Yekaterinburg Time" ;;
1445 | "Asia/Kolkata" | "Asia/Colombo" ) TimeZoneDisplayName="India Standard Time" ;;
1446 | "Asia/Dhaka" ) TimeZoneDisplayName="Bangladesh Time" ;;
1447 | "Asia/Thimphu" ) TimeZoneDisplayName="Bhutan Time" ;;
1448 | "Asia/Almaty" | "Asia/Qyzylorda" ) TimeZoneDisplayName="East Kazakhstan Standard Time" ;;
1449 | "Asia/Bishkek" ) TimeZoneDisplayName="Kyrgystan Time" ;;
1450 | "Asia/Omsk" ) TimeZoneDisplayName="Omsk Time" ;;
1451 | "Asia/Rangoon" ) TimeZoneDisplayName="Myanmar Time" ;;
1452 | "Indian/Christmas" ) TimeZoneDisplayName="Christmas Island Time" ;;
1453 | "Asia/Phnom_Penh" | "Asia/Vientiane" | "Asia/Bangkok" | "Asia/Ho_Chi_Minh" ) TimeZoneDisplayName="Indochina Time" ;;
1454 | "Asia/Krasnoyarsk" ) TimeZoneDisplayName="Krasnoyarsk Time" ;;
1455 | "Asia/Pontianak" | "Asia/Jakarta" ) TimeZoneDisplayName="Western Indonesia Time" ;;
1456 | "Australia/Perth" ) TimeZoneDisplayName="Australian Western Standard Time" ;;
1457 | "Asia/Brunei" ) TimeZoneDisplayName="Brunei Darussalam Time" ;;
1458 | "Asia/Makassar" ) TimeZoneDisplayName="Central Indonesia Time" ;;
1459 | "Asia/Urumqi" | "Asia/Kashgar" | "Asia/Chongqing" | "Asia/Shanghai" | "Asia/Harbin" | "Asia/Macau" ) TimeZoneDisplayName="China Standard Time" ;;
1460 | "Asia/Taipei" ) TimeZoneDisplayName="GMT+08:00" ;;
1461 | "Asia/Hong_Kong" ) TimeZoneDisplayName="Hong Kong Time" ;;
1462 | "Asia/Irkutsk" ) TimeZoneDisplayName="Irkutsk Time" ;;
1463 | "Asia/Kuala_Lumpur" | "Asia/Kuching" ) TimeZoneDisplayName="Malaysia Time" ;;
1464 | "Asia/Manila" ) TimeZoneDisplayName="Philippine Time" ;;
1465 | "Asia/Singapore" ) TimeZoneDisplayName="Singapore Standard Time" ;;
1466 | "Asia/Ulaanbaatar" ) TimeZoneDisplayName="Ulan Bator Time" ;;
1467 | "Asia/Dili" ) TimeZoneDisplayName="East Timor Time" ;;
1468 | "Asia/Jayapura" ) TimeZoneDisplayName="Eastern Indonesia Time" ;;
1469 | "Asia/Tokyo" ) TimeZoneDisplayName="Japan Standard Time" ;;
1470 | "Asia/Pyongyang" | "Asia/Seoul" ) TimeZoneDisplayName="Korean Standard Time" ;;
1471 | "Pacific/Palau" ) TimeZoneDisplayName="Palau Time" ;;
1472 | "Asia/Yakutsk" ) TimeZoneDisplayName="Yakutsk Time" ;;
1473 | "Australia/Adelaide" | "Australia/Darwin" | "Australia/Broken_Hill" ) TimeZoneDisplayName="Australian Central Standard Time" ;;
1474 | "Australia/Sydney" | "Australia/Melbourne" | "Australia/Brisbane" | "Australia/Hobart" ) TimeZoneDisplayName="Australia Eastern Standard Time" ;;
1475 | "Pacific/Guam" ) TimeZoneDisplayName="Chamorro Standard Time" ;;
1476 | "Pacific/Port_Moresby" ) TimeZoneDisplayName="Papua New Guinea Time" ;;
1477 | "Asia/Sakhalin" ) TimeZoneDisplayName="Sakhalin Time" ;;
1478 | "Asia/Vladivostok" ) TimeZoneDisplayName="Vladivostok Time" ;;
1479 | "Asia/Magadan" ) TimeZoneDisplayName="Magadan Time" ;;
1480 | "Pacific/Noumea" ) TimeZoneDisplayName="New Caledonia Time" ;;
1481 | "Pacific/Ponape" ) TimeZoneDisplayName="Ponape Time" ;;
1482 | "Pacific/Guadalcanal" ) TimeZoneDisplayName="Solomon Islands Time" ;;
1483 | "Pacific/Efate" ) TimeZoneDisplayName="Vanuatu Time" ;;
1484 | "Pacific/Norfolk" ) TimeZoneDisplayName="Norfolk Islands Time" ;;
1485 | "Asia/Anadyr" ) TimeZoneDisplayName="Anadyr Time" ;;
1486 | "Pacific/Fiji" ) TimeZoneDisplayName="Fiji Time" ;;
1487 | "Pacific/Tarawa" ) TimeZoneDisplayName="Gilbert Islands Time" ;;
1488 | "Pacific/Majuro" ) TimeZoneDisplayName="Marshall Islands Time" ;;
1489 | "Pacific/Auckland" ) TimeZoneDisplayName="New Zealand Standard Time" ;;
1490 | "Asia/Kamchatka" ) TimeZoneDisplayName="Petropavlovsk-Kamchatsky Time" ;;
1491 | "Pacific/Funafuti" ) TimeZoneDisplayName="Tuvalu Time" ;;
1492 | "Pacific/Tongatapu" ) TimeZoneDisplayName="Tonga Time" ;;
1493 | esac
1494 | }
1495 |
1496 | function set_GeoKitFramework {
1497 | if [ -n "${targDisk}" ] ; then
1498 | TargetOSMinor=`defaults read "/Volumes/${targDisk}/System/Library/CoreServices/SystemVersion" "ProductVersion" | awk -F "." '{print $2}'`
1499 | GeoKitFramework="/Volumes/${targDisk}/System/Library/PrivateFrameworks/GeoKit.framework/Versions/A/Resources/world.geokit"
1500 | else
1501 | TargetOSMinor=`defaults read "/System/Library/CoreServices/SystemVersion" "ProductVersion" | awk -F "." '{print $2}'`
1502 | GeoKitFramework="/System/Library/PrivateFrameworks/GeoKit.framework/Versions/A/Resources/world.geokit"
1503 | fi
1504 | case ${TargetOSMinor} in
1505 | 6 | 7 ) PLACES="ZGEOPLACE" ;;
1506 | 8 ) PLACES="ZGEOKITPLACE" ;;
1507 | esac
1508 | }
1509 |
1510 | function set_TimeZone {
1511 | # ${1}: GeonameID
1512 | set_GeoKitFramework
1513 | QUERY="select ZTIMEZONENAME from ${PLACES} where ZGEONAMEID = ${1};"
1514 | ZTIMEZONENAME=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZTIMEZONENAME = " | awk -F "ZTIMEZONENAME = " '{print $NF}'`
1515 | set_TimeZoneDisplayName "${ZTIMEZONENAME}"
1516 | TimeZone="${TimeZoneDisplayName}"
1517 | }
1518 |
1519 | function set_ClosestCity {
1520 | # ${1}: GeonameID
1521 | set_GeoKitFramework
1522 | QUERY="select ZNAME from ${PLACES} where ZGEONAMEID = ${1};"
1523 | ZNAME=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZNAME = " | awk -F "ZNAME = " '{print $NF}'`
1524 | QUERY="select ZREGIONALCODE from ${PLACES} where ZGEONAMEID = ${1};"
1525 | ZREGIONALCODE=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZREGIONALCODE = " | awk -F "ZREGIONALCODE = " '{print $NF}'`
1526 | QUERY="select ZCOUNTRY from ${PLACES} where ZGEONAMEID = ${1};"
1527 | ZCOUNTRY=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZCOUNTRY = " | awk -F "ZCOUNTRY = " '{print $NF}'`
1528 | QUERY="select ZNAME from ZGEOPLACENAME where ZEN > 0 and ZPLACE = ${ZCOUNTRY};"
1529 | ZCOUNTRYNAME=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZNAME = " | awk -F "ZNAME = " '{print $NF}'`
1530 | if [ -n "${ZREGIONALCODE}" ] ; then
1531 | ClosestCity="${ZNAME}, ${ZREGIONALCODE} - ${ZCOUNTRYNAME}"
1532 | else
1533 | ClosestCity="${ZNAME} - ${ZCOUNTRYNAME}"
1534 | fi
1535 | }
1536 |
1537 | function set_TimeZoneList {
1538 | # ${1}: GeonameID
1539 | set_GeoKitFramework
1540 | QUERY="select ZCOUNTRY from ${PLACES} where ZGEONAMEID = ${1};"
1541 | ZCOUNTRY=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZCOUNTRY = " | awk -F "ZCOUNTRY = " '{print $NF}'`
1542 | QUERY="select ZTIMEZONENAME from ${PLACES} where ZGEONAMEID = ${1};"
1543 | ZTIMEZONENAME=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZTIMEZONENAME = " | awk -F "ZTIMEZONENAME = " '{print $NF}'`
1544 | set_TimeZoneDisplayName "${ZTIMEZONENAME}"
1545 | TimeZoneList=( "${TimeZoneDisplayName}" )
1546 | QUERY="select distinct ZTIMEZONENAME from ${PLACES} where ZCOUNTRY = ${ZCOUNTRY};"
1547 | ZTIMEZONENAMES=( `sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZTIMEZONENAME = " | awk -F "ZTIMEZONENAME = " '{print $NF}'` )
1548 | i=0
1549 | for ZTIMEZONENAME in "${ZTIMEZONENAMES[@]}" ; do
1550 | set_TimeZoneDisplayName "${ZTIMEZONENAME}"
1551 | AddTimeZoneDisplayName=1
1552 | for Element in "${TimeZoneList[@]}" ; do
1553 | if [ "${TimeZoneDisplayName}" == "${Element}" ] ; then AddTimeZoneDisplayName=0 ; break ; fi
1554 | done
1555 | if [ ${AddTimeZoneDisplayName} -eq 1 ] ; then TimeZoneList=( "${TimeZoneList[@]}" "${TimeZoneDisplayName}" ) ; fi
1556 | let i++
1557 | done
1558 | TimeZoneList=( "${TimeZoneList[@]}" "Show All" )
1559 | }
1560 |
1561 | function set_TimeZoneNames {
1562 | # ${1}: TimeZone
1563 | case "${1}" in
1564 | "Niue Time" ) TimeZoneNames=( "Pacific/Niue" ) ;;
1565 | "Samoa Standard Time" ) TimeZoneNames=( "Pacific/Pago_Pago" "Pacific/Apia" ) ;;
1566 | "Cook Islands Time" ) TimeZoneNames=( "Pacific/Rarotonga" ) ;;
1567 | "Hawaii-Aleutian Standard Time" ) TimeZoneNames=( "Pacific/Honolulu" ) ;;
1568 | "Tahiti Time" ) TimeZoneNames=( "Pacific/Tahiti" ) ;;
1569 | "Alaska Standard Time" ) TimeZoneNames=( "America/Juneau" ) ;;
1570 | "Pacific Standard Time" ) TimeZoneNames=( "America/Los_Angeles" "America/Vancouver" "America/Whitehorse" "America/Tijuana" ) ;;
1571 | "Pitcairn Time" ) TimeZoneNames=( "Pacific/Pitcairn" ) ;;
1572 | "Mountain Standard Time" ) TimeZoneNames=( "America/Edmonton" "America/Dawson_Creek" "America/Yellowknife" "America/Mazatlan" "America/Hermosillo" "America/Chihuahua" "America/Phoenix" "America/Denver" "America/Boise" ) ;;
1573 | "Central Standard Time" ) TimeZoneNames=( "America/Belize" "America/Winnipeg" "America/Regina" "America/Swift_Current" "America/Costa_Rica" "America/Guatemala" "America/Tegucigalpa" "America/Mexico_City" "America/Monterrey" "America/Merida" "America/Cancun" "America/Managua" "America/El_Salvador" "America/Chicago" "America/Indiana/Tell_City" "America/North_Dakota/New_Salem" ) ;;
1574 | "Venezuela Time" ) TimeZoneNames=( "America/Caracas" ) ;;
1575 | "Columbia Time" ) TimeZoneNames=( "America/Bogota" ) ;;
1576 | "Cuba Standard Time" ) TimeZoneNames=( "America/Havana" ) ;;
1577 | "Eastern Standard Time" ) TimeZoneNames=( "America/Nassau" "America/Montreal" "America/Toronto" "America/Nipigon" "America/Thunder_Bay" "America/Port-au-Prince" "America/Jamaica" "America/Cayman" "America/Panama" "America/Grand_Turk" "America/New_York" "America/Indiana/Indianapolis" "America/Kentucky/Monticello" "America/Indiana/Vincennes" "America/Kentucky/Louisville" "America/Detroit" ) ;;
1578 | "Ecuador Time" ) TimeZoneNames=( "America/Guayaquil" ) ;;
1579 | "Peru Time" ) TimeZoneNames=( "America/Lima" ) ;;
1580 | "Newfoundland Standard Time" ) TimeZoneNames=( "America/St_Johns" ) ;;
1581 | "Amazon Time" ) TimeZoneNames=( "America/Manaus" "America/Cuiaba" "America/Campo_Grande" "America/Porto_Velho" "America/Boa_Vista" "America/Rio_Branco" ) ;;
1582 | "Atlantic Standard Time" ) TimeZoneNames=( "America/Antigua" "America/Anguilla" "America/Curacao" "America/Aruba" "America/Barbados" "America/Guadeloupe" "Atlantic/Bermuda" "America/Moncton" "America/Halifax" "America/Glace_Bay" "America/Dominica" "America/Santo_Domingo" "America/Grenada" "America/St_Kitts" "America/St_Lucia" "America/Martinique" "America/Montserrat" "America/Puerto_Rico" "America/Port_of_Spain" "America/St_Vincent" "America/Tortola" "America/St_Thomas" ) ;;
1583 | "Bolivia Time" ) TimeZoneNames=( "America/La_Paz" ) ;;
1584 | "Chile Time" ) TimeZoneNames=( "America/Santiago" ) ;;
1585 | "Falkland Islands Time" ) TimeZoneNames=( "Atlantic/Stanley" ) ;;
1586 | "Guyana Time" ) TimeZoneNames=( "America/Guyana" ) ;;
1587 | "Paraguay Time" ) TimeZoneNames=( "America/Asuncion" ) ;;
1588 | "Argentina Time" ) TimeZoneNames=( "America/Argentina/Buenos_Aires" "America/Argentina/Cordoba" "America/Argentina/Tucuman" "America/Argentina/Ushuaia" "America/Argentina/Rio_Gallegos" "America/Argentina/Jujuy" "America/Argentina/Mendoza" "America/Argentina/San_Juan" "America/Argentina/Catamarca" "America/Argentina/La_Rioja" ) ;;
1589 | "Brasilia Time" ) TimeZoneNames=( "America/Belem" "America/Recife" "America/Fortaleza" "America/Maceio" "America/Araguaina" "America/Bahia" "America/Sao_Paulo" ) ;;
1590 | "French Guiana Time" ) TimeZoneNames=( "America/Cayenne" ) ;;
1591 | "Pierre an Miquelon Standard Time" ) TimeZoneNames=( "America/Miquelon" ) ;;
1592 | "Suriname Time" ) TimeZoneNames=( "America/Paramaribo" ) ;;
1593 | "Uruguay Time" ) TimeZoneNames=( "America/Montevideo" ) ;;
1594 | "West Greenland Time" ) TimeZoneNames=( "America/Godthab" ) ;;
1595 | "Fernando de Noronha Time" ) TimeZoneNames=( "America/Noronha" ) ;;
1596 | "South Georgia Time" ) TimeZoneNames=( "Atlantic/South_Georgia" ) ;;
1597 | "Azores Time" ) TimeZoneNames=( "Atlantic/Azores" ) ;;
1598 | "Cape Verde Time" ) TimeZoneNames=( "Atlantic/Cape_Verde" ) ;;
1599 | "Greenwich Mean Time" ) TimeZoneNames=( "Africa/Ouagadougou" "Africa/Abidjan" "Europe/London" "Europe/Guernsey" "Africa/Accra" "Africa/Banjul" "Africa/Conakry" "Africa/Bissau" "Europe/Dublin" "Europe/Isle_of_Man" "Atlantic/Reykjavik" "Europe/Jersey" "Africa/Monrovia" "Africa/Bamako" "Africa/Nouakchott" "Atlantic/St_Helena" "Africa/Freetown" "Africa/Dakar" "Africa/Sao_Tome" "Africa/Lome" ) ;;
1600 | "Western European Time" ) TimeZoneNames=( "Africa/El_Aaiun" "Atlantic/Canary" "Atlantic/Faroe" "Africa/Casablanca" "Europe/Lisbon" "Atlantic/Madeira" ) ;;
1601 | "Central European Time" ) TimeZoneNames=( "Europe/Andorra" "Europe/Tirane" "Europe/Vienna" "Europe/Sarajevo" "Europe/Brussels" "Europe/Zurich" "Europe/Paris" "Europe/Prague" "Europe/Berlin" "Europe/Copenhagen" "Africa/Algiers" "Europe/Madrid" "Africa/Ceuta" "Europe/Gibraltar" "Europe/Zagreb" "Europe/Budapest" "Europe/Rome" "Europe/Vaduz" "Europe/Luxembourg" "Europe/Monaco" "Europe/Podgorica" "Europe/Skopje" "Europe/Malta" "Europe/Amsterdam" "Europe/Oslo" "Europe/Warsaw" "Europe/Belgrade" "Europe/Stockholm" "Europe/Ljubljana" "Arctic/Longyearbyen" "Europe/Bratislava" "Europe/San_Marino" "Africa/Tunis" "Europe/Vatican" ) ;;
1602 | "West Africa Time" ) TimeZoneNames=( "Africa/Luanda" "Africa/Porto-Novo" "Africa/Kinshasa" "Africa/Bangui" "Africa/Brazzaville" "Africa/Douala" "Africa/Libreville" "Africa/Malabo" "Africa/Windhoek" "Africa/Niamey" "Africa/Lagos" "Africa/Ndjamena" ) ;;
1603 | "Central Africa Time" ) TimeZoneNames=( "Africa/Bujumbura" "Africa/Gaborone" "Africa/Lubumbashi" "Africa/Blantyre" "Africa/Maputo" "Africa/Kigali" "Africa/Lusaka" "Africa/Harare" ) ;;
1604 | "Eastern European Time" ) TimeZoneNames=( "Europe/Sofia" "Europe/Minsk" "Asia/Nicosia" "Europe/Tallinn" "Africa/Cairo" "Europe/Helsinki" "Europe/Athens" "Asia/Amman" "Asia/Beirut" "Europe/Vilnius" "Europe/Riga" "Africa/Tripoli" "Europe/Chisinau" "Asia/Gaza" "Europe/Bucharest" "Europe/Kaliningrad" "Asia/Damascus" "Europe/Istanbul" "Europe/Simferopol" "Europe/Zaporozhye" "Europe/Kiev" "Europe/Uzhgorod" ) ;;
1605 | "Israel Standard Time" ) TimeZoneNames=( "Asia/Jerusalem" ) ;;
1606 | "South Africa Standard Time" ) TimeZoneNames=( "Africa/Maseru" "Africa/Mbabane" "Africa/Johannesburg" ) ;;
1607 | "Arabian Standard Time" ) TimeZoneNames=( "Asia/Bahrain" "Asia/Baghdad" "Asia/Kuwait" "Asia/Qatar" "Asia/Riyadh" "Asia/Aden" ) ;;
1608 | "East Africa Time" ) TimeZoneNames=( "Africa/Djibouti" "Africa/Asmara" "Africa/Addis_Ababa" "Africa/Nairobi" "Indian/Comoro" "Indian/Antananarivo" "Africa/Khartoum" "Africa/Mogadishu" "Africa/Dar_es_Salaam" "Africa/Kampala" "Indian/Mayotte" ) ;;
1609 | "Moscow Standard Time" ) TimeZoneNames=( "Europe/Moscow" ) ;;
1610 | "Volgograd Time" ) TimeZoneNames=( "Europe/Volgograd" ) ;;
1611 | "Iran Standard Time" ) TimeZoneNames=( "Asia/Tehran" ) ;;
1612 | "Armenia Time" ) TimeZoneNames=( "Asia/Yerevan" ) ;;
1613 | "Azerbaijan Time" ) TimeZoneNames=( "Asia/Baku" ) ;;
1614 | "Georgia Time" ) TimeZoneNames=( "Asia/Tbilisi" ) ;;
1615 | "Gulf Standard Time" ) TimeZoneNames=( "Asia/Dubai" "Asia/Muscat" ) ;;
1616 | "Mauritius Time" ) TimeZoneNames=( "Indian/Mauritius" ) ;;
1617 | "Reunion Time" ) TimeZoneNames=( "Indian/Reunion" ) ;;
1618 | "Samara Time" ) TimeZoneNames=( "Europe/Samara" ) ;;
1619 | "Seychelles Time" ) TimeZoneNames=( "Indian/Mahe" ) ;;
1620 | "Afghanistan Time" ) TimeZoneNames=( "Asia/Kabul" ) ;;
1621 | "Maldives Time" ) TimeZoneNames=( "Indian/Maldives" ) ;;
1622 | "Pakistan Time" ) TimeZoneNames=( "Asia/Karachi" ) ;;
1623 | "Tajikistan Time" ) TimeZoneNames=( "Asia/Dushanbe" ) ;;
1624 | "Turkmenistan Time" ) TimeZoneNames=( "Asia/Ashgabat" ) ;;
1625 | "Uzbekistan Time" ) TimeZoneNames=( "Asia/Samarkand" "Asia/Tashkent" ) ;;
1626 | "West Kazakhstan Standard Time" ) TimeZoneNames=( "Asia/Oral" "Asia/Aqtau" "Asia/Aqtobe" ) ;;
1627 | "Yekaterinburg Time" ) TimeZoneNames=( "Asia/Yekaterinburg" ) ;;
1628 | "India Standard Time" ) TimeZoneNames=( "Asia/Kolkata" "Asia/Colombo" ) ;;
1629 | "Bangladesh Time" ) TimeZoneNames=( "Asia/Dhaka" ) ;;
1630 | "Bhutan Time" ) TimeZoneNames=( "Asia/Thimphu" ) ;;
1631 | "East Kazakhstan Standard Time" ) TimeZoneNames=( "Asia/Almaty" "Asia/Qyzylorda" ) ;;
1632 | "Kyrgystan Time" ) TimeZoneNames=( "Asia/Bishkek" ) ;;
1633 | "Omsk Time" ) TimeZoneNames=( "Asia/Omsk" ) ;;
1634 | "Myanmar Time" ) TimeZoneNames=( "Asia/Rangoon" ) ;;
1635 | "Christmas Island Time" ) TimeZoneNames=( "Indian/Christmas" ) ;;
1636 | "Indochina Time" ) TimeZoneNames=( "Asia/Phnom_Penh" "Asia/Vientiane" "Asia/Bangkok" "Asia/Ho_Chi_Minh" ) ;;
1637 | "Krasnoyarsk Time" ) TimeZoneNames=( "Asia/Krasnoyarsk" ) ;;
1638 | "Western Indonesia Time" ) TimeZoneNames=( "Asia/Pontianak" "Asia/Jakarta" ) ;;
1639 | "Australian Western Standard Time" ) TimeZoneNames=( "Australia/Perth" ) ;;
1640 | "Brunei Darussalam Time" ) TimeZoneNames=( "Asia/Brunei" ) ;;
1641 | "Central Indonesia Time" ) TimeZoneNames=( "Asia/Makassar" ) ;;
1642 | "China Standard Time" ) TimeZoneNames=( "Asia/Urumqi" "Asia/Kashgar" "Asia/Chongqing" "Asia/Shanghai" "Asia/Harbin" "Asia/Macau" ) ;;
1643 | "GMT+08:00" ) TimeZoneNames=( "Asia/Taipei" ) ;;
1644 | "Hong Kong Time" ) TimeZoneNames=( "Asia/Hong_Kong" ) ;;
1645 | "Irkutsk Time" ) TimeZoneNames=( "Asia/Irkutsk" ) ;;
1646 | "Malaysia Time" ) TimeZoneNames=( "Asia/Kuala_Lumpur" "Asia/Kuching" ) ;;
1647 | "Philippine Time" ) TimeZoneNames=( "Asia/Manila" ) ;;
1648 | "Singapore Standard Time" ) TimeZoneNames=( "Asia/Singapore" ) ;;
1649 | "Ulan Bator Time" ) TimeZoneNames=( "Asia/Ulaanbaatar" ) ;;
1650 | "East Timor Time" ) TimeZoneNames=( "Asia/Dili" ) ;;
1651 | "Eastern Indonesia Time" ) TimeZoneNames=( "Asia/Jayapura" ) ;;
1652 | "Japan Standard Time" ) TimeZoneNames=( "Asia/Tokyo" ) ;;
1653 | "Korean Standard Time" ) TimeZoneNames=( "Asia/Pyongyang" "Asia/Seoul" ) ;;
1654 | "Palau Time" ) TimeZoneNames=( "Pacific/Palau" ) ;;
1655 | "Yakutsk Time" ) TimeZoneNames=( "Asia/Yakutsk" ) ;;
1656 | "Australian Central Standard Time" ) TimeZoneNames=( "Australia/Adelaide" "Australia/Darwin" "Australia/Broken_Hill" ) ;;
1657 | "Australia Eastern Standard Time" ) TimeZoneNames=( "Australia/Sydney" "Australia/Melbourne" "Australia/Brisbane" "Australia/Hobart" ) ;;
1658 | "Chamorro Standard Time" ) TimeZoneNames=( "Pacific/Guam" ) ;;
1659 | "Papua New Guinea Time" ) TimeZoneNames=( "Pacific/Port_Moresby" ) ;;
1660 | "Sakhalin Time" ) TimeZoneNames=( "Asia/Sakhalin" ) ;;
1661 | "Vladivostok Time" ) TimeZoneNames=( "Asia/Vladivostok" ) ;;
1662 | "Magadan Time" ) TimeZoneNames=( "Asia/Magadan" ) ;;
1663 | "New Caledonia Time" ) TimeZoneNames=( "Pacific/Noumea" ) ;;
1664 | "Ponape Time" ) TimeZoneNames=( "Pacific/Ponape" ) ;;
1665 | "Solomon Islands Time" ) TimeZoneNames=( "Pacific/Guadalcanal" ) ;;
1666 | "Vanuatu Time" ) TimeZoneNames=( "Pacific/Efate" ) ;;
1667 | "Norfolk Islands Time" ) TimeZoneNames=( "Pacific/Norfolk" ) ;;
1668 | "Anadyr Time" ) TimeZoneNames=( "Asia/Anadyr" ) ;;
1669 | "Fiji Time" ) TimeZoneNames=( "Pacific/Fiji" ) ;;
1670 | "Gilbert Islands Time" ) TimeZoneNames=( "Pacific/Tarawa" ) ;;
1671 | "Marshall Islands Time" ) TimeZoneNames=( "Pacific/Majuro" ) ;;
1672 | "New Zealand Standard Time" ) TimeZoneNames=( "Pacific/Auckland" ) ;;
1673 | "Petropavlovsk-Kamchatsky Time" ) TimeZoneNames=( "Asia/Kamchatka" ) ;;
1674 | "Tuvalu Time" ) TimeZoneNames=( "Pacific/Funafuti" ) ;;
1675 | "Tonga Time" ) TimeZoneNames=( "Pacific/Tongatapu" ) ;;
1676 | esac
1677 | }
1678 |
1679 | function set_CountryCode {
1680 | # ${1}: ZCOUNTRY
1681 | set_GeoKitFramework
1682 | QUERY="select ZNAME from ZGEOPLACENAME where ZPLACE = ${1} and ZEN > 0;"
1683 | ZPLACE=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZPLACE = " | awk -F "ZPLACE = " '{print $NF}'`
1684 | case "${ZPLACE}" in
1685 | "Afghanistan" ) CountryCode="AF" ;;
1686 | "Åland Islands" ) CountryCode="AX" ;;
1687 | "Albania" ) CountryCode="AL" ;;
1688 | "Algeria" ) CountryCode="DZ" ;;
1689 | "American Samoa" ) CountryCode="AS" ;;
1690 | "Andorra" ) CountryCode="AD" ;;
1691 | "Angola" ) CountryCode="AO" ;;
1692 | "Anguilla" ) CountryCode="AI" ;;
1693 | "Antarctica" ) CountryCode="AQ" ;;
1694 | "Antigua and Barbuda" ) CountryCode="AG" ;;
1695 | "Argentina" ) CountryCode="AR" ;;
1696 | "Armenia" ) CountryCode="AM" ;;
1697 | "Aruba" ) CountryCode="AW" ;;
1698 | "Australia" ) CountryCode="AU" ;;
1699 | "Austria" ) CountryCode="AT" ;;
1700 | "Azerbaijan" ) CountryCode="AZ" ;;
1701 | "Bahamas" ) CountryCode="BS" ;;
1702 | "Bahrain" ) CountryCode="BH" ;;
1703 | "Bangladesh" ) CountryCode="BD" ;;
1704 | "Barbados" ) CountryCode="BB" ;;
1705 | "Belarus" ) CountryCode="BY" ;;
1706 | "Belgium" ) CountryCode="BE" ;;
1707 | "Belize" ) CountryCode="BZ" ;;
1708 | "Benin" ) CountryCode="BJ" ;;
1709 | "Bermuda" ) CountryCode="BM" ;;
1710 | "Bhutan" ) CountryCode="BT" ;;
1711 | "Bolivia" ) CountryCode="BO" ;;
1712 | "Bosnia and Herzegovina" ) CountryCode="BA" ;;
1713 | "Botswana" ) CountryCode="BW" ;;
1714 | "Brazil" ) CountryCode="BR" ;;
1715 | "British Virgin Islands" ) CountryCode="VG" ;;
1716 | "Brunei" ) CountryCode="BN" ;;
1717 | "Bulgaria" ) CountryCode="BG" ;;
1718 | "Burkina Faso" ) CountryCode="BF" ;;
1719 | "Burundi" ) CountryCode="BI" ;;
1720 | "Cambodia" ) CountryCode="KH" ;;
1721 | "Cameroon" ) CountryCode="CM" ;;
1722 | "Canada" ) CountryCode="CA" ;;
1723 | "Cape Verde" ) CountryCode="CV" ;;
1724 | "Cayman Islands" ) CountryCode="KY" ;;
1725 | "Central African Republic" ) CountryCode="CF" ;;
1726 | "Chad" ) CountryCode="TD" ;;
1727 | "Chile" ) CountryCode="CL" ;;
1728 | "China" ) CountryCode="CN" ;;
1729 | "Christmas Island" ) CountryCode="CX" ;;
1730 | "Cocos [Keeling] Islands" ) CountryCode="CC" ;;
1731 | "Colombia" ) CountryCode="CO" ;;
1732 | "Comoros" ) CountryCode="KM" ;;
1733 | "Congo - Brazzaville" ) CountryCode="CG" ;;
1734 | "Congo - Kinshasa" ) CountryCode="CD" ;;
1735 | "Cook Islands" ) CountryCode="CK" ;;
1736 | "Costa Rica" ) CountryCode="CR" ;;
1737 | "Côte d’Ivoire" ) CountryCode="CI" ;;
1738 | "Croatia" ) CountryCode="HR" ;;
1739 | "Cuba" ) CountryCode="CU" ;;
1740 | "Cyprus" ) CountryCode="CY" ;;
1741 | "Czech Republic" ) CountryCode="CZ" ;;
1742 | "Denmark" ) CountryCode="DK" ;;
1743 | "Djibouti" ) CountryCode="DJ" ;;
1744 | "Dominica" ) CountryCode="DM" ;;
1745 | "Dominican Republic" ) CountryCode="DO" ;;
1746 | "East Timor" ) CountryCode="TL" ;;
1747 | "Ecuador" ) CountryCode="EC" ;;
1748 | "Egypt" ) CountryCode="EG" ;;
1749 | "El Salvador" ) CountryCode="SV" ;;
1750 | "Equatorial Guinea" ) CountryCode="GQ" ;;
1751 | "Eritrea" ) CountryCode="ER" ;;
1752 | "Estonia" ) CountryCode="EE" ;;
1753 | "Ethiopia" ) CountryCode="ET" ;;
1754 | "Falkland Islands" ) CountryCode="FK" ;;
1755 | "Faroe Islands" ) CountryCode="FO" ;;
1756 | "Fiji" ) CountryCode="FJ" ;;
1757 | "Finland" ) CountryCode="FI" ;;
1758 | "France" ) CountryCode="FR" ;;
1759 | "French Guiana" ) CountryCode="GF" ;;
1760 | "French Polynesia" ) CountryCode="PF" ;;
1761 | "French Southern Territories" ) CountryCode="TF" ;;
1762 | "Gabon" ) CountryCode="GA" ;;
1763 | "Gambia" ) CountryCode="GM" ;;
1764 | "Georgia" ) CountryCode="GE" ;;
1765 | "Germany" ) CountryCode="DE" ;;
1766 | "Ghana" ) CountryCode="GH" ;;
1767 | "Gibraltar" ) CountryCode="GI" ;;
1768 | "Greece" ) CountryCode="GR" ;;
1769 | "Greenland" ) CountryCode="GL" ;;
1770 | "Grenada" ) CountryCode="GD" ;;
1771 | "Guadeloupe" ) CountryCode="GP" ;;
1772 | "Guam" ) CountryCode="GU" ;;
1773 | "Guatemala" ) CountryCode="GT" ;;
1774 | "Guernsey" ) CountryCode="GG" ;;
1775 | "Guinea" ) CountryCode="GN" ;;
1776 | "Guinea-Bissau" ) CountryCode="GW" ;;
1777 | "Guyana" ) CountryCode="GY" ;;
1778 | "Haiti" ) CountryCode="HT" ;;
1779 | "Honduras" ) CountryCode="HN" ;;
1780 | "Hong Kong SAR China" ) CountryCode="HK" ;;
1781 | "Hungary" ) CountryCode="HU" ;;
1782 | "Iceland" ) CountryCode="IS" ;;
1783 | "India" ) CountryCode="IN" ;;
1784 | "Indonesia" ) CountryCode="ID" ;;
1785 | "Iran" ) CountryCode="IR" ;;
1786 | "Iraq" ) CountryCode="IQ" ;;
1787 | "Ireland" ) CountryCode="IE" ;;
1788 | "Isle of Man" ) CountryCode="IM" ;;
1789 | "Israel" ) CountryCode="IL" ;;
1790 | "Italy" ) CountryCode="IT" ;;
1791 | "Ivory Coast" ) CountryCode="CI" ;;
1792 | "Jamaica" ) CountryCode="JM" ;;
1793 | "Japan" ) CountryCode="JP" ;;
1794 | "Jersey" ) CountryCode="JE" ;;
1795 | "Jordan" ) CountryCode="JO" ;;
1796 | "Kazakhstan" ) CountryCode="KZ" ;;
1797 | "Kenya" ) CountryCode="KE" ;;
1798 | "Kiribati" ) CountryCode="KI" ;;
1799 | "Kuwait" ) CountryCode="KW" ;;
1800 | "Kyrgyzstan" ) CountryCode="KG" ;;
1801 | "Laos" ) CountryCode="LA" ;;
1802 | "Latvia" ) CountryCode="LV" ;;
1803 | "Lebanon" ) CountryCode="LB" ;;
1804 | "Lesotho" ) CountryCode="LS" ;;
1805 | "Liberia" ) CountryCode="LR" ;;
1806 | "Libya" ) CountryCode="LY" ;;
1807 | "Liechtenstein" ) CountryCode="LI" ;;
1808 | "Lithuania" ) CountryCode="LT" ;;
1809 | "Luxembourg" ) CountryCode="LU" ;;
1810 | "Macau SAR China" ) CountryCode="MO" ;;
1811 | "Macedonia" ) CountryCode="MK" ;;
1812 | "Madagascar" ) CountryCode="MG" ;;
1813 | "Malawi" ) CountryCode="MW" ;;
1814 | "Malaysia" ) CountryCode="MY" ;;
1815 | "Maldives" ) CountryCode="MV" ;;
1816 | "Mali" ) CountryCode="ML" ;;
1817 | "Malta" ) CountryCode="MT" ;;
1818 | "Marshall Islands" ) CountryCode="MH" ;;
1819 | "Martinique" ) CountryCode="MQ" ;;
1820 | "Mauritania" ) CountryCode="MR" ;;
1821 | "Mauritius" ) CountryCode="MU" ;;
1822 | "Mayotte" ) CountryCode="YT" ;;
1823 | "Mexico" ) CountryCode="MX" ;;
1824 | "Micronesia" ) CountryCode="FM" ;;
1825 | "Moldova" ) CountryCode="MD" ;;
1826 | "Monaco" ) CountryCode="MC" ;;
1827 | "Mongolia" ) CountryCode="MN" ;;
1828 | "Montenegro" ) CountryCode="ME" ;;
1829 | "Montserrat" ) CountryCode="MS" ;;
1830 | "Morocco" ) CountryCode="MA" ;;
1831 | "Mozambique" ) CountryCode="MZ" ;;
1832 | "Myanmar" ) CountryCode="MM" ;;
1833 | "Myanmar [Burma]" ) CountryCode="MM" ;;
1834 | "Namibia" ) CountryCode="NA" ;;
1835 | "Nauru" ) CountryCode="NR" ;;
1836 | "Nepal" ) CountryCode="NP" ;;
1837 | "Netherlands" ) CountryCode="NL" ;;
1838 | "Netherlands Antilles" ) CountryCode="AN" ;;
1839 | "New Caledonia" ) CountryCode="NC" ;;
1840 | "New Zealand" ) CountryCode="NZ" ;;
1841 | "Nicaragua" ) CountryCode="NI" ;;
1842 | "Niger" ) CountryCode="NE" ;;
1843 | "Nigeria" ) CountryCode="NG" ;;
1844 | "Niue" ) CountryCode="NU" ;;
1845 | "Norfolk Island" ) CountryCode="NF" ;;
1846 | "North Korea" ) CountryCode="KP" ;;
1847 | "Northern Mariana Islands" ) CountryCode="MP" ;;
1848 | "Norway" ) CountryCode="NO" ;;
1849 | "Oman" ) CountryCode="OM" ;;
1850 | "Pakistan" ) CountryCode="PK" ;;
1851 | "Palau" ) CountryCode="PW" ;;
1852 | "Palestinian Territories" ) CountryCode="PS" ;;
1853 | "Palestinian Territory" ) CountryCode="PS" ;;
1854 | "Panama" ) CountryCode="PA" ;;
1855 | "Papua New Guinea" ) CountryCode="PG" ;;
1856 | "Paraguay" ) CountryCode="PY" ;;
1857 | "Peru" ) CountryCode="PE" ;;
1858 | "Philippines" ) CountryCode="PH" ;;
1859 | "Pitcairn" ) CountryCode="PN" ;;
1860 | "Pitcairn Islands" ) CountryCode="PN" ;;
1861 | "Poland" ) CountryCode="PL" ;;
1862 | "Portugal" ) CountryCode="PT" ;;
1863 | "Puerto Rico" ) CountryCode="PR" ;;
1864 | "Qatar" ) CountryCode="QA" ;;
1865 | "Reunion" ) CountryCode="RE" ;;
1866 | "Réunion" ) CountryCode="RE" ;;
1867 | "Romania" ) CountryCode="RO" ;;
1868 | "Russia" ) CountryCode="RU" ;;
1869 | "Rwanda" ) CountryCode="RW" ;;
1870 | "Saint Barthélemy" ) CountryCode="BL" ;;
1871 | "Saint Helena" ) CountryCode="SH" ;;
1872 | "Saint Kitts and Nevis" ) CountryCode="KN" ;;
1873 | "Saint Lucia" ) CountryCode="LC" ;;
1874 | "Saint Martin" ) CountryCode="MF" ;;
1875 | "Saint Pierre and Miquelon" ) CountryCode="PM" ;;
1876 | "Saint Vincent and the Grenadines" ) CountryCode="VC" ;;
1877 | "Samoa" ) CountryCode="WS" ;;
1878 | "San Marino" ) CountryCode="SM" ;;
1879 | "Sao Tome and Principe" ) CountryCode="ST" ;;
1880 | "São Tomé and Príncipe" ) CountryCode="ST" ;;
1881 | "Saudi Arabia" ) CountryCode="SA" ;;
1882 | "Senegal" ) CountryCode="SN" ;;
1883 | "Serbia" ) CountryCode="RS" ;;
1884 | "Seychelles" ) CountryCode="SC" ;;
1885 | "Sierra Leone" ) CountryCode="SL" ;;
1886 | "Singapore" ) CountryCode="SG" ;;
1887 | "Slovakia" ) CountryCode="SK" ;;
1888 | "Slovenia" ) CountryCode="SI" ;;
1889 | "Solomon Islands" ) CountryCode="SB" ;;
1890 | "Somalia" ) CountryCode="SO" ;;
1891 | "South Africa" ) CountryCode="ZA" ;;
1892 | "South Georgia and the South Sandwich Islands" ) CountryCode="GS" ;;
1893 | "South Korea" ) CountryCode="KR" ;;
1894 | "Spain" ) CountryCode="ES" ;;
1895 | "Sri Lanka" ) CountryCode="LK" ;;
1896 | "Sudan" ) CountryCode="SD" ;;
1897 | "Suriname" ) CountryCode="SR" ;;
1898 | "Svalbard and Jan Mayen" ) CountryCode="SJ" ;;
1899 | "Swaziland" ) CountryCode="SZ" ;;
1900 | "Sweden" ) CountryCode="SE" ;;
1901 | "Switzerland" ) CountryCode="CH" ;;
1902 | "Syria" ) CountryCode="SY" ;;
1903 | "Taiwan" ) CountryCode="TW" ;;
1904 | "Tajikistan" ) CountryCode="TJ" ;;
1905 | "Tanzania" ) CountryCode="TZ" ;;
1906 | "Thailand" ) CountryCode="TH" ;;
1907 | "Timor-Leste" ) CountryCode="TL" ;;
1908 | "Togo" ) CountryCode="TG" ;;
1909 | "Tonga" ) CountryCode="TO" ;;
1910 | "Trinidad and Tobago" ) CountryCode="TT" ;;
1911 | "Tunisia" ) CountryCode="TN" ;;
1912 | "Turkey" ) CountryCode="TR" ;;
1913 | "Turkmenistan" ) CountryCode="TM" ;;
1914 | "Turks and Caicos Islands" ) CountryCode="TC" ;;
1915 | "Tuvalu" ) CountryCode="TV" ;;
1916 | "U.S. Virgin Islands" ) CountryCode="VI" ;;
1917 | "Uganda" ) CountryCode="UG" ;;
1918 | "Ukraine" ) CountryCode="UA" ;;
1919 | "United Arab Emirates" ) CountryCode="AE" ;;
1920 | "United Kingdom" ) CountryCode="GB" ;;
1921 | "United States" ) CountryCode="US" ;;
1922 | "Uruguay" ) CountryCode="UY" ;;
1923 | "Uzbekistan" ) CountryCode="UZ" ;;
1924 | "Vanuatu" ) CountryCode="VU" ;;
1925 | "Vatican" ) CountryCode="VA" ;;
1926 | "Vatican City" ) CountryCode="VA" ;;
1927 | "Venezuela" ) CountryCode="VE" ;;
1928 | "Vietnam" ) CountryCode="VN" ;;
1929 | "Wallis and Futuna" ) CountryCode="WF" ;;
1930 | "Western Sahara" ) CountryCode="EH" ;;
1931 | "Yemen" ) CountryCode="YE" ;;
1932 | "Zambia" ) CountryCode="ZM" ;;
1933 | "Zimbabwe" ) CountryCode="ZW" ;;
1934 | esac
1935 | }
1936 |
1937 | function get_TimeZone {
1938 | set_GeoKitFramework
1939 | prefTimezoneAuto=`/usr/libexec/PlistBuddy -c "Print ':TimezoneAuto'" ~/Library/Preferences/au.com.mondada.SIC.plist 2>/dev/null`
1940 | if [ ${?} -ne 0 ] ; then prefTimezoneAuto=`/usr/libexec/PlistBuddy -c "Print ':Active'" "/Library/Preferences/com.apple.timezone.auto.plist" 2>/dev/null` ; fi
1941 | if [ ${?} -ne 0 ] ; then prefTimezoneAuto="" ; fi
1942 | if [ -n "${prefTimezoneAuto}" ] ; then TimezoneAuto="${prefTimezoneAuto}" ; fi
1943 | prefGeonameID=`defaults read ~/Library/Preferences/au.com.mondada.SIC "GeonameID" 2>/dev/null`
1944 | if [ -z "${prefGeonameID}" ] ; then prefGeonameID=`/usr/libexec/PlistBuddy -c "Print ':com.apple.preferences.timezone.selected_city:GeonameID'" "/Library/Preferences/.GlobalPreferences.plist"` ; fi
1945 | if [ -n "${prefGeonameID}" ] ; then GeonameID=${prefGeonameID} ; fi
1946 | echo "GeonameID: ${GeonameID}"
1947 | QUERY="select ZCOUNTRY from ${PLACES} where ZGEONAMEID = ${GeonameID};"
1948 | ZCOUNTRY=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZCOUNTRY = " | awk -F "ZCOUNTRY = " '{print $NF}'`
1949 | set_CountryCode ${ZCOUNTRY}
1950 | set_TimeZone ${GeonameID}
1951 | set_ClosestCity ${GeonameID}
1952 | }
1953 |
1954 | function save_TimeZone {
1955 | defaults write ~/Library/Preferences/au.com.mondada.SIC "TimezoneAuto" -bool "${TimezoneAuto}"
1956 | defaults write ~/Library/Preferences/au.com.mondada.SIC "GeonameID" -int ${GeonameID}
1957 | }
1958 |
1959 | function display_TimeZone {
1960 | echo "Time Zone: ${TimeZone}"
1961 | echo "Closest City: ${ClosestCity}"
1962 | printf " ["
1963 | if [ "${TimezoneAuto}" == "true" ] ; then printf "*" ; else printf " " ; fi
1964 | echo "] Set time zone automatically using current location"
1965 | }
1966 |
1967 | function select_TimeZone {
1968 | set_GeoKitFramework
1969 | set_TimeZoneList ${GeonameID}
1970 | display_Title "Select Time Zone"
1971 | display_TimeZone
1972 | display_Options "Time zones" "Select your Time Zone: "
1973 | select newTimeZone in "${TimeZoneList[@]}" ; do
1974 | while [ "${newTimeZone}" == "Show All" ] ; do
1975 | TimeZoneList=( "Niue Time" "Samoa Standard Time" "Cook Islands Time" "Hawaii-Aleutian Standard Time" "Tahiti Time" "Alaska Standard Time" "Pacific Standard Time" "Pitcairn Time" "Mountain Standard Time" "Central Standard Time" "Venezuela Time" "Columbia Time" "Cuba Standard Time" "Eastern Standard Time" "Ecuador Time" "Peru Time" "Newfoundland Standard Time" "Amazon Time" "Atlantic Standard Time" "Bolivia Time" "Chile Time" "Falkland Islands Time" "Guyana Time" "Paraguay Time" "Argentina Time" "Brasilia Time" "French Guiana Time" "Pierre an Miquelon Standard Time" "Suriname Time" "Uruguay Time" "West Greenland Time" "Fernando de Noronha Time" "South Georgia Time" "Azores Time" "Cape Verde Time" "Greenwich Mean Time" "Western European Time" "Central European Time" "West Africa Time" "Central Africa Time" "Eastern European Time" "Israel Standard Time" "South Africa Standard Time" "Arabian Standard Time" "East Africa Time" "Moscow Standard Time" "Volgograd Time" "Iran Standard Time" "Armenia Time" "Azerbaijan Time" "Georgia Time" "Gulf Standard Time" "Mauritius Time" "Reunion Time" "Samara Time" "Seychelles Time" "Afghanistan Time" "Maldives Time" "Pakistan Time" "Tajikistan Time" "Turkmenistan Time" "Uzbekistan Time" "West Kazakhstan Standard Time" "Yekaterinburg Time" "India Standard Time" "Bangladesh Time" "Bhutan Time" "East Kazakhstan Standard Time" "Kyrgystan Time" "Omsk Time" "Myanmar Time" "Christmas Island Time" "Indochina Time" "Krasnoyarsk Time" "Western Indonesia Time" "Australian Western Standard Time" "Brunei Darussalam Time" "Central Indonesia Time" "China Standard Time" "GMT+08:00" "Hong Kong Time" "Irkutsk Time" "Malaysia Time" "Philippine Time" "Singapore Standard Time" "Ulan Bator Time" "East Timor Time" "Eastern Indonesia Time" "Japan Standard Time" "Korean Standard Time" "Palau Time" "Yakutsk Time" "Australian Central Standard Time" "Australia Eastern Standard Time" "Chamorro Standard Time" "Papua New Guinea Time" "Sakhalin Time" "Vladivostok Time" "Magadan Time" "New Caledonia Time" "Ponape Time" "Solomon Islands Time" "Vanuatu Time" "Norfolk Islands Time" "Anadyr Time" "Fiji Time" "Gilbert Islands Time" "Marshall Islands Time" "New Zealand Standard Time" "Petropavlovsk-Kamchatsky Time" "Tuvalu Time" "Tonga Time" )
1976 | display_Title "Select Time Zone"
1977 | display_TimeZone
1978 | display_Options "Time zones" "Select your Time Zone: "
1979 | select newTimeZone in "${TimeZoneList[@]}" ; do
1980 | if [ -n "${newTimeZone}" ] ; then break ; fi
1981 | done
1982 | done
1983 | if [ -n "${newTimeZone}" ] ; then break ; fi
1984 | done
1985 | if [ "${newTimeZone}" != "${TimeZone}" ] ; then
1986 | TimeZone="${newTimeZone}"
1987 | ClosestCity=""
1988 | fi
1989 | set_TimeZoneNames "${TimeZone}"
1990 | i=0
1991 | for ZTIMEZONENAME in "${TimeZoneNames[@]}" ; do
1992 | QUERY="select distinct ZCOUNTRY from ${PLACES} where ZTIMEZONENAME = \"${ZTIMEZONENAME}\";"
1993 | RESULTS=( `sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZCOUNTRY = " | awk -F "ZCOUNTRY = " '{print $NF}'` )
1994 | for ZCOUNTRY in ${RESULTS} ; do
1995 | if [ ${i} -eq 0 ] ; then
1996 | ZCOUNTRIES=( ${ZCOUNTRY} )
1997 | else
1998 | AddELEMENT=1
1999 | for ELEMENT in ${ZCOUNTRIES[@]} ; do
2000 | if [ ${ZCOUNTRY} -eq ${ELEMENT} ] ; then AddELEMENT=0 ; break ; fi
2001 | done
2002 | if [ ${AddELEMENT} -eq 1 ] ; then ZCOUNTRIES=( ${ZCOUNTRIES[@]} ${ZCOUNTRY} ) ; fi
2003 | fi
2004 | done
2005 | let i++
2006 | done
2007 | if [ ${#ZCOUNTRIES[@]} -gt 1 ] ; then
2008 | unset ZCOUNTRYNAMES[@]
2009 | i=0
2010 | for ZCOUNTRY in ${ZCOUNTRIES[@]} ; do
2011 | QUERY="select ZNAME from ZGEOPLACENAME where ZEN > 0 and ZPLACE = ${ZCOUNTRY};"
2012 | ZCOUNTRYNAMES[i]=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZNAME = " | awk -F "ZNAME = " '{print $NF}'`
2013 | let i++
2014 | done
2015 | display_Title "Select Time Zone"
2016 | display_TimeZone
2017 | display_Options "Countries" "Select the country or region: "
2018 | select ZCOUNTRYNAME in "${ZCOUNTRYNAMES[@]}" ; do
2019 | if [ -n "${ZCOUNTRYNAME}" ] ; then break ; fi
2020 | done
2021 | i=0
2022 | for NAME in "${ZCOUNTRYNAMES[@]}" ; do
2023 | if [ "${NAME}" == "${ZCOUNTRYNAME}" ] ; then ZCOUNTRY=${ZCOUNTRIES[i]} ; break ; fi
2024 | let i++
2025 | done
2026 | else
2027 | ZCOUNTRY=${ZCOUNTRIES[0]}
2028 | fi
2029 | unset ZTIMEZONENAMES[@]
2030 | for TimeZoneName in "${TimeZoneNames[@]}" ; do
2031 | QUERY="select distinct ZTIMEZONENAME from ${PLACES} where ZCOUNTRY = ${ZCOUNTRY} and ZTIMEZONENAME = \"${TimeZoneName}\";"
2032 | ZTIMEZONENAME=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZTIMEZONENAME = " | awk -F "ZTIMEZONENAME = " '{print $NF}'`
2033 | if [ -n "${ZTIMEZONENAME}" ] ; then ZTIMEZONENAMES=( "${ZTIMEZONENAMES[@]}" "${ZTIMEZONENAME}" ) ; fi
2034 | done
2035 | QUERY="select ZGEONAMEID from ${PLACES} where ZCOUNTRY = ${ZCOUNTRY} and ZTIMEZONENAME = \"${ZTIMEZONENAMES[0]}\";"
2036 | ZGEONAMEIDS=( `sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZGEONAMEID = " | awk -F "ZGEONAMEID = " '{print $NF}'` )
2037 | if [ ${#ZGEONAMEIDS[@]} -gt 1 ] ; then
2038 | unset ZNAMEREGIONALCODES[@]
2039 | i=0
2040 | for ZGEONAMEID in ${ZGEONAMEIDS[@]} ; do
2041 | QUERY="select ZNAME from ${PLACES} where ZGEONAMEID = ${ZGEONAMEID};"
2042 | ZNAME=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZNAME = " | awk -F "ZNAME = " '{print $NF}'`
2043 | QUERY="select ZREGIONALCODE from ${PLACES} where ZGEONAMEID = ${ZGEONAMEID};"
2044 | ZREGIONALCODE=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZREGIONALCODE = " | awk -F "ZREGIONALCODE = " '{print $NF}'`
2045 | if [ -n "${ZREGIONALCODE}" ] ; then
2046 | ZNAMEREGIONALCODES[i]="${ZNAME}, ${ZREGIONALCODE}"
2047 | else
2048 | ZNAMEREGIONALCODES[i]="${ZNAME}"
2049 | fi
2050 | let i++
2051 | done
2052 | if [ ${#ZTIMEZONENAMES[@]} -gt 1 ] ; then ZNAMEREGIONALCODES=( "${ZNAMEREGIONALCODES[@]}" "Show All" ) ; fi
2053 | display_Title "Select Time Zone"
2054 | display_TimeZone
2055 | display_Options "Cities" "Select the closest city: "
2056 | select ZNAMEREGIONALCODE in "${ZNAMEREGIONALCODES[@]}" ; do
2057 | while [ "${ZNAMEREGIONALCODE}" == "Show All" ] ; do
2058 | i=1
2059 | while [ ${i} -lt ${#ZTIMEZONENAMES[@]} ] ; do
2060 | QUERY="select ZGEONAMEID from ${PLACES} where ZCOUNTRY = ${ZCOUNTRY} and ZTIMEZONENAME = \"${ZTIMEZONENAMES[i]}\";"
2061 | ZGEONAMEIDS=( ${ZGEONAMEIDS[@]} `sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZGEONAMEID = " | awk -F "ZGEONAMEID = " '{print $NF}'` )
2062 | let i++
2063 | done
2064 | i=0
2065 | for ZGEONAMEID in ${ZGEONAMEIDS[@]} ; do
2066 | QUERY="select ZNAME from ${PLACES} where ZGEONAMEID = ${ZGEONAMEID};"
2067 | ZNAME=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZNAME = " | awk -F "ZNAME = " '{print $NF}'`
2068 | QUERY="select ZREGIONALCODE from ${PLACES} where ZGEONAMEID = ${ZGEONAMEID};"
2069 | ZREGIONALCODE=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZREGIONALCODE = " | awk -F "ZREGIONALCODE = " '{print $NF}'`
2070 | if [ -n "${ZREGIONALCODE}" ] ; then
2071 | ZNAMEREGIONALCODES[i]="${ZNAME}, ${ZREGIONALCODE}"
2072 | else
2073 | ZNAMEREGIONALCODES[i]="${ZNAME}"
2074 | fi
2075 | let i++
2076 | done
2077 | display_Title "Select Time Zone"
2078 | display_TimeZone
2079 | display_Options "Cities" "Select the closest city: "
2080 | select ZNAMEREGIONALCODE in "${ZNAMEREGIONALCODES[@]}" ; do
2081 | if [ -n "${ZNAMEREGIONALCODE}" ] ; then break ; fi
2082 | done
2083 | done
2084 | if [ -n "${ZNAMEREGIONALCODE}" ] ; then break ; fi
2085 | done
2086 | i=0
2087 | for ELEMENT in "${ZNAMEREGIONALCODES[@]}" ; do
2088 | if [ "${ELEMENT}" == "${ZNAMEREGIONALCODE}" ] ; then GeonameID=${ZGEONAMEIDS[i]} ; break ; fi
2089 | let i++
2090 | done
2091 | else
2092 | GeonameID=${ZGEONAMEIDS[0]}
2093 | fi
2094 | set_ClosestCity ${GeonameID}
2095 | set_CountryCode ${ZCOUNTRY}
2096 | display_Title "Select Time Zone"
2097 | display_TimeZone
2098 | echo
2099 | while [ -z "${setAutomatically}" ] ; do
2100 | read -sn 1 -p "Set time zone automatically using current location (Y/n)? " setAutomatically < /dev/tty
2101 | if [ -z "${setAutomatically}" ] ; then setAutomatically="y" ; fi
2102 | case "${setAutomatically}" in
2103 | "Y" | "y" ) echo ; TimezoneAuto="true" ;;
2104 | "N" | "n" ) echo ; TimezoneAuto="false" ;;
2105 | * ) echo ; setAutomatically="" ;;
2106 | esac
2107 | done
2108 | setAutomatically=""
2109 | }
2110 |
2111 | function get_sshdDisabled {
2112 | prefsshdDisabled=`/usr/libexec/PlistBuddy -c "Print ':sshdDisabled'" ~/Library/Preferences/au.com.mondada.SIC.plist 2>/dev/null`
2113 | if [ ${?} -ne 0 ] ; then prefsshdDisabled=`/usr/libexec/PlistBuddy -c "Print ':com.openssh.sshd:Disabled'" "/var/db/launchd.db/com.apple.launchd/overrides.plist" 2>/dev/null` ; fi
2114 | if [ ${?} -ne 0 ] ; then prefsshdDisabled="" ; fi
2115 | if [ -n "${prefsshdDisabled}" ] ; then sshdDisabled="${prefsshdDisabled}" ; fi
2116 | echo "sshdDisabled: ${sshdDisabled}"
2117 | }
2118 |
2119 | function save_sshdDisabled {
2120 | defaults write ~/Library/Preferences/au.com.mondada.SIC "sshdDisabled" -bool "${sshdDisabled}"
2121 | }
2122 |
2123 | function display_sshdDisabled {
2124 | printf "Remote Login: ["
2125 | if [ "${sshdDisabled}" == "false" ] ; then printf "*" ; else printf " " ; fi
2126 | echo "] Enable users to log in remotely using SSH"
2127 | }
2128 |
2129 | function select_sshdDisabled {
2130 | display_Title "Remote Login"
2131 | display_sshdDisabled
2132 | echo
2133 | while [ -z "${enableSSH}" ] ; do
2134 | read -sn 1 -p "Enable users to log in remotely using SSH (y/N)? " enableSSH < /dev/tty
2135 | if [ -z "${enableSSH}" ] ; then enableSSH="n" ; fi
2136 | case "${enableSSH}" in
2137 | "Y" | "y" ) echo ; sshdDisabled="false" ;;
2138 | "N" | "n" ) echo ; sshdDisabled="true" ;;
2139 | * ) echo ; enableSSH="" ;;
2140 | esac
2141 | done
2142 | enableSSH=""
2143 | }
2144 |
2145 | function get_RemoteManagement {
2146 | prefRemoteManagement=`/usr/libexec/PlistBuddy -c "Print ':RemoteManagement'" ~/Library/Preferences/au.com.mondada.SIC.plist 2>/dev/null`
2147 | if [ ${?} -ne 0 ] ; then
2148 | if [ -e "/etc/RemoteManagement.launchd" ] ; then
2149 | prefRemoteManagement="true"
2150 | else
2151 | prefRemoteManagement="false"
2152 | fi
2153 | fi
2154 | if [ -n "${prefRemoteManagement}" ] ; then RemoteManagement="${prefRemoteManagement}" ; fi
2155 | echo "RemoteManagement: ${RemoteManagement}"
2156 | }
2157 |
2158 | function save_RemoteManagement {
2159 | defaults write ~/Library/Preferences/au.com.mondada.SIC "RemoteManagement" -bool "${RemoteManagement}"
2160 | }
2161 |
2162 | function display_RemoteManagement {
2163 | printf "Remote Management: ["
2164 | if [ "${RemoteManagement}" == "true" ] ; then printf "*" ; else printf " " ; fi
2165 | echo "] Enable users to manage this computer remotely"
2166 | }
2167 |
2168 | function select_RemoteManagement {
2169 | display_Title "Remote Management"
2170 | display_RemoteManagement
2171 | echo
2172 | while [ -z "${enableARD}" ] ; do
2173 | read -sn 1 -p "Enable users to manage this computer remotely (y/N)? " enableARD < /dev/tty
2174 | if [ -z "${enableARD}" ] ; then enableARD="n" ; fi
2175 | case "${enableARD}" in
2176 | "Y" | "y" ) echo ; RemoteManagement="true" ;;
2177 | "N" | "n" ) echo ; RemoteManagement="false" ;;
2178 | * ) echo ; enableARD="" ;;
2179 | esac
2180 | done
2181 | enableARD=""
2182 | }
2183 |
2184 | function get_ComputerName {
2185 | prefComputerName=`defaults read ~/Library/Preferences/au.com.mondada.SIC "ComputerName" 2>/dev/null`
2186 | if [ -n "${prefComputerName}" ] ; then ComputerName="${prefComputerName}" ; fi
2187 | echo "ComputerName: ${ComputerName}"
2188 | }
2189 |
2190 | function save_ComputerName {
2191 | defaults write ~/Library/Preferences/au.com.mondada.SIC "ComputerName" -string "${ComputerName}"
2192 | }
2193 |
2194 | function display_ComputerName {
2195 | echo "Computer Name: Use ${ComputerName}"
2196 | }
2197 |
2198 | function select_ComputerName {
2199 | ComputerNames=( "Model and MAC Address" "Serial Number" )
2200 | display_Title "Computer Name"
2201 | display_ComputerName
2202 | display_Options "Naming conventions" "Select the naming convention you wish to use: "
2203 | select newComputerName in "${ComputerNames[@]}" ; do
2204 | if [ -n "${newComputerName}" ] ; then break ; fi
2205 | done
2206 | ComputerName="${newComputerName}" ; newComputerName=""
2207 | }
2208 |
2209 | function apply_AppleSetupDone {
2210 | echo "Creating \033[1m.AppleSetupDone\033[m..."
2211 | /usr/libexec/PlistBuddy -c "Add ':Address:CountryName' string '${CountryName}'" "/Volumes/${targDisk}/var/db/.AppleSetupDone" &>/dev/null
2212 | chmod 600 "/Volumes/${targDisk}/var/db/.AppleSetupDone"
2213 | chown 0:0 "/Volumes/${targDisk}/var/db/.AppleSetupDone"
2214 | }
2215 |
2216 | function apply_CDIScustom {
2217 | echo "Creating \033[1mCDIS.custom\033[m..."
2218 | echo "LANGUAGE=${AppleLanguage}" > "/Volumes/${targDisk}/var/log/CDIS.custom"
2219 | chmod 644 "/Volumes/${targDisk}/var/log/CDIS.custom"
2220 | chown 0:0 "/Volumes/${targDisk}/var/log/CDIS.custom"
2221 | }
2222 |
2223 | function apply_GlobalPreferences {
2224 | set_GeoKitFramework
2225 | echo "Creating \033[1m.GlobalPreferences.plist\033[m..."
2226 | defaults write "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences" "AppleLanguages" -array "${AppleLanguage}"
2227 | /usr/libexec/PlistBuddy -c "Add ':AppleLocale' string '${AppleLocale}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2228 | /usr/libexec/PlistBuddy -c "Add ':com.apple.AppleModemSettingTool.LastCountryCode' string '${CountryCode}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2229 | /usr/libexec/PlistBuddy -c "Add ':com.apple.preferences.timezone.selected_city:CountryCode' string '${CountryCode}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2230 | /usr/libexec/PlistBuddy -c "Add ':com.apple.preferences.timezone.selected_city:GeonameID' integer ${GeonameID}" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2231 | QUERY="select ZLATITUDE from ${PLACES} where ZGEONAMEID = ${GeonameID};"
2232 | Latitude=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZLATITUDE = " | awk -F "ZLATITUDE = " '{print $NF}'`
2233 | /usr/libexec/PlistBuddy -c "Add ':com.apple.preferences.timezone.selected_city:Latitude' real ${Latitude}" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2234 | QUERY="select ZNAME from ${PLACES} where ZGEONAMEID = ${GeonameID};"
2235 | Name=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZNAME = " | awk -F "ZNAME = " '{print $NF}'`
2236 | /usr/libexec/PlistBuddy -c "Add ':com.apple.preferences.timezone.selected_city:LocalizedNames:en' string ${Name}" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2237 | QUERY="select ZLONGITUDE from ${PLACES} where ZGEONAMEID = ${GeonameID};"
2238 | Longitude=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZLONGITUDE = " | awk -F "ZLONGITUDE = " '{print $NF}'`
2239 | /usr/libexec/PlistBuddy -c "Add ':com.apple.preferences.timezone.selected_city:Longitude' real ${Longitude}" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2240 | /usr/libexec/PlistBuddy -c "Add ':com.apple.preferences.timezone.selected_city:Name' string '${Name}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2241 | QUERY="select ZPOPULATION from ${PLACES} where ZGEONAMEID = ${GeonameID};"
2242 | Population=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZPOPULATION = " | awk -F "ZPOPULATION = " '{print $NF}'`
2243 | /usr/libexec/PlistBuddy -c "Add ':com.apple.preferences.timezone.selected_city:Population' integer ${Population}" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2244 | QUERY="select ZREGIONALCODE from ${PLACES} where ZGEONAMEID = ${GeonameID};"
2245 | RegionalCode=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZREGIONALCODE = " | awk -F "ZREGIONALCODE = " '{print $NF}'`
2246 | if [ -n "${RegionalCode}" ] ; then
2247 | /usr/libexec/PlistBuddy -c "Add ':com.apple.preferences.timezone.selected_city:RegionalCode' string '${RegionalCode}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2248 | fi
2249 | QUERY="select ZTIMEZONENAME from ${PLACES} where ZGEONAMEID = ${GeonameID};"
2250 | TimeZoneName=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZTIMEZONENAME = " | awk -F "ZTIMEZONENAME = " '{print $NF}'`
2251 | /usr/libexec/PlistBuddy -c "Add ':com.apple.preferences.timezone.selected_city:TimeZoneName' string '${TimeZoneName}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2252 | Version=1
2253 | /usr/libexec/PlistBuddy -c "Add ':com.apple.preferences.timezone.selected_city:Version' integer ${Version}" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2254 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City' array" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2255 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City:0' string '${Latitude}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2256 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City:1' string '${Longitude}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2257 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City:2' string '0'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2258 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City:3' string '${TimeZoneName}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2259 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City:4' string '${Country}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2260 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City:5' string '${Name}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2261 | QUERY="select ZCOUNTRY from ${PLACES} where ZGEONAMEID = ${GeonameID};"
2262 | ZCOUNTRY=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZCOUNTRY = " | awk -F "ZCOUNTRY = " '{print $NF}'`
2263 | QUERY="select distinct ZNAME from ZGEOPLACENAME where ZEN > 0 and ZPLACE = ${ZCOUNTRY};"
2264 | ZNAME=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZNAME = " | awk -F "ZNAME = " '{print $NF}'`
2265 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City:6' string '${ZNAME}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2266 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City:7' string '${Name}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2267 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City:8' string '${ZNAME}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2268 | /usr/libexec/PlistBuddy -c "Add ':com.apple.TimeZonePref.Last_Selected_City:9' string 'DEPRECATED IN 10.6'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2269 | /usr/libexec/PlistBuddy -c "Add ':Country' string '${Country}'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2270 | chmod 0644 "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2271 | chown 0:80 "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"
2272 | }
2273 |
2274 | function apply_TimezoneAuto {
2275 | echo "Creating \033[1mcom.apple.timezone.auto.plist\033[m..."
2276 | defaults write "/Volumes/${targDisk}/Library/Preferences/com.apple.timezone.auto" "Active" -bool "${TimezoneAuto}"
2277 | chmod 0644 "/Volumes/${targDisk}/Library/Preferences/com.apple.timezone.auto.plist"
2278 | chown 0:80 "/Volumes/${targDisk}/Library/Preferences/com.apple.timezone.auto.plist"
2279 | }
2280 |
2281 | function apply_HIToolbox {
2282 | echo "Creating \033[1mcom.apple.HIToolbox.plist\033[m..."
2283 | /usr/libexec/PlistBuddy -c "Add ':AppleCurrentKeyboardLayoutInputSourceID' string '${AppleCurrentKeyboardLayoutInputSourceID}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist" &>/dev/null
2284 | if [ -z ${AppleDefaultAsciiInputSource} ] ; then
2285 | /usr/libexec/PlistBuddy -c "Add ':AppleDefaultAsciiInputSource:InputSourceKind' string 'Keyboard Layout'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2286 | /usr/libexec/PlistBuddy -c "Add ':AppleDefaultAsciiInputSource:KeyboardLayout ID' integer 0" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2287 | /usr/libexec/PlistBuddy -c "Add ':AppleDefaultAsciiInputSource:KeyboardLayout Name' string 'U.S.'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2288 | else
2289 | /usr/libexec/PlistBuddy -c "Add ':AppleDefaultAsciiInputSource:InputSourceKind' string '${InputSourceKinds[$AppleDefaultAsciiInputSource]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2290 | /usr/libexec/PlistBuddy -c "Add ':AppleDefaultAsciiInputSource:KeyboardLayout ID' integer ${KeyboardLayoutIDs[$AppleDefaultAsciiInputSource]}" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2291 | /usr/libexec/PlistBuddy -c "Add ':AppleDefaultAsciiInputSource:KeyboardLayout Name' string '${KeyboardLayoutNames[$AppleDefaultAsciiInputSource]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2292 | fi
2293 | /usr/libexec/PlistBuddy -c "Add ':AppleEnabledInputSources' array" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2294 | i=0
2295 | for String in "${InputSourceKinds[@]}" ; do
2296 | if [ -n "${InputSourceKinds[i]}" ] ; then
2297 | /usr/libexec/PlistBuddy -c "Add ':AppleEnabledInputSources:${i}:InputSourceKind' string '${InputSourceKinds[i]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2298 | fi
2299 | if [ -n "${BundleIDs[i]}" ] ; then
2300 | /usr/libexec/PlistBuddy -c "Add ':AppleEnabledInputSources:${i}:BundleID' string '${BundleIDs[i]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2301 | fi
2302 | if [ -n "${InputModes[i]}" ] ; then
2303 | /usr/libexec/PlistBuddy -c "Add ':AppleEnabledInputSources:${i}:InputMode' string '${InputModes[i]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2304 | fi
2305 | if [ -n "${KeyboardLayoutIDs[i]}" ] ; then
2306 | /usr/libexec/PlistBuddy -c "Add ':AppleEnabledInputSources:${i}:KeyboardLayout ID' integer ${KeyboardLayoutIDs[i]}" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2307 | fi
2308 | if [ -n "${KeyboardLayoutNames[i]}" ] ; then
2309 | /usr/libexec/PlistBuddy -c "Add ':AppleEnabledInputSources:${i}:KeyboardLayout Name' string '${KeyboardLayoutNames[i]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2310 | fi
2311 | let i++
2312 | done
2313 | /usr/libexec/PlistBuddy -c "Add ':AppleSelectedInputSources' array" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2314 | if [ -n "${InputSourceKinds[$AppleSelectedInputSources]}" ] ; then
2315 | /usr/libexec/PlistBuddy -c "Add ':AppleSelectedInputSources:0:InputSourceKind' string '${InputSourceKinds[$AppleSelectedInputSources]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2316 | fi
2317 | if [ -n "${BundleIDs[$AppleSelectedInputSources]}" ] ; then
2318 | /usr/libexec/PlistBuddy -c "Add ':AppleSelectedInputSources:0:BundleID' string '${BundleIDs[$AppleSelectedInputSources]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2319 | fi
2320 | if [ -n "${InputModes[$AppleSelectedInputSources]}" ] ; then
2321 | /usr/libexec/PlistBuddy -c "Add ':AppleSelectedInputSources:0:InputMode' string '${InputModes[$AppleSelectedInputSources]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2322 | fi
2323 | if [ -n "${KeyboardLayoutIDs[$AppleSelectedInputSources]}" ] ; then
2324 | /usr/libexec/PlistBuddy -c "Add ':AppleSelectedInputSources:0:KeyboardLayout ID' integer ${KeyboardLayoutIDs[$AppleSelectedInputSources]}" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2325 | fi
2326 | if [ -n "${KeyboardLayoutNames[$AppleSelectedInputSources]}" ] ; then
2327 | /usr/libexec/PlistBuddy -c "Add ':AppleSelectedInputSources:0:KeyboardLayout Name' string '${KeyboardLayoutNames[$AppleSelectedInputSources]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2328 | fi
2329 | /usr/libexec/PlistBuddy -c "Add ':AppleInputSourceHistory' array" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2330 | if [ -n "${InputSourceKinds[$AppleSelectedInputSources]}" ] ; then
2331 | /usr/libexec/PlistBuddy -c "Add ':AppleInputSourceHistory:0:InputSourceKind' string '${InputSourceKinds[$AppleSelectedInputSources]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2332 | fi
2333 | if [ -n "${BundleIDs[$AppleSelectedInputSources]}" ] ; then
2334 | /usr/libexec/PlistBuddy -c "Add ':AppleInputSourceHistory:0:BundleID' string '${BundleIDs[$AppleSelectedInputSources]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2335 | fi
2336 | if [ -n "${InputModes[$AppleSelectedInputSources]}" ] ; then
2337 | /usr/libexec/PlistBuddy -c "Add ':AppleInputSourceHistory:0:InputMode' string '${InputModes[$AppleSelectedInputSources]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2338 | fi
2339 | if [ -n "${KeyboardLayoutIDs[$AppleSelectedInputSources]}" ] ; then
2340 | /usr/libexec/PlistBuddy -c "Add ':AppleInputSourceHistory:0:KeyboardLayout ID' integer ${KeyboardLayoutIDs[$AppleSelectedInputSources]}" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2341 | fi
2342 | if [ -n "${KeyboardLayoutNames[$AppleSelectedInputSources]}" ] ; then
2343 | /usr/libexec/PlistBuddy -c "Add ':AppleInputSourceHistory:0:KeyboardLayout Name' string '${KeyboardLayoutNames[$AppleSelectedInputSources]}'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2344 | fi
2345 | chmod 0644 "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2346 | chown 0:80 "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist"
2347 | }
2348 |
2349 | function apply_SetupRegComplete {
2350 | echo "Creating \033[1m.SetupRegComplete\033[m"
2351 | touch "/Volumes/${targDisk}/Library/Receipts/.SetupRegComplete"
2352 | chmod 0644 "/Volumes/${targDisk}/Library/Receipts/.SetupRegComplete"
2353 | }
2354 |
2355 | function apply_Localtime {
2356 | set_GeoKitFramework
2357 | echo "Updating \033[1mlocaltime\033[m..."
2358 | QUERY="select ZTIMEZONENAME from ${PLACES} where ZGEONAMEID = ${GeonameID};"
2359 | TimeZoneName=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZTIMEZONENAME = " | awk -F "ZTIMEZONENAME = " '{print $NF}'`
2360 | ln -fs "/usr/share/zoneinfo/${TimeZoneName}" "/Volumes/${targDisk}/etc/localtime"
2361 | }
2362 |
2363 | function apply_NTPconf {
2364 | echo "Updating \033[1mntp.conf\033[m..."
2365 | echo "server ${NTPServer}" > "/Volumes/${targDisk}/etc/ntp.conf"
2366 | }
2367 |
2368 | function apply_FirstBoot {
2369 | echo "Creating \033[1mFirst Boot\033[m LaunchDaemon..."
2370 | mkdir -p "/Volumes/${targDisk}/${FirstBootPath}/Actions"
2371 | # mkdir -p "/Volumes/${targDisk}/${FirstBootPath}/Packages"
2372 | printf \#\!"/bin/sh\n" > "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2373 | echo "ScriptPath=\`dirname \"\${0}\"\`" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2374 | echo "Actions=( \`ls \"\${ScriptPath}/Actions\" | sed -e \"s/ /%20/g\"\` )" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2375 | echo "for Action in \"\${Actions[@]}\" ; do" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2376 | echo " Action=\"\${Action//%20/ }\"" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2377 | echo " \"\${ScriptPath}/Actions/\${Action}\"" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2378 | echo "done" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2379 | # echo "Packages=( \`ls \"\${ScriptPath}/Packages\" | sed -e \"s/ /%20/g\"\` )" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2380 | # echo "for Package in \"\${Packages[@]}\" ; do" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2381 | # echo " Package=\"\${Packages//%20/ }\"" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2382 | # echo " installer -pkg \"\${ScriptPath}/Packages/\${Package}\" -target \"/\"" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2383 | # echo "done" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2384 | echo "srm \"/Library/LaunchDaemons/FirstBoot.plist\"" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2385 | echo "rm -rf \"\${ScriptPath}\"" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2386 | echo "exit 0" >> "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2387 | chown 0:0 "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2388 | chmod 755 "/Volumes/${targDisk}/${FirstBootPath}/FirstBoot.sh"
2389 | defaults write "/Volumes/${targDisk}/Library/LaunchDaemons/FirstBoot" "Label" -string "FirstBoot"
2390 | defaults write "/Volumes/${targDisk}/Library/LaunchDaemons/FirstBoot" "ProgramArguments" -array "${FirstBootPath}/FirstBoot.sh"
2391 | defaults write "/Volumes/${targDisk}/Library/LaunchDaemons/FirstBoot" "RunAtLoad" -bool true
2392 | chown 0:0 "/Volumes/${targDisk}/Library/LaunchDaemons/FirstBoot.plist"
2393 | chmod 755 "/Volumes/${targDisk}/Library/LaunchDaemons/FirstBoot.plist"
2394 | }
2395 |
2396 | function apply_RemoteManagement {
2397 | if [ "${RemoteManagement}" == "true" ] ; then
2398 | echo "Creating \033[1mRemoteManagement.launchd\033[m..."
2399 | printf "enabled" > "/Volumes/${targDisk}/etc/RemoteManagement.launchd"
2400 | echo "Creating \033[1mcom.apple.RemoteManagement.plist\033[m..."
2401 | defaults write "/Volumes/${targDisk}/Library/Preferences/com.apple.RemoteManagement" "ARD_AllLocalUsers" -bool true
2402 | defaults write "/Volumes/${targDisk}/Library/Preferences/com.apple.RemoteManagement" "ARD_AllLocalUsersPrivs" -int 1073742079
2403 | chmod 0644 "/Volumes/${targDisk}/Library/Preferences/com.apple.RemoteManagement.plist"
2404 | printf \#\!"/bin/sh\n" > "/Volumes/${targDisk}/${FirstBootPath}/Actions/RemoteManagement.sh"
2405 | echo "/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/RemoteManagement.sh"
2406 | echo "exit 0" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/RemoteManagement.sh"
2407 | chown 0:0 "/Volumes/${targDisk}/${FirstBootPath}/Actions/RemoteManagement.sh"
2408 | chmod 755 "/Volumes/${targDisk}/${FirstBootPath}/Actions/RemoteManagement.sh"
2409 | fi
2410 | }
2411 |
2412 | function apply_AutoBindDone {
2413 | echo "Creating \033[1m.AutoBindDone\033[m..."
2414 | touch "/Volumes/${targDisk}/var/db/.AutoBindDone"
2415 | chmod 0644 "/Volumes/${targDisk}/var/db/.AutoBindDone"
2416 | }
2417 |
2418 | function apply_Overrides {
2419 | echo "Creating \033[1moverrides.plist\033[m..."
2420 | /usr/libexec/PlistBuddy -c "Add ':org.ntp.ntpd:Disabled' bool '${ntpdDisabled}'" "/Volumes/${targDisk}/var/db/launchd.db/com.apple.launchd/overrides.plist" &>/dev/null
2421 | if [ ${?} -ne 0 ] ; then /usr/libexec/PlistBuddy -c "Set ':org.ntp.ntpd:Disabled' bool '${ntpdDisabled}'" "/Volumes/${targDisk}/var/db/launchd.db/com.apple.launchd/overrides.plist" ; fi
2422 | /usr/libexec/PlistBuddy -c "Add ':com.openssh.sshd:Disabled' bool '${sshdDisabled}'" "/Volumes/${targDisk}/var/db/launchd.db/com.apple.launchd/overrides.plist" &>/dev/null
2423 | if [ ${?} -ne 0 ] ; then /usr/libexec/PlistBuddy -c "Set ':com.openssh.sshd:Disabled' bool '${sshdDisabled}'" "/Volumes/${targDisk}/var/db/launchd.db/com.apple.launchd/overrides.plist" ; fi
2424 | chmod 0600 "/Volumes/${targDisk}/var/db/launchd.db/com.apple.launchd/overrides.plist"
2425 | }
2426 |
2427 | function apply_ComputerName {
2428 | printf \#\!"/bin/sh\n" > "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh"
2429 | case "${ComputerName}" in
2430 | "Model and MAC Address" )
2431 | echo "ModelName=\`system_profiler | grep \"Model Name: \" | awk -F \": \" '{print \$NF}'\`" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh"
2432 | echo "MACAddress=\`ifconfig | grep -A1 \"en0: \" | grep \"ether \" | awk -F \"ether \" '{print \$NF}'\`" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh"
2433 | echo "MACAddress=\"\${MACAddress//[^a-z0-9]/}\"" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh"
2434 | echo "ComputerName=\"\${ModelName} \${MACAddress}\"" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh" ;;
2435 | "Serial Number" ) echo "ComputerName=\`system_profiler | grep \"Serial Number (system): \" | awk -F \": \" '{print \$NF}'\`" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh" ;;
2436 | esac
2437 | echo "LocalHostName=\`echo \"\${ComputerName}\" | sed -e \"s/ /-/g\"\`" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh"
2438 | echo "scutil --set ComputerName \"\${ComputerName}\"" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh"
2439 | echo "scutil --set LocalHostName \"\${LocalHostName}\"" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh"
2440 | echo "exit 0" >> "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh"
2441 | chown 0:0 "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh"
2442 | chmod 755 "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh"
2443 | }
2444 |
2445 | function get_SystemConfiguration {
2446 | get_AppleLanguage
2447 | get_CountryName
2448 | get_Keyboard
2449 | get_NTPServer
2450 | get_TimeZone
2451 | get_sshdDisabled
2452 | get_RemoteManagement
2453 | get_ComputerName
2454 | }
2455 |
2456 | function save_SystemConfiguration {
2457 | save_AppleLanguage
2458 | save_CountryName
2459 | save_Keyboard
2460 | save_NTPServer
2461 | save_TimeZone
2462 | save_sshdDisabled
2463 | save_RemoteManagement
2464 | save_ComputerName
2465 | }
2466 |
2467 | function display_SystemConfiguration {
2468 | display_mainLanguage ; echo
2469 | display_CountryName ; echo
2470 | display_Keyboard ; echo
2471 | display_NTPServer ; echo
2472 | display_TimeZone ; echo
2473 | display_sshdDisabled ; echo
2474 | display_RemoteManagement ; echo
2475 | display_ComputerName
2476 | }
2477 |
2478 | function apply_SystemConfiguration {
2479 | display_Title "System Configuration"
2480 | apply_AppleSetupDone
2481 | apply_CDIScustom
2482 | apply_GlobalPreferences
2483 | apply_TimezoneAuto
2484 | apply_HIToolbox
2485 | apply_SetupRegComplete
2486 | apply_Localtime
2487 | apply_NTPconf
2488 | apply_FirstBoot
2489 | apply_RemoteManagement
2490 | apply_AutoBindDone
2491 | apply_Overrides
2492 | apply_ComputerName
2493 | echo
2494 | press_anyKey
2495 | }
2496 |
2497 | function set_systemOptions {
2498 | systemOptions=( "Language" "Country Name" "Keyboard Layout" "Network Time Server" "Time Zone" "Remote Login" "Remote Management" "Computer Name" )
2499 | if [ -n "${targDisk}" ] && [ ! -e "/Volumes/${targDisk}/var/db/.AppleSetupDone" ] ; then systemOptions=( "${systemOptions[@]}" "Apply System Configuration" ) ; fi
2500 | systemOptions=( "${systemOptions[@]}" "Previous Menu" )
2501 | }
2502 |
2503 | function menu_SystemConfiguration {
2504 | set_systemOptions
2505 | while [ "${systemOption}" != "Previous Menu" ] ; do
2506 | display_Title "System Configuration"
2507 | display_SystemConfiguration
2508 | if [ -e "/Volumes/${targDisk}/var/db/.AppleSetupDone" ] ; then echo ; echo "\033[1mThe selected image has already been configured.\033[m" ; fi
2509 | echo
2510 | display_Options "Options" "Select an option: "
2511 | select systemOption in "${systemOptions[@]}" ; do
2512 | case "${systemOption}" in
2513 | "Language" ) select_mainLanguage ; systemOption="" ; break ;;
2514 | "Country Name" ) select_CountryName ; systemOption="" ; break ;;
2515 | "Keyboard Layout" ) select_Keyboard ; systemOption="" ; break ;;
2516 | "Network Time Server" ) select_NTPServer ; systemOption="" ; break ;;
2517 | "Time Zone" ) select_TimeZone ; systemOption="" ; break ;;
2518 | "Remote Login" ) select_sshdDisabled ; systemOption="" ; break ;;
2519 | "Remote Management" ) select_RemoteManagement ; systemOption="" ; break ;;
2520 | "Computer Name" ) select_ComputerName ; systemOption="" ; break ;;
2521 | "Apply System Configuration" ) apply_SystemConfiguration ; systemOption="Previous Menu" ; break ;;
2522 | "Previous Menu" ) break ;;
2523 | esac
2524 | done
2525 | done
2526 | systemOption=""
2527 | }
2528 |
2529 | function get_RealName {
2530 | prefRealName=`defaults read ~/Library/Preferences/au.com.mondada.SIC "RealName" 2>/dev/null`
2531 | if [ -n "${prefRealName}" ] ; then RealName="${prefRealName}" ; fi
2532 | echo "RealName: ${RealName}"
2533 | }
2534 |
2535 | function save_RealName {
2536 | defaults write ~/Library/Preferences/au.com.mondada.SIC "RealName" -string "${RealName}"
2537 | }
2538 |
2539 | function display_RealName {
2540 | if [ -n "${RealName}" ] ; then
2541 | echo "Full Name: ${RealName}"
2542 | else
2543 | echo "Full Name: -"
2544 | fi
2545 | }
2546 |
2547 | function dscl_Check {
2548 | # ${1}: Property Name
2549 | # ${2}: Property Value
2550 | dsclValid=0
2551 | searchResult=`dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -search /Local/Target/Users "${1}" "${2}"`
2552 | if [ -n "${searchResult}" ] ; then dsclValid=1 ; return 1 ; fi
2553 | return 0
2554 | }
2555 |
2556 | function update_NFSHomeDirectory {
2557 | if [ ${UniqueID} -gt 500 ] ; then
2558 | NFSHomeDirectory="/Users/${RecordName}"
2559 | else
2560 | NFSHomeDirectory="/var/${RecordName}"
2561 | fi
2562 | }
2563 |
2564 | function update_RecordName {
2565 | # ${1}: New Real Name
2566 | RecordName=`echo "${1}" | tr "[:upper:]" "[:lower:]" | tr "[=à=]" "a" | tr "[=á=]" "a" | tr "[=å=]" "a" | tr "[=ä=]" "a" | tr "[=â=]" "a" | tr "[=ã=]" "a" | tr "[=ç=]" "c" | tr "[=è=]" "e" | tr "[=é=]" "e" | tr "[=ë=]" "e" | tr "[=ê=]" "e" | tr "[=ì=]" "i" | tr "[=í=]" "i" | tr "[=ï=]" "i" | tr "[=î=]" "i" | tr "[=ñ=]" "n" | tr "[=ò=]" "o" | tr "[=ó=]" "o" | tr "[=ö=]" "o" | tr "[=ô=]" "o" | tr "[=õ=]" "o" | tr "[=ù=]" "u" | tr "[=ú=]" "u" | tr "[=ü=]" "u" | tr "[=û=]" "u" | tr "[=ÿ=]" "y"`
2567 | RecordName="${RecordName//[^a-zA-Z0-9_.-]/}"
2568 | if [ -n "${targDisk}" ] ; then
2569 | dscl_Check "RecordName" "${RecordName}"
2570 | if [ ${dsclValid} -eq 0 ] ; then return 0 ; fi
2571 | i=1 ; while [ ${dsclValid} -ne 0 ] ; do
2572 | dscl_Check "RecordName" "${RecordName}${i}"
2573 | let i++
2574 | done
2575 | RecordName="${RecordName}${i}"
2576 | fi
2577 | update_NFSHomeDirectory
2578 | }
2579 |
2580 | function set_RealName {
2581 | display_Title "User Account"
2582 | display_UserAccount
2583 | if [ -n "${RealName}" ] ; then
2584 | printf "\nFull name (${RealName}): " ; read newRealName
2585 | if [ -z "${newRealName}" ] || [ "${newRealName}" == "${RealName}" ] ; then return 0 ; fi
2586 | else
2587 | while [ -z "${newRealName}" ] ; do printf "Full name: " ; read newRealName ; done
2588 | fi
2589 | if [ -n "${targDisk}" ] ; then
2590 | dscl_Check "RealName" "${newRealName}"
2591 | while [ ${dsclValid} -ne 0 ] ; do
2592 | printf "\033[1m${newRealName}\033[m is used by another user.\n"
2593 | if [ -n "${RealName}" ] ; then
2594 | printf "\nFull name (${RealName}): " ; read newRealName
2595 | if [ -z "${newRealName}" ] || [ "${newRealName}" == "${RealName}" ] ; then return 0 ; fi
2596 | else
2597 | while [ -z "${newRealName}" ] ; do printf "Full name: " ; read newRealName ; done
2598 | fi
2599 | dscl_Check "RealName" "${newRealName}"
2600 | done
2601 | fi
2602 | if [ "${newRealName}" != "${RealName}" ] ; then update_RecordName "${newRealName}" ; fi
2603 | RealName="${newRealName}"
2604 | set_userAttributes
2605 | }
2606 |
2607 | function get_RecordName {
2608 | prefRecordName=`defaults read ~/Library/Preferences/au.com.mondada.SIC "RecordName" 2>/dev/null`
2609 | if [ -n "${prefRecordName}" ] ; then RecordName="${prefRecordName}" ; fi
2610 | echo "RecordName: ${RecordName}"
2611 | }
2612 |
2613 | function save_RecordName {
2614 | defaults write ~/Library/Preferences/au.com.mondada.SIC "RecordName" -string "${RecordName}"
2615 | }
2616 |
2617 | function display_RecordName {
2618 | if [ -n "${RecordName}" ] ; then
2619 | echo "Account Name: ${RecordName}"
2620 | else
2621 | echo "Account Name: -"
2622 | fi
2623 | }
2624 |
2625 | function check_RecordName {
2626 | # ${1}: New Record Name
2627 | validRecordName=0
2628 | # Check for illegal characters
2629 | badChars="${1//[-^a-zA-Z0-9_.-]/}"
2630 | if [ -n "${badChars}" ] ; then printf "\033[1m${1}\033[m is not a valid account name.\n" ; update_RecordName "${1}" ; validRecordName=1 ; return 1 ; fi
2631 | # Check for duplicate record
2632 | if [ -n "${targDisk}" ] ; then
2633 | dscl_Check "RecordName" "${1}"
2634 | if [ ${dsclValid} -ne 0 ] ; then printf "\033[1m${1}\033[m is used by another user.\n" ; update_RecordName "${1}" ; validRecordName=1 ; return 1 ; fi
2635 | fi
2636 | return 0
2637 | }
2638 |
2639 | function set_RecordName {
2640 | display_Title "User Account"
2641 | display_UserAccount
2642 | if [ -n "${RecordName}" ] ; then
2643 | printf "\nAccount name (${RecordName}): " ; read newRecordName
2644 | if [ -z "${newRecordName}" ] || [ "${newRecordName}" == "${RecordName}" ] ; then return 0 ; fi
2645 | else
2646 | while [ -z "${newRecordName}" ] ; do printf "\nAccount name: " ; read newRecordName ; done
2647 | fi
2648 | check_RecordName "${newRecordName}"
2649 | while [ ${validRecordName} -ne 0 ] ; do
2650 | if [ -n "${RecordName}" ] ; then
2651 | printf "\nAccount name (${RecordName}): " ; read newRecordName
2652 | if [ -z "${newRecordName}" ] || [ "${newRecordName}" == "${RecordName}" ] ; then return 0 ; fi
2653 | else
2654 | while [ -z "${newRecordName}" ] ; do printf "\nAccount name: " ; read newRecordName ; done
2655 | fi
2656 | check_RecordName "${newRecordName}"
2657 | done
2658 | RecordName="${newRecordName}"
2659 | update_NFSHomeDirectory
2660 | set_userAttributes
2661 | }
2662 |
2663 | function get_UniqueID {
2664 | prefUniqueID=`defaults read ~/Library/Preferences/au.com.mondada.SIC "UniqueID" 2>/dev/null`
2665 | if [ -n "${prefUniqueID}" ] ; then UniqueID=${prefUniqueID} ; fi
2666 | echo "UniqueID: ${UniqueID}"
2667 | }
2668 |
2669 | function save_UniqueID {
2670 | defaults write ~/Library/Preferences/au.com.mondada.SIC "UniqueID" -int ${UniqueID}
2671 | }
2672 |
2673 | function display_UniqueID {
2674 | echo "User ID: ${UniqueID}"
2675 | }
2676 |
2677 | function check_UniqueID {
2678 | # ${1}: New User ID
2679 | validUniqueID=0
2680 | # Check for invalid characters
2681 | UniqueID="${newUniqueID//[^0-9-]/}"
2682 | if [ "${UniqueID}" != "${newUniqueID}" ] ; then printf "\033[1m${newUniqueID}\033[m is not a valid User ID.\n" ; validUniqueID=1 ; return 1 ; fi
2683 | # Check for duplicate User ID
2684 | if [ -n "${targDisk}" ] ; then
2685 | dscl_Check "UniqueID" "${newUniqueID}"
2686 | while [ ${dsclValid} -ne 0 ] ; do
2687 | let newUniqueID++
2688 | dscl_Check "UniqueID" "${newUniqueID}"
2689 | done
2690 | if [ "${UniqueID}" != "${newUniqueID}" ] ; then printf "\033[1m${1}\033[m is used by another user.\n" ; UniqueID=${newUniqueID} ; validUniqueID=1 ; return 1 ; fi
2691 | fi
2692 | return 0
2693 | }
2694 |
2695 | function set_UniqueID {
2696 | if [ -n "${targDisk}" ] ; then
2697 | dscl_Check "UniqueID" "${UniqueID}"
2698 | while [ ${dsclValid} -ne 0 ] ; do
2699 | let UniqueID++
2700 | dscl_Check "UniqueID" "${UniqueID}"
2701 | done
2702 | fi
2703 | display_Title "User Account"
2704 | display_UserAccount
2705 | printf "\nUser ID (${UniqueID}): " ; read newUniqueID
2706 | if [ -z "${newUniqueID}" ] || [ "${newUniqueID}" == "${UniqueID}" ] ; then set_userAttributes ; return 0 ; fi
2707 | check_UniqueID "${newUniqueID}"
2708 | while [ ${validUniqueID} -ne 0 ] ; do
2709 | printf "\nUser ID (${UniqueID}): " ; read newUniqueID
2710 | if [ -z "${newUniqueID}" ] || [ "${newUniqueID}" == "${UniqueID}" ] ; then set_userAttributes ; return 0 ; fi
2711 | check_UniqueID "${newUniqueID}"
2712 | done
2713 | UniqueID=${newUniqueID}
2714 | update_NFSHomeDirectory
2715 | set_userAttributes
2716 | }
2717 |
2718 | function get_Password {
2719 | prefPassword=`defaults read ~/Library/Preferences/au.com.mondada.SIC "Password" 2>/dev/null`
2720 | if [ -n "${prefPassword}" ] ; then Password="${prefPassword}" ; fi
2721 | printf "Password: " ; if [ -n "${Password}" ] ; then i=0 ; while [ ${i} -lt ${#Password} ] ; do printf "*" ; let i++ ; done ; fi ; printf "\n"
2722 | }
2723 |
2724 | function save_Password {
2725 | defaults write ~/Library/Preferences/au.com.mondada.SIC "Password" -string "${Password}"
2726 | }
2727 |
2728 | function display_Password {
2729 | if [ -n "${Password}" ] ; then
2730 | printf "Password: "
2731 | i=0 ; while [ ${i} -lt ${#Password} ] ; do printf "*" ; let i++ ; done ; printf "\n"
2732 | else
2733 | echo "Password: -"
2734 | fi
2735 | }
2736 |
2737 | function set_Password {
2738 | display_Title "User Account"
2739 | display_UserAccount
2740 | printf "\nPassword: " ; stty -echo ; read Password ; stty echo
2741 | printf "\nVerify: " ; stty -echo ; read Verify ; stty echo
2742 | while [ "${Password}" != "${Verify}" ] ; do
2743 | printf "\nPasswords do not match.\n"
2744 | printf "\nPassword: " ; stty -echo ; read Password ; stty echo
2745 | printf "\nVerify: " ; stty -echo ; read Verify ; stty echo
2746 | done
2747 | }
2748 |
2749 | function get_AutoLogin {
2750 | prefAutoLogin=`/usr/libexec/PlistBuddy -c "Print ':AutoLogin'" ~/Library/Preferences/au.com.mondada.SIC.plist 2>/dev/null`
2751 | if [ ${?} -ne 0 ] ; then prefAutoLogin="${AutoLogin}" ; fi
2752 | echo "AutoLogin: ${AutoLogin}"
2753 | }
2754 |
2755 | function save_AutoLogin {
2756 | defaults write ~/Library/Preferences/au.com.mondada.SIC "AutoLogin" -bool "${AutoLogin}"
2757 | }
2758 |
2759 | function display_AutoLogin {
2760 | printf "Automatic Login: ["
2761 | if [ "${AutoLogin}" == "false" ] ; then printf "*" ; else printf " " ; fi
2762 | echo "] Require password when logging in"
2763 | }
2764 |
2765 | function set_AutoLogin {
2766 | display_Title "User Account"
2767 | display_UserAccount
2768 | while [ -z "${requirePassword}" ] ; do
2769 | echo
2770 | read -sn 1 -p "Require password when logging in (Y/n)? " requirePassword < /dev/tty
2771 | if [ -z "${requirePassword}" ] ; then requirePassword="y" ; fi
2772 | case "${requirePassword}" in
2773 | "Y" | "y" ) echo ; AutoLogin="false" ;;
2774 | "N" | "n" ) echo ; AutoLogin="true" ;;
2775 | * ) echo ; requirePassword="" ;;
2776 | esac
2777 | done
2778 | requirePassword=""
2779 | }
2780 |
2781 | function get_AuthenticationHint {
2782 | prefAuthenticationHint=`defaults read ~/Library/Preferences/au.com.mondada.SIC "AuthenticationHint" 2>/dev/null`
2783 | if [ -n "${prefAuthenticationHint}" ] ; then prefAuthenticationHint="${AuthenticationHint}" ; fi
2784 | echo "AuthenticationHint: ${AuthenticationHint}"
2785 | }
2786 |
2787 | function save_AuthenticationHint {
2788 | defaults write ~/Library/Preferences/au.com.mondada.SIC "AuthenticationHint" -string "${AuthenticationHint}"
2789 | }
2790 |
2791 | function display_AuthenticationHint {
2792 | if [ -n "${AuthenticationHint}" ] ; then
2793 | echo "Password hint: ${AuthenticationHint}"
2794 | else
2795 | echo "Password hint: -"
2796 | fi
2797 | }
2798 |
2799 | function set_AuthenticationHint {
2800 | display_Title "User Account"
2801 | display_UserAccount
2802 | printf "\nPassword Hint: " ; read AuthenticationHint
2803 | while [ "${AuthenticationHint}" == "${Password}" ] ; do
2804 | printf "\nThe hint and the password can't be the same. This is a security risk. Enter a different hint or password.\n"
2805 | printf "\nPassword Hint: " ; read AuthenticationHint
2806 | done
2807 | }
2808 |
2809 | function get_UserShell {
2810 | prefUserShell=`defaults read ~/Library/Preferences/au.com.mondada.SIC "UserShell" 2>/dev/null`
2811 | if [ -n "${prefUserShell}" ] ; then UserShell="${prefUserShell}" ; fi
2812 | echo "UserShell: ${UserShell}"
2813 | }
2814 |
2815 | function save_UserShell {
2816 | defaults write ~/Library/Preferences/au.com.mondada.SIC "UserShell" -string "${UserShell}"
2817 | }
2818 |
2819 | function display_UserShell {
2820 | echo "Login shell: ${UserShell}"
2821 | }
2822 |
2823 | function select_UserShell {
2824 | UserShells=( "/bin/bash" "/bin/tcsh" "/bin/sh" "/bin/csh" "/bin/zsh" "/bin/ksh" )
2825 | display_Title "User Account"
2826 | display_UserAccount
2827 | echo
2828 | display_Options "Login shells" "Select a login shell: "
2829 | select UserShell in "${UserShells[@]}" ; do
2830 | if [ -n "${UserShell}" ] ; then break ; fi
2831 | done
2832 | }
2833 |
2834 | function get_NFSHomeDirectory {
2835 | prefNFSHomeDirectory=`defaults read ~/Library/Preferences/au.com.mondada.SIC "NFSHomeDirectory" 2>/dev/null`
2836 | if [ -n "${prefNFSHomeDirectory}" ] ; then NFSHomeDirectory="${prefNFSHomeDirectory}" ; fi
2837 | echo "NFSHomeDirectory: ${NFSHomeDirectory}"
2838 | }
2839 |
2840 | function save_NFSHomeDirectory {
2841 | defaults write ~/Library/Preferences/au.com.mondada.SIC "NFSHomeDirectory" -string "${NFSHomeDirectory}"
2842 | }
2843 |
2844 | function display_NFSHomeDirectory {
2845 | echo "Home directory: ${NFSHomeDirectory}"
2846 | }
2847 |
2848 | function set_NFSHomeDirectory {
2849 | display_Title "User Account"
2850 | display_UserAccount
2851 | printf "\nHome directory (${NFSHomeDirectory}): " ; read newNFSHomeDirectory
2852 | if [ -z "${newNFSHomeDirectory}" ] || [ "${newNFSHomeDirectory}" == "${NFSHomeDirectory}" ] ; then return 0 ; fi
2853 | check_Path "${newNFSHomeDirectory}"
2854 | while [ ${validPath} -ne 0 ] ; do
2855 | printf "\nHome directory (${NFSHomeDirectory}): " ; read newNFSHomeDirectory
2856 | if [ -z "${newNFSHomeDirectory}" ] || [ "${newNFSHomeDirectory}" == "${NFSHomeDirectory}" ] ; then return 0 ; fi
2857 | check_Path "${newNFSHomeDirectory}"
2858 | done
2859 | NFSHomeDirectory="${newNFSHomeDirectory}"
2860 | }
2861 |
2862 | function get_UserAccount {
2863 | get_RealName
2864 | get_RecordName
2865 | get_UniqueID
2866 | get_Password
2867 | get_AutoLogin
2868 | get_AuthenticationHint
2869 | get_UserShell
2870 | get_NFSHomeDirectory
2871 | }
2872 |
2873 | function save_UserAccount {
2874 | save_RealName
2875 | save_RecordName
2876 | save_UniqueID
2877 | save_Password
2878 | save_AutoLogin
2879 | save_AuthenticationHint
2880 | save_UserShell
2881 | save_NFSHomeDirectory
2882 | }
2883 |
2884 | function display_UserAccount {
2885 | display_RealName
2886 | display_RecordName
2887 | display_UniqueID
2888 | display_Password
2889 | display_AutoLogin
2890 | display_AuthenticationHint
2891 | display_UserShell
2892 | display_NFSHomeDirectory
2893 | }
2894 |
2895 | function check_UserAccount {
2896 | validUserAccount=0 ; validRealName=0 ; validRecordName=0 ; validUniqueID=0
2897 | dscl_Check "RealName" "${RealName}"
2898 | if [ ${dsclValid} -ne 0 ] ; then validRealName=1 ; validUserAccount=1 ; fi
2899 | dscl_Check "RecordName" "${RecordName}"
2900 | if [ ${dsclValid} -ne 0 ] ; then validRecordName=1 ; validUserAccount=1 ; fi
2901 | dscl_Check "UniqueID" "${UniqueID}"
2902 | if [ ${dsclValid} -ne 0 ] ; then validUniqueID=1 ; validUserAccount=1 ; fi
2903 | }
2904 |
2905 | function set_userAttributes {
2906 | if [ -n "${targDisk}" ] ; then check_UserAccount ; fi
2907 | userAttributes=( "Full Name" "Account Name" "User ID" "Password" "Automatic Login" "Password Hint" "Login shell" "Home Directory" )
2908 | if [ -n "${targDisk}" ] && [ ${validUserAccount} -eq 0 ] ; then userAttributes=( "${userAttributes[@]}" "Create Account" ) ; fi
2909 | userAttributes=( "${userAttributes[@]}" "Previous Menu" )
2910 | }
2911 |
2912 | function create_UserAccount {
2913 | display_Title "User Account"
2914 | echo "Creating User Record: ${RecordName}"
2915 | dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -create /Local/Target/Users/"${RecordName}"
2916 | echo "Adding attribute: RealName"
2917 | dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" RealName "${RealName}"
2918 | echo "Setting password"
2919 | dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -passwd /Local/Target/Users/"${RecordName}" "${Password}"
2920 | echo "Adding attribute: AuthenticationHint"
2921 | dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" AuthenticationHint "${AuthenticationHint}"
2922 | echo "Adding attribute: UniqueID"
2923 | dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" UniqueID ${UniqueID}
2924 | echo "Adding attribute: PrimaryGroupID"
2925 | dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" PrimaryGroupID ${PrimaryGroupID}
2926 | echo "Adding attribute: NFSHomeDirectory"
2927 | dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" NFSHomeDirectory "${NFSHomeDirectory}"
2928 | echo "Adding attribute: UserShell"
2929 | dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" UserShell "${UserShell}"
2930 | echo "Adding attribute: GroupMembership"
2931 | dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Groups/staff GroupMembership "${RecordName}"
2932 | dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Groups/admin GroupMembership "${RecordName}"
2933 | ditto "/Volumes/${targDisk}/System/Library/User Template/Non_localized" "/Volumes/${targDisk}/${NFSHomeDirectory}"
2934 | ditto "/Volumes/${targDisk}/System/Library/User Template/${UserTemplate}.lproj" "/Volumes/${targDisk}/${NFSHomeDirectory}"
2935 | defaults write "/Volumes/${targDisk}/${NFSHomeDirectory}/Library/Preferences/.GlobalPreferences" AppleMiniaturizeOnDoubleClick -bool FALSE
2936 | defaults write "/Volumes/${targDisk}/${NFSHomeDirectory}/Library/Preferences/.GlobalPreferences" AppleScrollAnimationEnabled -bool TRUE
2937 | chown -Rh ${UniqueID}:${PrimaryGroupID} "/Volumes/${targDisk}/${NFSHomeDirectory}"
2938 | if [ ${UniqueID} -lt 501 ] ; then
2939 | defaults write "/Volumes/${targDisk}/Library/Preferences/com.apple.loginwindow" Hide500Users -bool TRUE
2940 | defaults write "/Volumes/${targDisk}/Library/Preferences/com.apple.loginwindow" HiddenUsersList -array "${RecordName}"
2941 | chmod 0644 "/Volumes/${targDisk}/Library/Preferences/com.apple.loginwindow.plist"
2942 | fi
2943 | GeneratedUID=`dscl -f "/Volumes/${targDisk}/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/"${RecordName}" GeneratedUID`
2944 | GeneratedUID=${GeneratedUID:14:36}
2945 | if [ ! -e "/Volumes/${targDisk}/var/db/shadow/hash" ] ; then
2946 | mkdir -p "/Volumes/${targDisk}/var/db/shadow/hash"
2947 | chmod -R 0700 "/Volumes/${targDisk}/var/db/shadow"
2948 | fi
2949 | if [ -n "${GeneratedUID}" ] ; then mv "/var/db/shadow/hash/${GeneratedUID}" "/Volumes/${targDisk}/var/db/shadow/hash/" &>/dev/null ; fi
2950 | chmod 600 "/Volumes/${targDisk}/var/db/shadow/hash/${GeneratedUID}" &>/dev/null
2951 | if [ "${AutoLogin}" == "true" ] ; then
2952 | Date=( `date` )
2953 | /usr/libexec/PlistBuddy -c "Add ':CreationDate' date '${Date[0]} ${Date[2]} ${Date[1]} ${Date[4]} ${Date[5]} ${Date[3]}'" "/Volumes/${targDisk}/var/db/shadow/hash/${GeneratedUID}.state" &>/dev/null
2954 | if [ ${?} -ne 0 ] ; then /usr/libexec/PlistBuddy -c "Set ':CreationDate' date '${Date[0]} ${Date[2]} ${Date[1]} ${Date[4]} ${Date[5]} ${Date[3]}'" "/Volumes/${targDisk}/var/db/shadow/hash/${GeneratedUID}.state" ; fi
2955 | /usr/libexec/PlistBuddy -c "Add ':FailedLoginCount' integer 0" "/Volumes/${targDisk}/var/db/shadow/hash/${GeneratedUID}.state" &>/dev/null
2956 | if [ ${?} -ne 0 ] ; then /usr/libexec/PlistBuddy -c "Set ':FailedLoginCount' integer 0" "/Volumes/${targDisk}/var/db/shadow/hash/${GeneratedUID}.state" ; fi
2957 | /usr/libexec/PlistBuddy -c "Add ':LastLoginDate' date '${Date[0]} ${Date[2]} ${Date[1]} ${Date[4]} ${Date[5]} ${Date[3]}'" "/Volumes/${targDisk}/var/db/shadow/hash/${GeneratedUID}.state" &>/dev/null
2958 | if [ ${?} -ne 0 ] ; then /usr/libexec/PlistBuddy -c "Set ':LastLoginDate' date '${Date[0]} ${Date[2]} ${Date[1]} ${Date[4]} ${Date[5]} ${Date[3]}'" "/Volumes/${targDisk}/var/db/shadow/hash/${GeneratedUID}.state" ; fi
2959 | /usr/libexec/PlistBuddy -c "Add ':NewPasswordRequired' integer 0" "/Volumes/${targDisk}/var/db/shadow/hash/${GeneratedUID}.state" &>/dev/null
2960 | if [ ${?} -ne 0 ] ; then /usr/libexec/PlistBuddy -c "Set ':NewPasswordRequired' integer 0" "/Volumes/${targDisk}/var/db/shadow/hash/${GeneratedUID}.state" ; fi
2961 | chmod 0600 "/Volumes/${targDisk}/var/db/shadow/hash/${GeneratedUID}.state"
2962 | defaults write "/Volumes/${targDisk}/Library/Preferences/com.apple.loginwindow" RetriesUntilHint -integer 3
2963 | defaults write "/Volumes/${targDisk}/Library/Preferences/com.apple.loginwindow" autoLoginUser -string "${RecordName}"
2964 | defaults write "/Volumes/${targDisk}/Library/Preferences/com.apple.loginwindow" lastUser -string "Restart"
2965 | defaults write "/Volumes/${targDisk}/Library/Preferences/com.apple.loginwindow" lastUserName -string "${RecordName}"
2966 | chmod 0644 "/Volumes/${targDisk}/Library/Preferences/com.apple.loginwindow.plist"
2967 | fi
2968 | echo
2969 | press_anyKey
2970 | }
2971 |
2972 | function menu_UserAccount {
2973 | set_userAttributes
2974 | while [ "${userAttribute}" != "Previous Menu" ] ; do
2975 | display_Title "User Account"
2976 | display_UserAccount
2977 | echo
2978 | if [ -n "${targDisk}" ] && [ ${validUserAccount} -ne 0 ] ; then
2979 | echo "\033[1mThe following attributes conflict with an existing user account:\033[m"
2980 | if [ ${validRealName} -ne 0 ] ; then echo "\033[1m Full Name\033[m" ; fi
2981 | if [ ${validRecordName} -ne 0 ] ; then echo "\033[1m Account Name\033[m" ; fi
2982 | if [ ${validUniqueID} -ne 0 ] ; then echo "\033[1m User ID\033[m" ; fi
2983 | echo
2984 | fi
2985 | display_Options "Attributes" "Select an attribute: "
2986 | select userAttribute in "${userAttributes[@]}" ; do
2987 | case "${userAttribute}" in
2988 | "Full Name" ) set_RealName ; userAttribute="" ; break ;;
2989 | "Account Name" ) set_RecordName ; userAttribute="" ; break ;;
2990 | "User ID" ) set_UniqueID ; userAttribute="" ; break ;;
2991 | "Password" ) set_Password ; userAttribute="" ; break ;;
2992 | "Automatic Login" ) set_AutoLogin ; userAttribute="" ; break ;;
2993 | "Password Hint" ) set_AuthenticationHint ; userAttribute="" ; break ;;
2994 | "Login shell" ) select_UserShell ; userAttribute="" ; break ;;
2995 | "Home Directory" ) set_NFSHomeDirectory ; userAttribute="" ; break ;;
2996 | "Create Account" ) create_UserAccount ; userAttribute="Previous Menu" ; break ;;
2997 | "Previous Menu" ) break ;;
2998 | esac
2999 | done
3000 | done
3001 | userAttribute=""
3002 | }
3003 |
3004 | function menu_Preferences {
3005 | prefOptions=( "Default Paths" "Image Settings" "System Configuration" "User Account" "Main Menu" )
3006 | while [ "${prefOption}" != "Main Menu" ] ; do
3007 | display_Title "Preferences"
3008 | display_Options "Options" "Select an option: "
3009 | select prefOption in "${prefOptions[@]}" ; do
3010 | case "${prefOption}" in
3011 | "Default Paths" ) menu_DefaultPaths ; prefOption="" ; break ;;
3012 | "Image Settings" ) menu_ImageSettings ; prefOption="" ; break ;;
3013 | "System Configuration" ) menu_SystemConfiguration ; prefOption="" ; break ;;
3014 | "User Account" ) menu_UserAccount ; prefOption="" ; break ;;
3015 | "Main Menu" ) break ;;
3016 | esac
3017 | done
3018 | done
3019 | prefOption=""
3020 | while [ -z "${saveDefaults}" ] ; do
3021 | echo
3022 | read -sn 1 -p "Save as default settings (Y/n)? " saveDefaults < /dev/tty
3023 | echo
3024 | if [ -z "${saveDefaults}" ] ; then saveDefaults="y" ; fi
3025 | case "${saveDefaults}" in
3026 | "Y" | "y" ) save_DefaultPaths ; save_ImageSettings ; save_SystemConfiguration ; save_UserAccount ;;
3027 | "N" | "n" ) echo ;;
3028 | * ) echo ; saveDefaults="" ;;
3029 | esac
3030 | done
3031 | saveDefaults=""
3032 | }
3033 |
3034 | function detect_Sources {
3035 | unset sourceTypes[@]
3036 | unset sourceVersions[@]
3037 | unset sourceVolumes[@]
3038 | unset imageNames[@]
3039 | systemMinorVersion=`defaults read "/System/Library/CoreServices/SystemVersion" ProductVersion | awk -F "." '{print $2}'`
3040 | Volumes=( `ls -Ap "/Volumes" | sed -e "s/ /%20/g" | grep "/" | awk -F "/" '{print $1}'` )
3041 | i=0 ; for Volume in "${Volumes[@]}" ; do Volumes[i]=$( echo "${Volume}" | sed -e "s/%20/ /g" ) ; let i++ ; done
3042 | for Volume in "${Volumes[@]}" ; do
3043 | if [ ! -e "/Volumes/${Volume}/var/db/.AppleSetupDone" ] && [ -e "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion.plist" ] ; then
3044 | sourceMinorVersion=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion" ProductVersion | awk -F "." '{print $2}'`
3045 | set_osName ${sourceMinorVersion}
3046 | if [ -e "/Volumes/${Volume}/System/Library/CoreServices/ServerVersion.plist" ] ; then
3047 | ProductType="server"
3048 | ProductName=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/ServerVersion" ProductName`
3049 | ProductVersion=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/ServerVersion" ProductVersion`
3050 | ProductBuildVersion=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion" ProductBuildVersion`
3051 | else
3052 | ProductType="user"
3053 | ProductName=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion" ProductName`
3054 | ProductVersion=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion" ProductVersion`
3055 | ProductBuildVersion=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion" ProductBuildVersion`
3056 | fi
3057 | if [ -e "/Volumes/${Volume}/System/Installation/Packages/OSInstall.mpkg" ] || [ -e "/Volumes/${Volume}/Packages/OSInstall.mpkg" ] ; then
3058 | if [ ${sourceMinorVersion} -eq ${systemMinorVersion} ] ; then
3059 | sourceVersions=( "${sourceVersions[@]}" "${ProductName} ${ProductVersion} (${ProductBuildVersion}) Installer" )
3060 | sourceVolumes=( "${sourceVolumes[@]}" "${Volume}" )
3061 | imageNames=( "${imageNames[@]}" `echo "${osName}_${ProductBuildVersion}_${ProductType}" | awk {'print tolower()'}` )
3062 | fi
3063 | else
3064 | sourceVersions=( "${sourceVersions[@]}" "${ProductName} ${ProductVersion} (${ProductBuildVersion})" )
3065 | sourceVolumes=( "${sourceVolumes[@]}" "${Volume}" )
3066 | imageNames=( "${imageNames[@]}" `echo "${osName}_${ProductBuildVersion}_${ProductType}" | awk {'print tolower()'}` )
3067 | fi
3068 | fi
3069 | done
3070 | }
3071 |
3072 | function display_Source {
3073 | if [ -n "${sourceVersion}" ] ; then
3074 | echo "Source: ${sourceVersion}"
3075 | else
3076 | echo "Source: -"
3077 | fi
3078 | }
3079 |
3080 | function set_sourceOptions {
3081 | sourceOptions=( "Select Source" )
3082 | if [ -n "${sourceVolume}" ] ; then
3083 | if [ -e "/Volumes/${sourceVolume}/System/Installation/Packages/OSInstall.mpkg" ] || [ -e "/Volumes/${sourceVolume}/Packages/OSInstall.mpkg" ] ; then
3084 | sourceOptions=( "${sourceOptions[@]}" "Install Mac OS X" )
3085 | else
3086 | sourceOptions=( "${sourceOptions[@]}" "Image Device" )
3087 | fi
3088 | fi
3089 | sourceOptions=( "${sourceOptions[@]}" "Main Menu" )
3090 | }
3091 |
3092 | function select_Source {
3093 | detect_Sources
3094 | display_Title "Select Source"
3095 | if [ ${#sourceVersions[@]} -eq 0 ] ; then
3096 | sourceVersion="" ; sourceVolume="" ; sparseImage="" ; imageName=""
3097 | press_anyKey "No sources available, please insert an install disc, or mount an un-booted system volume."
3098 | else
3099 | display_Source
3100 | echo
3101 | display_Options "Sources" "Select a source: "
3102 | select sourceVersion in "${sourceVersions[@]}" ; do
3103 | if [ -n "${sourceVersion}" ] ; then break ; fi
3104 | done
3105 | i=0
3106 | for Element in "${sourceVersions[@]}" ; do
3107 | if [ "${Element}" == "${sourceVersion}" ] ; then
3108 | sourceVolume="${sourceVolumes[i]}"
3109 | sparseImage="${imageNames[i]}.sparseimage"
3110 | baseImage="${imageNames[i]}.dmg"
3111 | break
3112 | fi
3113 | let i++
3114 | done
3115 | fi
3116 | set_sourceOptions
3117 | }
3118 |
3119 | function eject_targDisk {
3120 | printf "\nCleaning up...\n"
3121 | for targDisk in "${targDisks[@]}" ; do
3122 | rm -rf "/Volumes/${targDisk}/.DS_Store"
3123 | rm -rf "/Volumes/${targDisk}/.Spotlight-V100"
3124 | rm -rf "/Volumes/${targDisk}/.Trashes"
3125 | rm -rf "/Volumes/${targDisk}/.fseventsd"
3126 | done
3127 | printf "\nEjecting \033[1m${targDisks[0]}\033[m...\n"
3128 | hdiutil eject "/Volumes/${targDisks[0]}"
3129 | targDisk=""
3130 | }
3131 |
3132 | function install_Package {
3133 | # ${1}: Path to package
3134 | if [ -e "${1}" ] ; then
3135 | if [ "${1}" == "/Volumes/${sourceVolume}/Packages/OSInstall.mpkg" ] ; then
3136 | InstallType=0
3137 | else
3138 | while [ -z "${Customize}" ] ; do
3139 | echo
3140 | read -sn 1 -p "Customize Installation (y/N)? " Customize < /dev/tty
3141 | if [ -z "${Customize}" ] ; then Customize="n" ; fi ; echo
3142 | case "${Customize}" in
3143 | "Y" | "y" ) InstallType=1 ; break ;;
3144 | "N" | "n" ) InstallType=0 ; break ;;
3145 | * ) Customize="" ;;
3146 | esac
3147 | echo
3148 | done
3149 | fi
3150 | packageNames=( `installer -pkginfo -pkg "${1}" | sed -e "s/ /%20/g"` )
3151 | i=0 ; for Element in "${packageNames[@]}" ; do packageNames[i]=$( echo "${Element}" | sed -e "s/%20/ /g" ) ; let i++ ; done
3152 | Customize=""
3153 | printf "\nInstalling \033[1m${packageNames[0]}\033[m...\n\n"
3154 | if [ ${InstallType} -eq 1 ] ; then
3155 | open "${1}"
3156 | printf "Waiting for installation to complete." ; sleep 10
3157 | while [ `ps eax | grep -i "Installer.app" | grep -v "grep" | awk '{print $1}'` ] ; do sleep 10 ; printf "." ; done ; echo
3158 | else
3159 | printf "Waiting for installation to complete."
3160 | installer -pkg "${1}" -target "/Volumes/${targDisk}" | while read line ; do printf "." ; done ; echo
3161 | # installer -verboseR -pkg "${1}" -target "/Volumes/${targDisk}" | while read line ; do printf "." ; done ; echo
3162 | press_anyKey
3163 | fi
3164 | else
3165 | press_anyKey "The package selection is invalid, please review your settings."
3166 | fi
3167 | }
3168 |
3169 | function create_Image {
3170 | display_Title "Create Image"
3171 | if [ -z "${sourceVersion}" ] ; then press_anyKey "No source selected, please select a source first." ; return 1 ; fi
3172 | while [ -e "${LibraryPath}/${baseImage}" ] ; do
3173 | printf "An image already exists named \033[1m${baseImage}\033[m.\n"
3174 | read -sn 1 -p "Would you like to overwrite it (y/N)? " Overwrite < /dev/tty ; echo
3175 | if [ -z "${Overwrite}" ] ; then Overwrite="n" ; fi
3176 | case "${Overwrite}" in
3177 | "Y" | "y" ) echo ; rm -f "${LibraryPath}/${baseImage}" ; break ;;
3178 | "N" | "n" ) echo ; break ;;
3179 | esac
3180 | done
3181 | Overwrite=""
3182 | if [ ! -e "${LibraryPath}/${baseImage}" ] ; then
3183 | if [ ! -e "${LibraryPath}" ] ; then mkdir -p "${LibraryPath}" ; chown 99:99 "${LibraryPath}" ; fi
3184 | if [ -e "/Volumes/${sourceVolume}/System/Installation/Packages/OSInstall.mpkg" ] || [ -e "/Volumes/${sourceVolume}/Packages/OSInstall.mpkg" ] ; then
3185 | rm -f "/tmp/${sparseImage}" &>/dev/null
3186 | printf "Creating \033[1m${sparseImage}\033[m...\n\n"
3187 | hdiutil create -size "${ImageSize}g" -type SPARSE -fs HFS+J -volname "${VolumeName}" "/tmp/${sparseImage}"
3188 | targDisk=`hdiutil attach -owners on -noverify "/tmp/${sparseImage}" | grep "/Volumes/${VolumeName}" | awk -F "/Volumes/" '{print $NF}'`
3189 | targDisks=( "${targDisk}" )
3190 | chown 0:80 "/Volumes/${targDisk}"
3191 | chmod 1775 "/Volumes/${targDisk}"
3192 | if [ -e "/Volumes/${sourceVolume}/System/Installation/Packages/OSInstall.mpkg" ] ; then
3193 | install_Package "/Volumes/${sourceVolume}/System/Installation/Packages/OSInstall.mpkg"
3194 | else
3195 | install_Package "/Volumes/${sourceVolume}/Packages/OSInstall.mpkg"
3196 | fi
3197 | bless --folder "/Volumes/${targDisk}/System/Library/CoreServices" --bootefi 2>/dev/null
3198 | touch "/Volumes/${targDisk}/private/var/db/.RunLanguageChooserToo"
3199 | echo
3200 | eject_targDisk
3201 | printf "\nCompressing \033[1m${sparseImage}\033[m...\n\n"
3202 | hdiutil convert -format UDZO -o "${LibraryPath}/${baseImage}" "/tmp/${sparseImage}"
3203 | echo
3204 | press_anyKey
3205 | rm -f "/tmp/${sparseImage}" &>/dev/null
3206 | else
3207 | printf "Unmounting \033[1m${sourceVolume}\033[m...\n"
3208 | rm -rf "/Volumes/${sourceVolume}/.DS_Store" 2>/dev/null
3209 | rm -rf "/Volumes/${sourceVolume}/.Trashes" 2>/dev/null
3210 | rm -rf "/Volumes/${sourceVolume}/.fseventsd" 2>/dev/null
3211 | deviceNodes=( `diskutil list "${deviceWhole}" | grep "${deviceWhole}s" | grep -v "EFI" | grep -v "Recovery HD" | awk -F " " '{print $NF}'` )
3212 | if [ ${#deviceNodes[@]} -gt 1 ] ; then
3213 | deviceName=`diskutil info "/Volumes/${sourceVolume}" | grep "Device Node:" | awk -F " " '{print $NF}'`
3214 | diskutil unmount force "/Volumes/${sourceVolume}" &>/dev/null
3215 | else
3216 | deviceName=`diskutil info "/Volumes/${sourceVolume}" | grep "Part Of Whole:" | awk -F " " '{print $NF}'`
3217 | deviceName="/dev/${deviceName}"
3218 | diskutil unmountDisk force "/Volumes/${sourceVolume}" &>/dev/null
3219 | fi
3220 | printf "\nCreating \033[1m${baseImage}\033[m from ${deviceName}...\n\n"
3221 | hdiutil create -srcdevice "${deviceName}" -o "${LibraryPath}/${baseImage}"
3222 | diskutil mountDisk "${deviceName}"
3223 | press_anyKey
3224 | fi
3225 | fi
3226 | }
3227 |
3228 | function display_baseImage {
3229 | if [ -n "${baseImage}" ] ; then
3230 | echo "Image Name: ${baseImage}"
3231 | else
3232 | echo "Image Name: -"
3233 | fi
3234 | }
3235 |
3236 | function menu_CreateImage {
3237 | set_sourceOptions
3238 | while [ "${sourceOption}" != "Main Menu" ] ; do
3239 | display_Title "Create Image"
3240 | display_Source
3241 | display_baseImage
3242 | echo
3243 | display_Options "Options" "Select an option: "
3244 | select sourceOption in "${sourceOptions[@]}" ; do
3245 | case "${sourceOption}" in
3246 | "Select Source" ) select_Source ; sourceOption="" ; break ;;
3247 | "Install Mac OS X" ) create_Image ; sourceOption="" ; break ;;
3248 | "Image Device" ) create_Image ; sourceOption="" ; break ;;
3249 | "Main Menu" ) break ;;
3250 | esac
3251 | done
3252 | done
3253 | sourceOption=""
3254 | }
3255 |
3256 | function detect_baseImages {
3257 | unset baseImages[@]
3258 | Images=( `ls -A "${LibraryPath}" | grep ".dmg" | sed -e "s/ /%20/g"` )
3259 | i=0 ; for Image in "${Images[@]}" ; do baseImages[i]=$( echo "${Image}" | sed -e "s/%20/ /g" ) ; let i++ ; done
3260 | }
3261 |
3262 | function get_ImageConfiguration {
3263 | set_GeoKitFramework
3264 | AppleLanguage=`/usr/libexec/PlistBuddy -c "Print ':AppleLanguages:0'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist" 2>/dev/null`
3265 | set_mainLanguage "${AppleLanguage}"
3266 | CountryName=`/usr/libexec/PlistBuddy -c "Print ':Address:CountryName'" "/Volumes/${targDisk}/var/db/.AppleSetupDone" 2>/dev/null`
3267 | set_Country "${CountryName}"
3268 | AppleCurrentKeyboardLayoutInputSourceID=`defaults read "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox" "AppleCurrentKeyboardLayoutInputSourceID" 2>/dev/null`
3269 | InputMode=`/usr/libexec/PlistBuddy -c "Print ':AppleSelectedInputSources:0:Input Mode'" "/Volumes/${targDisk}/Library/Preferences/com.apple.HIToolbox.plist" 2>/dev/null`
3270 | if [ ${?} -ne 0 ] ; then InputMode="" ; fi
3271 | set_KeyboardLayout "${AppleCurrentKeyboardLayoutInputSourceID}" "${InputMode}"
3272 | ntpdDisabled=`/usr/libexec/PlistBuddy -c "Print ':org.ntp.ntpd:Disabled'" "/Volumes/${targDisk}/var/db/launchd.db/com.apple.launchd/overrides.plist" 2>/dev/null`
3273 | NTPServer=`cat "/Volumes/${targDisk}/etc/ntp.conf" | awk -F "server " '{print $NF}'`
3274 | set_NTPServerName "${NTPServer}"
3275 | TimezoneAuto=`/usr/libexec/PlistBuddy -c "Print ':Active'" "/Volumes/${targDisk}/Library/Preferences/com.apple.timezone.auto.plist" 2>/dev/null`
3276 | GeonameID=`/usr/libexec/PlistBuddy -c "Print ':com.apple.preferences.timezone.selected_city:GeonameID'" "/Volumes/${targDisk}/Library/Preferences/.GlobalPreferences.plist"`
3277 | QUERY="select ZCOUNTRY from ${PLACES} where ZGEONAMEID = ${GeonameID};"
3278 | ZCOUNTRY=`sqlite3 -line "${GeoKitFramework}" "${QUERY}" | grep "ZCOUNTRY = " | awk -F "ZCOUNTRY = " '{print $NF}'`
3279 | set_CountryCode ${ZCOUNTRY}
3280 | set_TimeZone ${GeonameID}
3281 | set_ClosestCity ${GeonameID}
3282 | sshdDisabled=`/usr/libexec/PlistBuddy -c "Print ':com.openssh.sshd:Disabled'" "/Volumes/${targDisk}/var/db/launchd.db/com.apple.launchd/overrides.plist" 2>/dev/null`
3283 | if [ -e "/Volumes/${targDisk}/etc/RemoteManagement.launchd" ] ; then
3284 | RemoteManagement="true"
3285 | else
3286 | RemoteManagement="false"
3287 | fi
3288 | if cat "/Volumes/${targDisk}/${FirstBootPath}/Actions/ComputerName.sh" | grep -q "MACAddress" ; then
3289 | ComputerName="Model and MAC Address"
3290 | else
3291 | ComputerName="Serial Number"
3292 | fi
3293 | }
3294 |
3295 | function attach_baseImage {
3296 | if [ -z "${baseImage}" ] ; then return 1 ; fi
3297 | if [ ! -e "${LibraryPath}/Shadow" ] ; then mkdir -p "${LibraryPath}/Shadow" ; chown 99:99 "${LibraryPath}/Shadow" ; fi
3298 | while [ -e "${LibraryPath}/Shadow/${baseImage}.shadow" ] ; do
3299 | printf "\nA shadow file already exists named \033[1m${baseImage}.shadow\033[m.\n"
3300 | read -sn 1 -p "Would you like to overwrite it (y/N)? " Overwrite < /dev/tty
3301 | echo
3302 | if [ -z "${Overwrite}" ] ; then Overwrite="n" ; fi
3303 | case "${Overwrite}" in
3304 | "Y" | "y" ) echo ; rm -f "${LibraryPath}/Shadow/${baseImage}.shadow" ; break ;;
3305 | "N" | "n" ) break ;;
3306 | esac
3307 | echo
3308 | done
3309 | Overwrite=""
3310 | if [ ! -e "${LibraryPath}/Shadow/${baseImage}.shadow" ] ; then printf "\nCreating \033[1m${baseImage}.shadow\033[m..." ; fi
3311 | printf "\nAttaching \033[1m${baseImage}\033[m...\n\n"
3312 | targDisks=( `hdiutil attach -owners on -noverify "${LibraryPath}/${baseImage}" -shadow "${LibraryPath}/Shadow/${baseImage}.shadow" | grep "/Volumes/" | awk -F "/Volumes/" '{print $NF}' | sed -e "s/ /%20/g"` )
3313 | if [ ${#targDisks[@]} -eq 0 ] ; then
3314 | printf "\n\033[1m${baseImage}\033[m doesn't appear to be a valid image file.\n"
3315 | while [ -z "${Remove}" ] ; do
3316 | echo
3317 | read -sn 1 -p "Would you like to remove it (Y/n)? " Remove < /dev/tty
3318 | echo
3319 | if [ -z "${Remove}" ] ; then Remove="y" ; fi
3320 | case "${Remove}" in
3321 | "Y" | "y" ) echo ; rm -f "${LibraryPath}/${baseImage}" ; baseImage="" ; break ;;
3322 | "N" | "n" ) break ;;
3323 | * ) Remove="" ;;
3324 | esac
3325 | echo
3326 | done
3327 | Remove=""
3328 | fi
3329 | i=0 ; for Element in "${targDisks[@]}" ; do targDisks[i]=$( echo "${Element}" | sed -e "s/%20/ /g" ) ; let i++ ; done
3330 | for targDisk in "${targDisks[@]}" ; do if [ -e "/Volumes/${targDisk}/System/Library/CoreServices/SystemVersion.plist" ] ; then break ; fi ; done
3331 | if [ -e "/Volumes/${targDisk}/var/db/.AppleSetupDone" ] ; then get_ImageConfiguration ; fi
3332 | }
3333 |
3334 | function display_baseImage {
3335 | if [ -n "${baseImage}" ] ; then
3336 | echo "Image Name: ${baseImage}"
3337 | else
3338 | echo "Image Name: -"
3339 | fi
3340 | }
3341 |
3342 | function select_baseImage {
3343 | detect_baseImages
3344 | if [ -n "${baseImage}" ] ; then currentBaseImage="${baseImage}" ; fi
3345 | display_Title "Select Image"
3346 | if [ ${#baseImages[@]} -eq 0 ] ; then
3347 | baseImage=""
3348 | press_anyKey "No images currently in Library."
3349 | else
3350 | display_baseImage
3351 | echo
3352 | display_Options "Images" "Select an image: "
3353 | select baseImage in "${baseImages[@]}" ; do
3354 | case "${baseImage}" in
3355 | "${currentBaseImage}" ) currentBaseImage="" ; break ;;
3356 | * ) if [ -n "${targDisk}" ] ; then eject_targDisk ; fi ; break ;;
3357 | esac
3358 | done
3359 | fi
3360 | set_configureOptions
3361 | }
3362 |
3363 | function detect_Packages {
3364 | unset Packages[@]
3365 | if [ ! -d "${PackagePath}" ] ; then mkdir -p "${PackagePath}" ; chown 99:99 "${PackagePath}" ; fi
3366 | allPackages=( `ls -A "${PackagePath}" | sed -e "s/ /%20/g"` )
3367 | i=0 ; for Element in "${allPackages[@]}" ; do allPackages[i]=$( echo "${Element}" | sed -e "s/%20/ /g" ) ; let i++ ; done
3368 | for Element in "${allPackages[@]}" ; do
3369 | if installer -volinfo -pkg "${PackagePath}/${Element}" | grep -wq "/Volumes/${targDisk}" ; then
3370 | if [ -z `installer -volinfo -pkg "${PackagePath}/${Element}" | grep -w "/Volumes/${targDisk}" | awk -F "/Volumes/${targDisk}" '{print $NF}'` ] ; then Packages=( "${Packages[@]}" "${Element}" ) ; fi
3371 | fi
3372 | done
3373 | if [ ${#Packages[@]} -eq 0 ] ; then Package="" ; fi
3374 | }
3375 |
3376 | function set_configureOptions {
3377 | configureOptions=( "Select Image" )
3378 | if [ -n "${targDisk}" ] ; then
3379 | if [ ! -e "/Volumes/${targDisk}/System/Library/CoreServices/ServerVersion.plist" ] ; then configureOptions=( "${configureOptions[@]}" "System Configuration" ) ; fi
3380 | configureOptions=( "${configureOptions[@]}" "User Account" )
3381 | detect_Packages
3382 | if [ ${#Packages[@]} -gt 0 ] ; then configureOptions=( "${configureOptions[@]}" "Install Package" ) ; fi
3383 | if [ -e "/Volumes/${targDisk}/var/db/receipts/com.apple.pkg.GarageBandBasicContent.bom" ] || [ -e "/Volumes/${targDisk}/var/db/receipts/com.apple.pkg.GarageBand_AppStore.bom" ] || [ -e "/Volumes/${targDisk}/var/db/receipts/com.apple.pkg.iMovie_AppStore.bom" ] || [ -e "/Volumes/${targDisk}/var/db/receipts/com.apple.pkg.iPhoto_AppStore.bom" ] ; then configureOptions=( "${configureOptions[@]}" "Remove iLife" ) ; fi
3384 | fi
3385 | configureOptions=( "${configureOptions[@]}" "Main Menu" )
3386 | }
3387 |
3388 | function display_Package {
3389 | if [ -n "${Package}" ] ; then
3390 | echo "Package Name: ${Package}"
3391 | else
3392 | echo "Package Name: -"
3393 | fi
3394 | }
3395 |
3396 | function set_packageOptions {
3397 | packageOptions=( "Select Package" )
3398 | if [ -n "${Package}" ] ; then packageOptions=( "${packageOptions[@]}" "Install Package" ) ; fi
3399 | packageOptions=( "${packageOptions[@]}" "Previous Menu" )
3400 | }
3401 |
3402 | function select_Package {
3403 | detect_Packages
3404 | display_Title "Select Package"
3405 | if [ ${#Packages[@]} -eq 0 ] ; then
3406 | Package=""
3407 | press_anyKey "No suitable packages found in Library."
3408 | else
3409 | display_Package
3410 | echo
3411 | display_Options "Packages" "Select a package: "
3412 | select Package in "${Packages[@]}" ; do
3413 | if [ -n "${Package}" ] ; then break ; fi
3414 | done
3415 | fi
3416 | set_packageOptions
3417 | }
3418 |
3419 | function menu_InstallPackage {
3420 | set_packageOptions
3421 | while [ "${packageOption}" != "Previous Menu" ] ; do
3422 | display_Title "Install Package"
3423 | display_baseImage
3424 | display_Package
3425 | echo
3426 | display_Options "Options" "Select an option: "
3427 | select packageOption in "${packageOptions[@]}" ; do
3428 | case "${packageOption}" in
3429 | "Select Package" ) select_Package ; packageOption="" ; break ;;
3430 | "Install Package" ) install_Package "${PackagePath}/${Package}" ; packageOption="" ; break ;;
3431 | "Previous Menu" ) break ;;
3432 | esac
3433 | done
3434 | done
3435 | Package=""
3436 | packageOption=""
3437 | }
3438 |
3439 | function remove_iLife {
3440 | display_Title "Configure Image"
3441 | display_baseImage
3442 | echo
3443 | removables=(
3444 | "Applications/GarageBand.app"
3445 | "Applications/iMovie.app"
3446 | "Applications/iPhoto.app"
3447 | "Library/Application Support/GarageBand"
3448 | "Library/Audio/Apple Loops"
3449 | "Library/Audio/Apple Loops Index"
3450 | "var/db/receipts/com.apple.pkg.GarageBandBasicContent.bom"
3451 | "var/db/receipts/com.apple.pkg.GarageBandBasicContent.plist"
3452 | "var/db/receipts/com.apple.pkg.GarageBand_AppStore.bom"
3453 | "var/db/receipts/com.apple.pkg.GarageBand_AppStore.plist"
3454 | "var/db/receipts/com.apple.pkg.iMovie_AppStore.bom"
3455 | "var/db/receipts/com.apple.pkg.iMovie_AppStore.plist"
3456 | "var/db/receipts/com.apple.pkg.iPhoto_AppStore.bom"
3457 | "var/db/receipts/com.apple.pkg.iPhoto_AppStore.plist"
3458 | )
3459 | for removable in "${removables[@]}" ; do
3460 | if [ -e "/Volumes/${targDisk}/${removable}" ] ; then
3461 | echo "Removing: /Volumes/${targDisk}/${removable}"
3462 | rm -rf "/Volumes/${targDisk}/${removable}"
3463 | fi
3464 | done
3465 | echo
3466 | press_anyKey
3467 | }
3468 |
3469 | function menu_ConfigureImage {
3470 | if [ -n "${baseImage}" ] ; then attach_baseImage ; fi
3471 | while [ "${configureOption}" != "Main Menu" ] ; do
3472 | set_configureOptions
3473 | display_Title "Configure Image"
3474 | display_baseImage
3475 | echo
3476 | display_Options "Options" "Select an option: "
3477 | select configureOption in "${configureOptions[@]}" ; do
3478 | case "${configureOption}" in
3479 | "Select Image" ) select_baseImage ; attach_baseImage ; configureOption="" ; break ;;
3480 | "System Configuration" ) menu_SystemConfiguration ; configureOption="" ; break ;;
3481 | "User Account" ) menu_UserAccount ; configureOption="" ; break ;;
3482 | "Install Package" ) menu_InstallPackage ; configureOption="" ; break ;;
3483 | "Remove iLife" ) remove_iLife ; configureOption="" ; break ;;
3484 | "Main Menu" ) eject_targDisk ; break ;;
3485 | esac
3486 | done
3487 | done
3488 | configureOption=""
3489 | baseImage=""
3490 | }
3491 |
3492 | function set_exportOptions {
3493 | exportOptions=( "Select Image" )
3494 | if [ -e "${LibraryPath}/Shadow/${baseImage}.shadow" ] ; then exportOptions=( "${exportOptions[@]}" "Export Master" ) ; fi
3495 | exportOptions=( "${exportOptions[@]}" "Main Menu" )
3496 | }
3497 |
3498 | function display_shadowFile {
3499 | if [ -e "${LibraryPath}/Shadow/${baseImage}.shadow" ] ; then
3500 | echo "Shadow File: ${baseImage}.shadow"
3501 | else
3502 | echo "Shadow File: -"
3503 | fi
3504 | }
3505 |
3506 | function export_Image {
3507 | display_Title "Export Image"
3508 | display_baseImage
3509 | display_shadowFile
3510 | echo
3511 | echo "Checking image..."
3512 | targDisks=( `hdiutil attach -owners on -noverify "${LibraryPath}/${baseImage}" -shadow "${LibraryPath}/Shadow/${baseImage}.shadow" | grep "/Volumes/" | awk -F "/Volumes/" '{print $NF}' | sed -e "s/ /%20/g"` )
3513 | if [ ${#targDisks[@]} -eq 0 ] ; then
3514 | printf "\n\033[1m${baseImage}\033[m doesn't appear to be a valid.\n"
3515 | press_anyKey
3516 | else
3517 | i=0 ; for Element in "${targDisks[@]}" ; do targDisks[i]=$( echo "${Element}" | sed -e "s/%20/ /g" ) ; let i++ ; done
3518 | for targDisk in "${targDisks[@]}" ; do if [ -e "/Volumes/${targDisk}/System/Library/CoreServices/SystemVersion.plist" ] ; then break ; fi ; done
3519 | baseBuild=`echo "${baseImage}" | awk -F "_" '{print $2}'`
3520 | currentBuild=`defaults read "/Volumes/${targDisk}/System/Library/CoreServices/SystemVersion" ProductBuildVersion | awk {'print tolower()'}`
3521 | if [ "${currentBuild}" != "${baseBuild}" ] ; then imageName="${baseImage//.dmg/}+${currentBuild}_update" ; else imageName="${baseImage//.dmg/}" ; fi
3522 | sleep 5
3523 | eject_targDisk
3524 | while [ -e "${ExportPath}/${imageName}.i386.hfs.dmg" ] ; do
3525 | printf "\nA image named \033[1m${imageName}.i386.hfs.dmg\033[m already exists.\n"
3526 | read -sn 1 -p "Would you like to overwrite it (y/N)? " Overwrite < /dev/tty
3527 | echo
3528 | if [ -z "${Overwrite}" ] ; then Overwrite="n" ; fi
3529 | case "${Overwrite}" in
3530 | "Y" | "y" ) echo ; rm -f "${ExportPath}/${imageName}.i386.hfs.dmg" ; break ;;
3531 | "N" | "n" ) return 0 ; break ;;
3532 | esac
3533 | echo
3534 | done
3535 | if [ ! -e "${ExportPath}/${imageName}.i386.hfs.dmg" ] ; then
3536 | if [ ! -e "${ExportPath}" ] ; then mkdir -p "${ExportPath}" ; chown 99:99 "${ExportPath}" ; fi
3537 | hdiutil convert -format UDZO "${LibraryPath}/${baseImage}" -shadow "${LibraryPath}/Shadow/${baseImage}.shadow" -o "${ExportPath}/${imageName}.i386.hfs.dmg"
3538 | fi
3539 | while [ -z "${scanImage}" ] ; do
3540 | echo
3541 | read -sn 1 -p "Scan image for restore (Y/n)? " scanImage < /dev/tty
3542 | echo
3543 | if [ -z "${scanImage}" ] ; then scanImage="y" ; fi
3544 | case "${scanImage}" in
3545 | "Y" | "y" ) asr imagescan --source "${ExportPath}/${imageName}.i386.hfs.dmg" ; press_anyKey ;;
3546 | "N" | "n" ) echo ;;
3547 | * ) echo ; scanImage="" ;;
3548 | esac
3549 | done
3550 | fi
3551 | baseImage=""
3552 | imageName=""
3553 | scanImage=""
3554 | }
3555 |
3556 | function menu_ExportImage {
3557 | while [ "${exportOption}" != "Main Menu" ] ; do
3558 | set_exportOptions
3559 | display_Title "Export Image"
3560 | display_baseImage
3561 | display_shadowFile
3562 | echo
3563 | display_Options "Options" "Select an option: "
3564 | select exportOption in "${exportOptions[@]}" ; do
3565 | case "${exportOption}" in
3566 | "Select Image" ) select_baseImage ; exportOption="" ; break ;;
3567 | "Export Master" ) export_Image ; exportOption="" ; break ;;
3568 | "Main Menu" ) break ;;
3569 | esac
3570 | done
3571 | done
3572 | exportOption=""
3573 | baseImage=""
3574 | }
3575 |
3576 | function main_Menu {
3577 | while [ "${menuOption}" != "Exit" ] ; do
3578 | menuOptions=( "Preferences" "Create Image" "Configure Image" "Export Image" "Exit" )
3579 | display_Title "Main Menu"
3580 | display_Options "Options" "Select an option: "
3581 | select menuOption in "${menuOptions[@]}" ; do
3582 | case "${menuOption}" in
3583 | "Preferences" ) menu_Preferences ; menuOption="" ; break ;;
3584 | "Create Image" ) menu_CreateImage ; menuOption="" ; break ;;
3585 | "Configure Image" ) menu_ConfigureImage ; menuOption="" ; break ;;
3586 | "Export Image" ) menu_ExportImage ; menuOption="" ; break ;;
3587 | "Exit" ) echo ; exit 0 ;;
3588 | esac
3589 | done
3590 | done
3591 | }
3592 |
3593 | display_Title "Initializing"
3594 | privelege_Check
3595 | get_DefaultPaths
3596 | get_ImageSettings
3597 | get_SystemConfiguration
3598 | get_UserAccount
3599 | main_Menu
--------------------------------------------------------------------------------
/SIC_1.5.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Default Base Folder
4 | BaseFolder="/Users/Shared/SIC"
5 | # Default Configurations Folder
6 | ConfigurationFolder="${BaseFolder}/Configurations"
7 | # Default Library Folder
8 | LibraryFolder="${BaseFolder}/Library"
9 | # Default Packages Folder
10 | PackageFolder="${BaseFolder}/Packages"
11 | # Default Masters Folder
12 | MasterFolder="${BaseFolder}/Masters"
13 | # Default Image Size (GB)
14 | ImageSize="56.5"
15 | # Minimum Image Size
16 | minImageSize="5"
17 | # Maximum Image Size
18 | maxImageSize="2048"
19 | # Default Volume Name
20 | VolumeName="Macintosh HD"
21 | # Default Export Option for Recovery Partition (Include in Master)
22 | ExportType=1
23 | # Default for ASR Scan on Masters
24 | ScanImage=1
25 | # FirstBoot Script Path
26 | FirstBootPath="/usr/libexec/FirstBoot"
27 | # Default System Configuration
28 | Language="English"
29 | SACountryCode="US"
30 | InputSourceID="US"
31 | NTPServerName="Apple Americas/U.S. (time.apple.com)"
32 | NTPServer="time.apple.com"
33 | NTPEnabled=1
34 | GeonameID=5341145
35 | TZAuto=0
36 | RemoteLogin=0
37 | RemoteManagement=0
38 |
39 | # Additional System Settings, menus not yet implemented
40 | # Display host info at login window
41 | AdminHostInfo=0 # 0 (Off) | 1 (On)
42 | # Display login window as Name and password
43 | ShowFullName=0 # 0 (Off) | 1 (On)
44 | # Allow guests to connect to shared folders
45 | AllowGuestAccess=1 # 1 (On) | 0 (Off)
46 | # Allow managed users to add or delete printers
47 | ManagedUserPrinters=0 # 0 (Off) | 1 (On)
48 | # Automatically check for updates
49 | SoftwareUpdateCheck=1 # 1 (On) | 0 (Off)
50 |
51 | # Additional User Settings, menus not yet implemented
52 | UserSettings=1 # 0 (Off) | 1 (On)
53 | # General: Show scroll bars
54 | AppleShowScrollBars="Always" # Automatic | WhenScrolling | Always
55 | # Finder: Show Status Bar
56 | ShowStatusBar=TRUE
57 | # Finder: New Finder windows show: Computer; Volume; Home; Desktop; Documents; All My Files
58 | NewWindowTarget="PfHm" # PfCm | PfVo | PfHm | PfDe | PfDo | PfAF
59 | # Setup Assistant: Gesture Movie
60 | GestureMovieSeen="trackpad" # trackpad |
61 | # iCloud Setup
62 | SuppressCloudSetup=1 # 1 (On) | 0 (Off)
63 |
64 | # Version
65 | SICVersion="1.5b9"
66 |
67 | # ${0}: Path to this script
68 | ScriptName=`basename "${0}"`
69 |
70 | # Resize Terminal Window
71 | printf "\e[8;36;80;t"
72 |
73 | # Section: Common
74 |
75 | spin="/-\|"
76 |
77 | function display_Title {
78 | clear
79 | printf "\033[1mSystem Image Creator (SIC) ${SICVersion}\033[m\n"
80 | printf "Copyright (c) 2011-2012 Mondada Pty Ltd. All rights reserved.\n"
81 | }
82 |
83 | function display_Subtitle {
84 | # ${1}: Subtitle
85 | display_Title
86 | printf "\n\033[1m${1}\033[m\n\n"
87 | }
88 |
89 | function privelege_Check {
90 | if [ `id -u` -ne 0 ] ; then
91 | display_Title
92 | printf "\n${ScriptName} must be run with root privileges, exiting.\n\n"
93 | exit 1
94 | fi
95 | }
96 |
97 | function display_Options {
98 | # ${1}: Text above selection list
99 | # ${2}: Text for prompt
100 | printf "${1}\n\n"
101 | PS3=`printf "\n${2}"`
102 | }
103 |
104 | function press_anyKey {
105 | # ${1}: Message to display above prompt
106 | if [ -n "${1}" ] ; then echo "${1}" ; echo ; fi
107 | read -sn 1 -p "Press any key to continue..." anyKey < /dev/tty
108 | echo
109 | }
110 |
111 | function get_SystemOSVersion {
112 | SystemOSMajor=`sw_vers -productVersion | awk -F "." '{print $1}'`
113 | SystemOSMinor=`sw_vers -productVersion | awk -F "." '{print $2}'`
114 | SystemOSPoint=`sw_vers -productVersion | awk -F "." '{print $3}'`
115 | if [ -z "${SystemOSPoint}" ] ; then SystemOSPoint=0 ; fi
116 | SystemOSBuild=`sw_vers -buildVersion`
117 | }
118 |
119 | function get_LocalUsers {
120 | unset LocalRecordNames[@]
121 | unset LocalRealNames[@]
122 | unset LocalUniqueIDs[@]
123 | unset LocalNFSHomeDirectories[@]
124 | LocalUsers=( `dscl -f "/var/db/dslocal/nodes/Default" localonly -list /Local/Target/Users` )
125 | i=0 ; for Element in "${LocalUsers[@]}" ; do
126 | AuthenticationAuthority=`dscl -f "/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/${Element} "AuthenticationAuthority" 2>/dev/null`
127 | if [ "${Element}" != "root" ] && [ -n "${AuthenticationAuthority}" ] ; then
128 | LocalRecordNames[i]="${Element}"
129 | LocalRealNames[i]=`dscl -f "/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/${Element} "RealName" 2>/dev/null | grep -v "RealName:" | sed "s/^ *//g"`
130 | LocalUniqueIDs[i]=`dscl -f "/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/${Element} "UniqueID" 2>/dev/null | awk -F "UniqueID: " '{print $NF}'`
131 | LocalNFSHomeDirectories[i]=`dscl -f "/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/${Element} "NFSHomeDirectory" 2>/dev/null | awk -F "NFSHomeDirectory: " '{print $NF}'`
132 | let i++
133 | fi
134 | done
135 | }
136 |
137 | function set_Target {
138 | # ${1}: Volume
139 | if [ -n "${1}" ] ; then
140 | Target="/Volumes/${1}"
141 | else
142 | unset Target
143 | TargetType=0
144 | fi
145 | }
146 |
147 | # Section: License & Copyright
148 |
149 | function get_LicenseStatus {
150 | LicenseStatus=`defaults read ~/Library/Preferences/au.com.mondada.SIC "LicenseStatus" 2>/dev/null`
151 | }
152 |
153 | function display_License {
154 | display_Title
155 | echo
156 | echo "This program is free software: you can redistribute it and/or modify"
157 | echo "it under the terms of the GNU General Public License as published by"
158 | echo "the Free Software Foundation, either version 3 of the License, or"
159 | echo "(at your option) any later version."
160 | echo
161 | echo "This program is distributed in the hope that it will be useful,"
162 | echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
163 | echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
164 | echo "GNU General Public License for more details."
165 | echo
166 | echo "You should have received a copy of the GNU General Public License"
167 | echo "along with this program. If not, see ."
168 | echo
169 | echo "Report bugs to "
170 | echo
171 | }
172 |
173 | function display_Copyright {
174 | display_Title
175 | echo
176 | echo "This program comes with ABSOLUTELY NO WARRANTY."
177 | echo "This is free software, and you are welcome to redistribute it"
178 | echo "under certain conditions; See the GNU General Public License for"
179 | echo "details."
180 | echo
181 | echo "Report bugs to "
182 | echo
183 | sleep 1
184 | }
185 |
186 | function menu_License {
187 | if [ "${LicenseStatus}" != "1" ] ; then
188 | display_License
189 | LicenseOptions=( "Agree" "Disagree" )
190 | display_Options "To continue you must agree to the terms of the license agreement" "Select an option: "
191 | select LicenseOption in "${LicenseOptions[@]}" ; do
192 | if [ -n "${LicenseOption}" ] ; then break ; fi
193 | done
194 | if [ "${LicenseOption}" == "Disagree" ] ; then echo ; exit 1 ; fi
195 | defaults write ~/Library/Preferences/au.com.mondada.SIC "LicenseStatus" -bool TRUE
196 | else
197 | display_Copyright
198 | fi
199 | }
200 |
201 | # Section: Help
202 |
203 | function help_Preferences {
204 | display_Subtitle "Preferences"
205 | echo "Default Folders: The locations in which SIC stores things."
206 | echo
207 | echo "Configurations: Plists that contain all of your settings for an image."
208 | echo
209 | echo "Library: 'Vanilla' system images, configurations are applied to these to create"
210 | echo "your masters."
211 | echo
212 | echo "Packages: If you want to add software to your image, place OS X installer"
213 | echo "packages in this folder."
214 | echo
215 | echo "Masters: Where SIC exports the restore-ready images."
216 | echo
217 | echo "Image Settings: Set the default image size & volume name."
218 | echo
219 | echo "Export Settings: Allows you to select the default export behaviours for"
220 | echo "masters. Splitting the recovery partition away from the image is the default"
221 | echo "behaviour for DeployStudio."
222 | echo
223 | press_anyKey
224 | }
225 |
226 | function help_Creating {
227 | display_Subtitle "Creating Images"
228 | echo "SIC will create images from two sources:"
229 | echo " - An un-booted, un-configured system volume attached to your computer."
230 | echo " - An OS X install ESD or DVD."
231 | echo
232 | echo "These images will be saved to SIC's Library. These images are un-configured"
233 | echo "and used to create masters by applying configuration(s) to them."
234 | echo
235 | echo "Once a version of OS X is in the library, you don't need to capture/install"
236 | echo "that version again."
237 | echo
238 | echo "Note: When performing an installation, you will only be able to select an"
239 | echo " installer of the same version of OS X your are running."
240 | echo " eg. If you are running Mountain Lion, you can only perform Mountain Lion"
241 | echo " installations."
242 | echo
243 | press_anyKey
244 | }
245 |
246 | function help_Configuring {
247 | display_Subtitle "Configuring Images"
248 | echo "The System Setup section will allow you to configure the system settings you"
249 | echo "wish to apply to your image(s). If you have an un-configured system attached to"
250 | echo "your computer, you may also apply your system settings to this volume allowing"
251 | echo "you to use SIC for a 'No-Imaging' workflow."
252 | echo
253 | echo "Select Target: Allows you to choose an image from the Library, or an attached"
254 | echo "volume to configure. You don't need to select a target to create a"
255 | echo "configuration, but you must have a target selected to apply a configuration."
256 | echo
257 | echo "Configurations: Files which contain the settings which you wish to apply to"
258 | echo "un-configured images/volumes. You may apply a configuration to multiple OS X"
259 | echo "versions, but remember to check your settings are being displayed correctly in"
260 | echo "each section, particularly System Preferences."
261 | echo
262 | echo "System Preferences: This simply creates the settings achieved by running the"
263 | echo "Setup Assistant at 1st boot. There are a few additional options, which are"
264 | echo "helpful when creating images for mass-deployment"
265 | echo
266 | echo "Users: Create and edit User Accounts on your image."
267 | echo
268 | echo "Packages: Allows you to select packages to install software on your image."
269 | echo "If the package is unable to be installed, it will be copied to the image and"
270 | echo "installation attempted on first boot."
271 | echo
272 | echo "Remove Software: To reduce your image size, particularly when creating an image"
273 | echo "of a new (factory) system, you may want to remove some of the pre-installed"
274 | echo "software."
275 | echo
276 | press_anyKey
277 | display_Subtitle "Configuring Images"
278 | echo "Apply Configuration: This will export a master image or configure an attached"
279 | echo "volume, with the settings displayed in the previous sections."
280 | echo
281 | echo "Note: Applying a configuration is non-destructive to images in your Library"
282 | echo " the configured image will be exported to the Masters folder, ready for"
283 | echo " restore."
284 | echo
285 | echo "Note: Applying a configuration to a volume will cause SIC to ignore it once"
286 | echo " the configuration is complete, the volume is seen as a configured"
287 | echo " system which SIC can do nothing with."
288 | echo
289 | press_anyKey
290 | }
291 |
292 | function menu_Help {
293 | HelpOptions=( "Main Menu" "Preferences" "Creating Images" "Configuring Images" )
294 | while [ "${Option}" != "Main Menu" ] ; do
295 | display_Subtitle "Help"
296 | echo "SIC is a tool to assist with the creation of OS X images for mass deployment."
297 | echo
298 | echo "The workflow is designed to prevent the need to create everything from scratch"
299 | echo "when a new version of OS X is released. Additionally, once a build of OS X is"
300 | echo "captured it can be re-used to create multiple images, without the need to"
301 | echo "re-install the base operating system."
302 | echo
303 | echo "The simplest possible workflow for SIC is:"
304 | echo " - Mount your OS X installer (or insert disc)"
305 | echo " - Select Create Image"
306 | echo " - Follow the prompts (Once this is captured, you may use it as many times as"
307 | echo " you wish)"
308 | echo " - Return to the Main Menu, select System Setup"
309 | echo " - Select your Target (the image you just created)"
310 | echo " - Set your System Preferences"
311 | echo " - Create your User(s)"
312 | echo " - Apply your Configuration"
313 | echo
314 | echo "For detailed information, select from the options below."
315 | echo
316 | display_Options "Options" "Select an option: "
317 | select Option in "${HelpOptions[@]}" ; do
318 | case "${Option}" in
319 | "Main Menu" ) break ;;
320 | "Preferences" ) help_Preferences ; unset Option ; break ;;
321 | "Creating Images" ) help_Creating ; unset Option ; break ;;
322 | "Configuring Images" ) help_Configuring ; unset Option ; break ;;
323 | esac
324 | done
325 | done
326 | unset Option
327 | }
328 |
329 | # Section: Preferences
330 |
331 | function check_Path {
332 | # ${1}: Path to validate
333 | validPath=0
334 | # Check for invalid characters
335 | escapedPath="${1//[\$\(\)\[\]\`\~\?\*\#\\\!\|\'\"]/_}"
336 | if [ "${1}" != "${escapedPath}" ] ; then
337 | printf "\nThe specified path cannot contain the following characters: \033[1m\$()[]\`~?*#\!|'\"\033[m\n" ; validPath=1 ; return 1
338 | fi
339 | # Check that it's absolute
340 | relativePath=`echo "${1}" | awk -F "/" '{print $1}'`
341 | if [ -n "${relativePath}" ] ; then
342 | printf "\nThe specified path must be absolute, please enter an absolute path\n" ; validPath=1 ; return 1
343 | fi
344 | # Check the volume exists
345 | if echo "${1}" | grep -q "/Volumes/" ; then
346 | volumeName=`echo "${1}" | awk -F "/Volumes/" '{print $NF}' | awk -F "/" '{print $1}'`
347 | if [ ! -d "/Volumes/${volumeName}" ] ; then
348 | printf "\nThe specified volume cannot be found, please enter a valid path\n" ; validPath=1 ; return 1
349 | fi
350 | fi
351 | # Check that the path is not a file
352 | if [ -f "${1}" ] ; then
353 | printf "\nThe specified path is to a file, please enter a path to a folder\n" ; validPath=1 ; return 1
354 | fi
355 | # Check that the path is unique
356 | if [ "${1}" == "${ConfigurationFolder}" ] || [ "${1}" == "${LibraryFolder}" ] || [ "${1}" == "${PackageFolder}" ] || [ "${1}" == "${MasterFolder}" ] ; then
357 | printf "\nThe folders must be unique, please enter a different path\n" ; validPath=1 ; return 1
358 | fi
359 | return 0
360 | }
361 |
362 | function get_ConfigurationFolder {
363 | prefConfigurationFolder=`defaults read ~/Library/Preferences/au.com.mondada.SIC "ConfigurationFolder" 2>/dev/null`
364 | if [ -n "${prefConfigurationFolder}" ] ; then
365 | if [ -d "${prefConfigurationFolder}" ] ; then
366 | ConfigurationFolder="${prefConfigurationFolder}"
367 | else
368 | printf "Warning: Configurations Folder missing, reverting to default\n"
369 | fi
370 | fi
371 | }
372 |
373 | function set_ConfigurationFolder {
374 | display_Subtitle "Default Folders"
375 | printf "Configurations Folder (${ConfigurationFolder}): " ; read newConfigurationFolder
376 | if [ -z "${newConfigurationFolder}" ] || [ "${newConfigurationFolder}" == "${ConfigurationFolder}" ] ; then return 0 ; fi
377 | check_Path "${newConfigurationFolder}"
378 | while [ ${validPath} -ne 0 ] ; do
379 | printf "\nConfiguration Folder (${ConfigurationFolder}): " ; read newConfigurationFolder
380 | if [ -z "${newConfigurationFolder}" ] || [ "${newConfigurationFolder}" == "${ConfigurationFolder}" ] ; then return 0 ; fi
381 | check_Path "${newConfigurationFolder}"
382 | done
383 | ConfigurationFolder="${newConfigurationFolder}"
384 | }
385 |
386 | function get_LibraryFolder {
387 | prefLibraryFolder=`defaults read ~/Library/Preferences/au.com.mondada.SIC "LibraryFolder" 2>/dev/null`
388 | if [ -n "${prefLibraryFolder}" ] ; then
389 | if [ -d "${prefLibraryFolder}" ] ; then
390 | LibraryFolder="${prefLibraryFolder}"
391 | else
392 | printf "Warning: Library Folder missing, reverting to default\n"
393 | fi
394 | fi
395 | }
396 |
397 | function set_LibraryFolder {
398 | display_Subtitle "Default Folders"
399 | printf "Library Folder (${LibraryFolder}): " ; read newLibraryFolder
400 | if [ -z "${newLibraryFolder}" ] || [ "${newLibraryFolder}" == "${LibraryFolder}" ] ; then return 0 ; fi
401 | check_Path "${newLibraryFolder}"
402 | while [ ${validPath} -ne 0 ] ; do
403 | printf "\nLibrary Folder (${LibraryFolder}): " ; read newLibraryFolder
404 | if [ -z "${newLibraryFolder}" ] || [ "${newLibraryFolder}" == "${LibraryFolder}" ] ; then return 0 ; fi
405 | check_Path "${newLibraryFolder}"
406 | done
407 | LibraryFolder="${newLibraryFolder}"
408 | }
409 |
410 | function get_PackageFolder {
411 | prefPackageFolder=`defaults read ~/Library/Preferences/au.com.mondada.SIC "PackageFolder" 2>/dev/null`
412 | if [ -n "${prefPackageFolder}" ] ; then
413 | if [ -d "${prefPackageFolder}" ] ; then
414 | PackageFolder="${prefPackageFolder}"
415 | else
416 | printf "Warning: Packages Folder missing, reverting to default\n"
417 | fi
418 | fi
419 | }
420 |
421 | function set_PackageFolder {
422 | display_Subtitle "Default Folders"
423 | printf "Packages Folder (${PackageFolder}): " ; read newPackageFolder
424 | if [ -z "${newPackageFolder}" ] || [ "${newPackageFolder}" == "${PackageFolder}" ] ; then return 0 ; fi
425 | check_Path "${newPackageFolder}"
426 | while [ ${validPath} -ne 0 ] ; do
427 | printf "\nPackage Folder (${PackageFolder}): " ; read newPackageFolder
428 | if [ -z "${newPackageFolder}" ] || [ "${newPackageFolder}" == "${PackageFolder}" ] ; then return 0 ; fi
429 | check_Path "${newPackageFolder}"
430 | done
431 | PackageFolder="${newPackageFolder}"
432 | }
433 |
434 | function get_MasterFolder {
435 | prefMasterFolder=`defaults read ~/Library/Preferences/au.com.mondada.SIC "MasterFolder" 2>/dev/null`
436 | if [ -n "${prefMasterFolder}" ] ; then
437 | if [ -d "${prefMasterFolder}" ] ; then
438 | MasterFolder="${prefMasterFolder}"
439 | else
440 | printf "Warning: Masters Folder missing, reverting to default\n"
441 | fi
442 | fi
443 | }
444 |
445 | function set_MasterFolder {
446 | display_Subtitle "Default Folders"
447 | printf "Masters Folder (${MasterFolder}): " ; read newMasterFolder
448 | if [ -z "${newMasterFolder}" ] || [ "${newMasterFolder}" == "${MasterFolder}" ] ; then return 0 ; fi
449 | check_Path "${newMasterFolder}"
450 | while [ ${validPath} -ne 0 ] ; do
451 | printf "\nMaster Folder (${MasterFolder}): " ; read newMasterFolder
452 | if [ -z "${newMasterFolder}" ] || [ "${newMasterFolder}" == "${MasterFolder}" ] ; then return 0 ; fi
453 | check_Path "${newMasterFolder}"
454 | done
455 | MasterFolder="${newMasterFolder}"
456 | }
457 |
458 | function display_DefaultFolders {
459 | printf "Configurations: ${ConfigurationFolder}\n"
460 | printf "Library: ${LibraryFolder}\n"
461 | printf "Packages: ${PackageFolder}\n"
462 | printf "Masters: ${MasterFolder}\n"
463 | printf "\n"
464 | }
465 |
466 | function save_DefaultFolders {
467 | defaults write ~/Library/Preferences/au.com.mondada.SIC "ConfigurationFolder" -string "${ConfigurationFolder}"
468 | if [ ! -d "${ConfigurationFolder}" ] ; then mkdir -p "${ConfigurationFolder}" ; fi
469 | defaults write ~/Library/Preferences/au.com.mondada.SIC "LibraryFolder" -string "${LibraryFolder}"
470 | if [ ! -d "${LibraryFolder}" ] ; then mkdir -p "${LibraryFolder}" ; fi
471 | defaults write ~/Library/Preferences/au.com.mondada.SIC "PackageFolder" -string "${PackageFolder}"
472 | if [ ! -d "${PackageFolder}" ] ; then mkdir -p "${PackageFolder}" ; fi
473 | defaults write ~/Library/Preferences/au.com.mondada.SIC "MasterFolder" -string "${MasterFolder}"
474 | if [ ! -d "${MasterFolder}" ] ; then mkdir -p "${MasterFolder}" ; fi
475 | }
476 |
477 | function menu_DefaultFolders {
478 | FolderOptions=( "Preferences Menu" "Configurations" "Library" "Packages" "Masters" )
479 | while [ "${Option}" != "Preferences Menu" ] ; do
480 | display_Subtitle "Default Folders"
481 | display_DefaultFolders
482 | display_Options "Options" "Select an option: "
483 | select Option in "${FolderOptions[@]}" ; do
484 | case "${Option}" in
485 | "Preferences Menu" ) break ;;
486 | "Configurations" ) set_ConfigurationFolder ; unset Option ; break ;;
487 | "Library" ) set_LibraryFolder ; unset Option ; break ;;
488 | "Packages" ) set_PackageFolder ; unset Option ; break ;;
489 | "Masters" ) set_MasterFolder ; unset Option ; break ;;
490 | esac
491 | done
492 | done
493 | unset Option
494 | unset SaveDefaults
495 | while [ -z "${SaveDefaults}" ] ; do
496 | echo
497 | read -sn 1 -p "Save as default settings (Y/n)? " SaveDefaults < /dev/tty
498 | echo
499 | if [ -z "${SaveDefaults}" ] ; then SaveDefaults="y" ; fi
500 | case "${SaveDefaults}" in
501 | "Y" | "y" ) save_DefaultFolders ; echo ;;
502 | "N" | "n" ) echo ;;
503 | * ) echo ; unset SaveDefaults ;;
504 | esac
505 | done
506 | unset SaveDefaults
507 | }
508 |
509 | function get_ImageSize {
510 | prefImageSize=`defaults read ~/Library/Preferences/au.com.mondada.SIC "ImageSize" 2>/dev/null`
511 | if [ -n "${prefImageSize}" ] ; then ImageSize="${prefImageSize}" ; fi
512 | }
513 |
514 | function check_Size {
515 | # ${1}: Size to validate
516 | validSize=0
517 | # Remove invalid characters
518 | newImageSize="${1//[^0-9.]/}"
519 | # Validate the clean string to ensure its numeric
520 | isValid=$( echo "scale=0; ${newImageSize}/${newImageSize} + 1" | bc -l 2>/dev/null )
521 | if [ ${isValid} -gt 1 ] ; then
522 | # Check that it's larger than 5 GB
523 | if [ $( echo "${newImageSize} < ${minImageSize}" | bc 2>/dev/null ) -ne 0 ] ; then printf "\nMac OS X requires at least \033[1m${minImageSize}\033[m GB of free space to install.\n" ; ImageSize="${minImageSize}" ; validSize=1 ; return 1 ; fi
524 | # Check that it's smaller than 2 TB
525 | if [ $( echo "${newImageSize} > ${maxImageSize}" | bc 2>/dev/null ) -ne 0 ] ; then printf "\nThe maximum image size is \033[1m${maxImageSize}\033[m GB.\n" ; ImageSize="${maxImageSize}" ; validSize=1 ; return 1 ; fi
526 | return 0
527 | else
528 | printf "\n\033[1m${1}\033[m is not a valid value, please enter a numeric value.\n" ; validSize=1 ; return 1
529 | fi
530 | }
531 |
532 | function set_ImageSize {
533 | display_Subtitle "Image Settings"
534 | printf "Image Size (${ImageSize}): " ; read newImageSize
535 | if [ -z "${newImageSize}" ] || [ "${newImageSize}" == "${ImageSize}" ] ; then return 0 ; fi
536 | check_Size "${newImageSize}"
537 | while [ ${validSize} -ne 0 ] ; do
538 | printf "\nImage Size (${ImageSize} GB): " ; read newImageSize
539 | if [ -z "${newImageSize}" ] || [ "${newImageSize}" == "${ImageSize}" ] ; then return 0 ; fi
540 | check_Size "${newImageSize}"
541 | done
542 | ImageSize="${newImageSize}"
543 | }
544 |
545 | function get_VolumeName {
546 | prefVolumeName=`defaults read ~/Library/Preferences/au.com.mondada.SIC "VolumeName" 2>/dev/null`
547 | if [ -n "${prefVolumeName}" ] ; then VolumeName="${prefVolumeName}" ; fi
548 | }
549 |
550 | function check_VolumeName {
551 | # ${1}: Volume Name to validate
552 | validName=0
553 | # Check for invalid characters
554 | escapedName="${1//[\$\(\)\[\]\`\~\?\*\#\\\!\|\'\"]/_}"
555 | if [ "${1}" != "${escapedName}" ] ; then printf "\nThe volume name cannot contain the following characters: \033[1m\$()[]\`~?*#\!|'\"\033[m\n" ; validName=1 ; return 1 ; fi
556 | return 0
557 | }
558 |
559 | function set_VolumeName {
560 | display_Subtitle "Image Settings"
561 | printf "Volume Name (${VolumeName}): " ; read newVolumeName
562 | if [ -z "${newVolumeName}" ] || [ "${newVolumeName}" == "${VolumeName}" ] ; then return 0 ; fi
563 | newVolumeName="${newVolumeName//\//:}"
564 | check_VolumeName "${newVolumeName}"
565 | while [ ${validName} -ne 0 ] ; do
566 | printf "Volume Name (${VolumeName}): " ; read newVolumeName
567 | if [ -z "${newVolumeName}" ] || [ "${newVolumeName}" == "${VolumeName}" ] ; then return 0 ; fi
568 | newVolumeName="${newVolumeName//\//:}"
569 | check_VolumeName "${newVolumeName}"
570 | done
571 | VolumeName="${newVolumeName}"
572 | }
573 |
574 | function display_ImageSettings {
575 | printf "Image Size: ${ImageSize} GB\n"
576 | printf "Volume Name: ${VolumeName}\n"
577 | printf "\n"
578 | }
579 |
580 | function save_ImageSettings {
581 | defaults write ~/Library/Preferences/au.com.mondada.SIC "ImageSize" -float "${ImageSize}"
582 | defaults write ~/Library/Preferences/au.com.mondada.SIC "VolumeName" -string "${VolumeName}"
583 | }
584 |
585 | function menu_ImageSettings {
586 | ImageOptions=( "Preferences Menu" "Image Size" "Volume Name" )
587 | while [ "${Option}" != "Preferences Menu" ] ; do
588 | display_Subtitle "Image Settings"
589 | display_ImageSettings
590 | display_Options "Options" "Select an option: "
591 | select Option in "${ImageOptions[@]}" ; do
592 | case "${Option}" in
593 | "Preferences Menu" ) break ;;
594 | "Image Size" ) set_ImageSize ; unset Option ; break ;;
595 | "Volume Name" ) set_VolumeName ; unset Option ; break ;;
596 | esac
597 | done
598 | done
599 | unset Option
600 | unset SaveDefaults
601 | while [ -z "${SaveDefaults}" ] ; do
602 | echo
603 | read -sn 1 -p "Save as default settings (Y/n)? " SaveDefaults < /dev/tty
604 | echo
605 | if [ -z "${SaveDefaults}" ] ; then SaveDefaults="y" ; fi
606 | case "${SaveDefaults}" in
607 | "Y" | "y" ) save_ImageSettings ; echo ;;
608 | "N" | "n" ) echo ;;
609 | * ) echo ; unset SaveDefaults ;;
610 | esac
611 | done
612 | unset SaveDefaults
613 | }
614 |
615 | function get_ExportType {
616 | prefExportType=`defaults read ~/Library/Preferences/au.com.mondada.SIC "ExportType" 2>/dev/null`
617 | if [ -n "${prefExportType}" ] ; then ExportType="${prefExportType}" ; fi
618 | }
619 |
620 | function display_RecoveryPartition {
621 | printf " ["
622 | if [ ${ExportType} -eq 1 ] ; then printf "*" ; else printf " " ; fi
623 | printf "] Include Recovery Partition in Master\n"
624 | printf " ["
625 | if [ ${ExportType} -eq 2 ] ; then printf "*" ; else printf " " ; fi
626 | printf "] Remove Recovery Partition from Master\n"
627 | printf " ["
628 | if [ ${ExportType} -eq 3 ] ; then printf "*" ; else printf " " ; fi
629 | printf "] Create separate image for Recovery Partition\n"
630 | printf "\n"
631 | }
632 |
633 | function set_RecoveryPartition {
634 | RecoveryOptions=( "Include Recovery Partition in Master" "Remove Recovery Partition from Master" "Create separate image for Recovery Partition" )
635 | display_Subtitle "Export Settings"
636 | display_RecoveryPartition
637 | display_Options "Options" "Select an option: "
638 | select Option in "${RecoveryOptions[@]}" ; do
639 | case "${Option}" in
640 | "Include Recovery Partition in Master" ) ExportType=1 ; break ;;
641 | "Remove Recovery Partition from Master" ) ExportType=2 ; break ;;
642 | "Create separate image for Recovery Partition" ) ExportType=3 ; break ;;
643 | esac
644 | done
645 | unset Option
646 | }
647 |
648 | function get_ScanImage {
649 | prefScanImage=`defaults read ~/Library/Preferences/au.com.mondada.SIC "ScanImage" 2>/dev/null`
650 | if [ -n "${prefScanImage}" ] ; then ScanImage="${prefScanImage}" ; fi
651 | }
652 |
653 | function display_ScanImage {
654 | printf " ["
655 | if [ ${ScanImage} -eq 1 ] ; then printf "*" ; else printf " " ; fi
656 | printf "] Scan masters for restore\n"
657 | printf "\n"
658 | }
659 |
660 | function set_ScanImage {
661 | display_Subtitle "Export Settings"
662 | display_ScanImage
663 | while [ -z "${ASR}" ] ; do
664 | read -sn 1 -p "Scan masters for restore (Y/n)? " ASR < /dev/tty
665 | if [ -z "${ASR}" ] ; then ASR="y" ; fi
666 | case "${ASR}" in
667 | "Y" | "y" ) echo ; ScanImage=1 ;;
668 | "N" | "n" ) echo ; ScanImage=0 ;;
669 | * ) echo ; unset ASR ;;
670 | esac
671 | done
672 | unset ASR
673 | }
674 |
675 | function display_ExportSettings {
676 | display_RecoveryPartition
677 | display_ScanImage
678 | }
679 |
680 | function save_ExportSettings {
681 | defaults write ~/Library/Preferences/au.com.mondada.SIC "ExportType" -int ${ExportType}
682 | defaults write ~/Library/Preferences/au.com.mondada.SIC "ScanImage" -int ${ScanImage}
683 | }
684 |
685 | function menu_ExportSettings {
686 | ExportOptions=( "Preferences Menu" "Recovery Partition" "Scan for Restore" )
687 | while [ "${Option}" != "Preferences Menu" ] ; do
688 | display_Subtitle "Export Settings"
689 | display_ExportSettings
690 | display_Options "Options" "Select an option: "
691 | select Option in "${ExportOptions[@]}" ; do
692 | case "${Option}" in
693 | "Preferences Menu" ) break ;;
694 | "Recovery Partition" ) set_RecoveryPartition ; unset Option ; break ;;
695 | "Scan for Restore" ) set_ScanImage ; unset Option ; break ;;
696 | esac
697 | done
698 | done
699 | unset Option
700 | unset SaveDefaults
701 | while [ -z "${SaveDefaults}" ] ; do
702 | echo
703 | read -sn 1 -p "Save as default settings (Y/n)? " SaveDefaults < /dev/tty
704 | echo
705 | if [ -z "${SaveDefaults}" ] ; then SaveDefaults="y" ; fi
706 | case "${SaveDefaults}" in
707 | "Y" | "y" ) save_ExportSettings ; echo ;;
708 | "N" | "n" ) echo ;;
709 | * ) echo ; unset SaveDefaults ;;
710 | esac
711 | done
712 | unset SaveDefaults
713 | }
714 |
715 | function get_Preferences {
716 | get_ConfigurationFolder
717 | get_LibraryFolder
718 | get_PackageFolder
719 | get_MasterFolder
720 | get_VolumeName
721 | get_ImageSize
722 | get_ExportType
723 | get_ScanImage
724 | }
725 |
726 | function menu_Preferences {
727 | PrefOptions=( "Main Menu" "Default Folders" "Image Settings" "Export Settings" )
728 | while [ "${Option}" != "Main Menu" ] ; do
729 | display_Subtitle "Preferences"
730 | display_Options "Options" "Select an option: "
731 | select Option in "${PrefOptions[@]}" ; do
732 | case "${Option}" in
733 | "Main Menu" ) break ;;
734 | "Default Folders" ) menu_DefaultFolders ; unset Option ; break ;;
735 | "Image Settings" ) menu_ImageSettings ; unset Option ; break ;;
736 | "Export Settings" ) menu_ExportSettings ; unset Option ; break ;;
737 | esac
738 | done
739 | done
740 | unset Option
741 | }
742 |
743 | # Section: Create Image
744 |
745 | function detect_Sources {
746 | unset SourceVersions[@]
747 | unset SourceBuilds[@]
748 | unset SourceVolumes[@]
749 | unset ImageNames[@]
750 | IFS=$'\n'
751 | Volumes=( `df | grep "/Volumes/" | awk -F "/Volumes/" '{print $NF}'` )
752 | unset IFS
753 | for Volume in "${Volumes[@]}" ; do
754 | if [ ! -e "/Volumes/${Volume}/var/db/.AppleSetupDone" ] && [ -e "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion.plist" ] ; then
755 | SourceOSMinor=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion" ProductVersion | awk -F "." '{print $2}'`
756 | SourceOSPoint=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion" ProductVersion | awk -F "." '{print $3}'`
757 | if [ -z "${SourceOSPoint}" ] ; then SourceOSPoint=0 ; fi
758 | case ${SourceOSMinor} in
759 | 5 ) OSname="leopard" ;;
760 | 6 ) OSname="snowleopard" ;;
761 | 7 ) OSname="lion" ;;
762 | 8 ) OSname="mountainlion" ;;
763 | esac
764 | if [ -e "/Volumes/${Volume}/System/Library/CoreServices/ServerVersion.plist" ] || [ -e "/Volumes/${Volume}/Applications/Server.app" ] || [ -e "/Volumes/${Volume}/Packages/Server.pkg" ] ; then
765 | ProductName="Mac OS X Server"
766 | ProductType="server"
767 | else
768 | ProductName="Mac OS X"
769 | ProductType="user"
770 | fi
771 | ProductVersion=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion" ProductVersion`
772 | ProductBuildVersion=`defaults read "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion" ProductBuildVersion`
773 | if [ -e "/Volumes/${Volume}/System/Installation/Packages/OSInstall.mpkg" ] || [ -e "/Volumes/${Volume}/Packages/OSInstall.mpkg" ] ; then
774 | if [ ${SourceOSMinor} -eq ${SystemOSMinor} ] ; then
775 | if [ ${SystemOSMinor} -eq 7 -a ${SystemOSPoint} -gt 3 ] ; then
776 | if [ ${SourceOSPoint} -gt 3 ] ; then
777 | SourceVersions=( "${SourceVersions[@]}" "${ProductName} ${ProductVersion} (${ProductBuildVersion}) Installer" )
778 | SourceBuilds=( "${SourceBuilds[@]}" "${ProductBuildVersion}" )
779 | SourceVolumes=( "${SourceVolumes[@]}" "${Volume}" )
780 | ImageNames=( "${ImageNames[@]}" `echo "${OSname}_${ProductBuildVersion}_${ProductType}" | awk {'print tolower()'}` )
781 | fi
782 | else
783 | SourceVersions=( "${SourceVersions[@]}" "${ProductName} ${ProductVersion} (${ProductBuildVersion}) Installer" )
784 | SourceBuilds=( "${SourceBuilds[@]}" "${ProductBuildVersion}" )
785 | SourceVolumes=( "${SourceVolumes[@]}" "${Volume}" )
786 | ImageNames=( "${ImageNames[@]}" `echo "${OSname}_${ProductBuildVersion}_${ProductType}" | awk {'print tolower()'}` )
787 | fi
788 | fi
789 | else
790 | SourceVersions=( "${SourceVersions[@]}" "${ProductName} ${ProductVersion} (${ProductBuildVersion})" )
791 | SourceBuilds=( "${SourceBuilds[@]}" "${ProductBuildVersion}" )
792 | SourceVolumes=( "${SourceVolumes[@]}" "${Volume}" )
793 | ImageNames=( "${ImageNames[@]}" `echo "${OSname}_${ProductBuildVersion}_${ProductType}" | awk {'print tolower()'}` )
794 | fi
795 | fi
796 | done
797 | }
798 |
799 | function display_Source {
800 | printf "Source: "
801 | if [ -n "${SourceVersion}" ] ; then printf "${SourceVersion}" ; else printf "-" ; fi
802 | printf "\nImage Name: "
803 | if [ -n "${ImageName}" ] ; then printf "${ImageName}.dmg" ; else printf "-" ; fi
804 | printf "\n"
805 | printf "\n"
806 | }
807 |
808 | function select_Source {
809 | detect_Sources
810 | display_Subtitle "Select Source"
811 | if [ ${#SourceVersions[@]} -eq 0 ] ; then
812 | unset SourceVersion
813 | unset SourceBuild
814 | unset SourceVolume
815 | unset ImageName
816 | press_anyKey "No sources available, please insert or mount an OS X Installer, or attach or mount an un-booted system volume."
817 | else
818 | display_Source
819 | display_Options "Sources" "Select a source: "
820 | select SourceVersion in "${SourceVersions[@]}" ; do
821 | if [ -n "${SourceVersion}" ] ; then break ; fi
822 | done
823 | i=0 ; for Element in "${SourceVersions[@]}" ; do
824 | if [ "${Element}" == "${SourceVersion}" ] ; then
825 | SourceVolume="${SourceVolumes[i]}"
826 | SourceBuild="${SourceBuilds[i]}"
827 | ImageName="${ImageNames[i]}"
828 | break
829 | fi
830 | let i++
831 | done
832 | fi
833 | }
834 |
835 | function install_Package {
836 | # ${1}: Path to package
837 | # ${2}: Installation target
838 | # ${3}: InstallType
839 | unset allowUntrusted
840 | if [ ${SystemOSMinor} -eq 7 -a ${SystemOSPoint} -gt 3 ] || [ ${SystemOSMinor} -gt 7 ] ; then GateKeeper="-allowUntrusted" ; fi
841 | if [ -e "${1}" ] ; then
842 | IFS=$'\n'
843 | PackageTitles=( `installer -pkginfo -pkg "${1}"` )
844 | unset IFS
845 | s=1
846 | if [ ${3} -eq 1 ] ; then
847 | printf "\ninstaller: Package name is ${PackageTitles[0]}\n"
848 | open "${1}"
849 | printf "installer:PHASE:Waiting for installation to complete…\n"
850 | while [ `ps eax | grep -i "Installer.app" | grep -v "grep" | awk '{print $1}'` ] ; do
851 | printf "\b${spin:s++%${#spin}:1}"
852 | done
853 | printf "\binstaller: The install is complete.\n"
854 | else
855 | unset Previous
856 | unset InstallerStatus
857 | unset InstallerProgress
858 | installer -verboseR "${GateKeeper}" -pkg "${1}" -target "${2}" 2>/dev/null | while read Line ; do
859 | if echo "${Line}" | grep -q "installer: " ; then printf "${Line}\n" ; fi
860 | if echo "${Line}" | grep -q "\(installer:PHASE:\|installer:STATUS:\)" ; then
861 | if [ "${InstallerStatus}" != "${Line}" ] ; then
862 | InstallerStatus="${Line}"
863 | if echo "${Previous}" | grep -q "installer:%" ; then
864 | printf "\n${InstallerStatus}\n"
865 | else
866 | printf "${InstallerStatus}\n"
867 | fi
868 | fi
869 | fi
870 | if echo "${Line}" | grep -q "installer:%" ; then
871 | if [ "${InstallerProgress}" != "${Line}" ] ; then
872 | InstallerProgress="${Line//%/%%}"
873 | printf "\r${InstallerProgress}"
874 | fi
875 | fi
876 | Previous="${Line}"
877 | done
878 | fi
879 | echo
880 | else
881 | press_anyKey "The package selection is invalid, please review your settings."
882 | fi
883 | }
884 |
885 | function create_Image {
886 | display_Subtitle "Create Image"
887 | display_Source
888 | if [ -z "${SourceVersion}" ] ; then press_anyKey "No source selected, please select a source first." ; return 1 ; fi
889 | if [ ! -e "/Volumes/${SourceVolume}" ] ; then press_anyKey "The source volume is no longer available, please re-select the source." ; return 1 ; fi
890 | ProductBuildVersion=`defaults read "/Volumes/${SourceVolume}/System/Library/CoreServices/SystemVersion" ProductBuildVersion`
891 | if [ "${SourceBuild}" != "${ProductBuildVersion}" ] ; then press_anyKey "The source volume is no longer available, please re-select the source." ; return 1 ; fi
892 | while [ -e "${LibraryFolder}/${ImageName}.dmg" ] ; do
893 | printf "An image already exists named \033[1m${ImageName}.dmg\033[m.\n"
894 | read -sn 1 -p "Would you like to overwrite it (y/N)? " Overwrite < /dev/tty ; echo
895 | if [ -z "${Overwrite}" ] ; then Overwrite="n" ; fi
896 | case "${Overwrite}" in
897 | "Y" | "y" ) echo ; rm -f "${LibraryFolder}/${ImageName}.dmg" ; break ;;
898 | "N" | "n" ) echo ; break ;;
899 | esac
900 | done
901 | unset Overwrite
902 | if [ ! -e "${LibraryFolder}/${ImageName}.dmg" ] ; then
903 | Removables=(
904 | ".Spotlight-V100"
905 | ".Trashes"
906 | ".fseventsd"
907 | )
908 | if [ ! -e "${LibraryFolder}" ] ; then mkdir -p "${LibraryFolder}" ; chown 99:99 "${LibraryFolder}" ; fi
909 | if [ -e "/Volumes/${SourceVolume}/System/Installation/Packages/OSInstall.mpkg" ] || [ -e "/Volumes/${SourceVolume}/Packages/OSInstall.mpkg" ] ; then
910 | rm -f "/tmp/${ImageName}.sparseimage" &>/dev/null
911 | hdiutil create -size "${ImageSize}g" -type SPARSE -fs HFS+J -volname "${VolumeName}" "/tmp/${ImageName}.sparseimage"
912 | Volume=`hdiutil attach -owners on -noverify "/tmp/${ImageName}.sparseimage" | grep "/Volumes/${VolumeName}" | awk -F "/Volumes/" '{print $NF}'`
913 | set_Target "${Volume}"
914 | chown 0:80 "${Target}"
915 | chmod 1775 "${Target}"
916 | if [ -e "/Volumes/${SourceVolume}/System/Installation/Packages/OSInstall.mpkg" ] ; then
917 | unset Customize
918 | while [ -z "${Customize}" ] ; do
919 | echo
920 | read -sn 1 -p "Customize Installation (y/N)? " Customize < /dev/tty
921 | if [ -z "${Customize}" ] ; then Customize="n" ; fi ; echo
922 | case "${Customize}" in
923 | "Y" | "y" ) InstallType=1 ; break ;;
924 | "N" | "n" ) InstallType=0 ; break ;;
925 | * ) unset Customize ;;
926 | esac
927 | echo
928 | done
929 | install_Package "/Volumes/${SourceVolume}/System/Installation/Packages/OSInstall.mpkg" "${Target}" ${InstallType}
930 | else
931 | install_Package "/Volumes/${SourceVolume}/Packages/OSInstall.mpkg" "${Target}" 0
932 | fi
933 | bless --folder "${Target}/System/Library/CoreServices" --bootefi 2>/dev/null
934 | touch "${Target}/private/var/db/.RunLanguageChooserToo"
935 | for Removable in "${Removables[@]}" ; do
936 | if [ -e "${Target}/${Removable}" ] ; then rm -rf "${Target}/${Removable}" ; fi
937 | done
938 | Device=`diskutil info "${Target}" | grep "Part of Whole:" | awk '{print $NF}'`
939 | diskutil unmountDisk force "/dev/${Device}" &>/dev/null
940 | printf "Unmount of all volumes on ${Device} was successful\n"
941 | diskutil eject "/dev/${Device}" &>/dev/null
942 | printf "Disk /dev/${Device} ejected\n"
943 | hdiutil convert -format UDZO "/tmp/${ImageName}.sparseimage" -o "${LibraryFolder}/${ImageName}.dmg"
944 | rm -f "/tmp/${ImageName}.sparseimage" &>/dev/null
945 | echo
946 | press_anyKey
947 | else
948 | for Removable in "${Removables[@]}" ; do
949 | if [ -e "/Volumes/${SourceVolume}/${Removable}" ] ; then rm -rf "/Volumes/${SourceVolume}/${Removable}" ; fi
950 | done
951 | Device=`diskutil info "/Volumes/${SourceVolume}" | grep "Part of Whole:" | awk '{print $NF}'`
952 | DeviceNodes=`diskutil list "/dev/${Device}" | grep -c "Apple_HFS"`
953 | if [ ${DeviceNodes} -gt 1 ] ; then
954 | Device=`diskutil info "/Volumes/${SourceVolume}" | grep "Device Node:" | awk -F "/dev/" '{print $NF}'`
955 | diskutil unmount force "/dev/${Device}" &>/dev/null
956 | printf "Volume ${SourceVolume} on ${Device} unmounted\n"
957 | else
958 | diskutil unmountDisk force "/dev/${Device}" &>/dev/null
959 | printf "Unmount of all volumes on ${Device} was successful\n"
960 | fi
961 | hdiutil create -srcdevice "/dev/${Device}" -o "${LibraryFolder}/${ImageName}.dmg"
962 | diskutil mountDisk "/dev/${Device}"
963 | echo
964 | press_anyKey
965 | fi
966 | fi
967 | }
968 |
969 | function display_Images {
970 | printf "Images: ${Images[0]}\n"
971 | i=0 ; for Image in "${Images[@]}" ; do
972 | if [ ${i} -ne 0 ] ; then printf " ${Image}\n" ; fi
973 | let i++
974 | done
975 | printf "\n"
976 | }
977 |
978 | function menu_CreateImage {
979 | CreateOptions=( "Main Menu" "Select Source" "Create Image" )
980 | while [ "${Option}" != "Main Menu" ] ; do
981 | get_Images
982 | display_Subtitle "Create Image"
983 | display_Source
984 | display_Images
985 | display_Options "Options" "Select an option: "
986 | select Option in "${CreateOptions[@]}" ; do
987 | case "${Option}" in
988 | "Main Menu" ) break ;;
989 | "Select Source" ) select_Source ; unset Option ; break ;;
990 | "Create Image" ) create_Image ; unset Option ; break ;;
991 | esac
992 | done
993 | done
994 | unset SourceVersion
995 | unset SourceBuild
996 | unset SourceVolume
997 | unset ImageName
998 | unset Option
999 | }
1000 |
1001 | # Section: Target
1002 |
1003 | function get_Volumes {
1004 | unset Volumes[@]
1005 | IFS=$'\n'
1006 | Volumes=( `df | grep "/Volumes/" | awk -F "/Volumes/" '{print $NF}'` )
1007 | unset IFS
1008 | i=0 ; for Volume in "${Volumes[@]}" ; do
1009 | if [ ! -e "/Volumes/${Volume}/System/Library/CoreServices/SystemVersion.plist" ] || [ -e "/Volumes/${Volume}/var/db/.AppleSetupDone" ] || [ -e "/Volumes/${Volume}/System/Installation/Packages/OSInstall.mpkg" ] || [ -e "/Volumes/${Volume}/Packages/OSInstall.mpkg" ] ; then
1010 | unset Volumes[i]
1011 | fi
1012 | ReadOnly=`diskutil info "/Volumes/${Volume}" | grep "Read-Only Volume:" | awk '{print $NF}'`
1013 | if [ "${ReadOnly}" == "Yes" ] ; then
1014 | unset Volumes[i]
1015 | fi
1016 | let i++
1017 | done
1018 | }
1019 |
1020 | function get_Images {
1021 | unset Images[@]
1022 | IFS=$'\n'
1023 | Images=( `find "${LibraryFolder}" -name "*.dmg" -exec basename {} \;` )
1024 | unset IFS
1025 | }
1026 |
1027 | function get_Targets {
1028 | TargetNames=( "None" )
1029 | TargetTypes=( 0 )
1030 | get_Volumes
1031 | i=1 ; for Element in "${Volumes[@]}" ; do
1032 | TargetNames[i]="${Element}"
1033 | TargetTypes[i]=1
1034 | let i++
1035 | done
1036 | get_Images
1037 | for Element in "${Images[@]}" ; do
1038 | TargetNames[i]="${Element}"
1039 | TargetTypes[i]=2
1040 | let i++
1041 | done
1042 | }
1043 |
1044 | function set_TargetOSVersion {
1045 | TargetOSMajor=`defaults read "${Target}/System/Library/CoreServices/SystemVersion" "ProductVersion" | awk -F "." '{print $1}'`
1046 | TargetOSMinor=`defaults read "${Target}/System/Library/CoreServices/SystemVersion" "ProductVersion" | awk -F "." '{print $2}'`
1047 | TargetOSPoint=`defaults read "${Target}/System/Library/CoreServices/SystemVersion" "ProductVersion" | awk -F "." '{print $3}'`
1048 | if [ -z "${TargetOSPoint}" ] ; then TargetOSPoint=0 ; fi
1049 | TargetOSBuild=`defaults read "${Target}/System/Library/CoreServices/SystemVersion" "ProductBuildVersion"`
1050 | case ${TargetOSMinor} in
1051 | 6 | 7 ) PLACES="ZGEOPLACE" ;;
1052 | 8 ) PLACES="ZGEOKITPLACE" ;;
1053 | esac
1054 | }
1055 |
1056 | function set_TargetProperties {
1057 | # ${1}: Volume
1058 | set_Target "${1}"
1059 | set_TargetOSVersion
1060 | refresh_Language
1061 | refresh_Country
1062 | refresh_Keyboard
1063 | refresh_GeonameID
1064 | }
1065 |
1066 | function display_Target {
1067 | printf "Target: "
1068 | if [ -n "${TargetName}" ] ; then printf "${TargetName}" ; else printf "-" ; fi
1069 | printf "\n"
1070 | # Begin: Debug Output
1071 | # echo "MountPoint: ${Target}"
1072 | # echo "TargetType: ${TargetType}"
1073 | # End: Debug Output
1074 | printf "System: "
1075 | if [ -n "${TargetOSBuild}" ] ; then
1076 | printf "Mac OS X ${TargetOSMajor}.${TargetOSMinor}"
1077 | if [ ${TargetOSPoint} -ne 0 ] ; then printf ".${TargetOSPoint}" ; fi
1078 | printf " (${TargetOSBuild})"
1079 | else
1080 | printf "-"
1081 | fi
1082 | printf "\n\n"
1083 | }
1084 |
1085 | function select_Target {
1086 | if [ ${TargetType} -eq 2 ] ; then hdiutil eject "${Target}" &>/dev/null ; fi
1087 | get_Targets
1088 | display_Subtitle "Select Target"
1089 | display_Target
1090 | if [ ${#TargetNames[@]} -eq 0 ] ; then
1091 | press_anyKey "No targets available, please create an image, or attach an un-booted system volume."
1092 | else
1093 | display_Options "Available Targets" "Select a target: "
1094 | select TargetName in "${TargetNames[@]}" ; do
1095 | if [ -n "${TargetName}" ] ; then break ; fi
1096 | done
1097 | fi
1098 | i=0 ; for Element in "${TargetNames[@]}" ; do
1099 | if [ "${TargetName}" == "${Element}" ] ; then TargetType="${TargetTypes[i]}" ; break ; fi
1100 | let i++
1101 | done
1102 | if [ ${TargetType} -eq 0 ] ; then unset TargetName ; unset Volume ; fi
1103 | if [ ${TargetType} -eq 1 ] ; then Volume="${TargetName}" ; fi
1104 | if [ ${TargetType} -eq 2 ] ; then Volume=`hdiutil attach -owners on -noverify "${LibraryFolder}/${TargetName}" | grep "Apple_HFS" | awk -F "/Volumes/" '{print $NF}'` ; fi
1105 | set_TargetProperties "${Volume}"
1106 | }
1107 |
1108 | # Section: Language
1109 |
1110 | function set_Languages {
1111 | Languages=( "English" "Japanese" "French" "German" "Spanish" "Italian" "Portuguese" "Portuguese (Portugal)" "Dutch" "Swedish" "Norwegian" "Danish" "Finnish" "Russian" "Polish" )
1112 | case ${TargetOSMinor} in
1113 | 8 ) Languages=( "${Languages[@]}" "Turkish" "Chinese (Simplified)" "Chinese (Traditional)" "Korean" "Arabic" "Czech" "Hungarian" "Catalan" "Croatian" "Romanian" "Hebrew" "Ukrainian" "Thai" "Slovak" "Greek" ) ;;
1114 | 7 ) Languages=( "${Languages[@]}" "Turkish" "Chinese (Simplified)" "Chinese (Traditional)" "Korean" "Arabic" "Czech" "Hungarian" )
1115 | if [ ${TargetOSPoint} -ge 3 ] ; then
1116 | Languages=( "${Languages[@]}" "Catalan" "Croatian" "Romanian" "Hebrew" "Ukrainian" "Thai" "Slovak" "Greek" )
1117 | fi ;;
1118 | * ) Languages=( "${Languages[@]}" "Chinese (Simplified)" "Chinese (Traditional)" "Korean" ) ;;
1119 | esac
1120 | }
1121 |
1122 | function set_LanguageCode {
1123 | # ${1}: Language Name
1124 | case "${1}" in
1125 | "Japanese" ) LanguageCode="ja" ;;
1126 | "French" ) LanguageCode="fr" ;;
1127 | "German" ) LanguageCode="de" ;;
1128 | "Spanish" ) LanguageCode="es" ;;
1129 | "Italian" ) LanguageCode="it" ;;
1130 | "Portuguese" ) LanguageCode="pt" ;;
1131 | "Portuguese (Portugal)" ) LanguageCode="pt-PT" ;;
1132 | "Dutch" ) LanguageCode="nl" ;;
1133 | "Swedish" ) LanguageCode="sv" ;;
1134 | "Norwegian" ) LanguageCode="nb" ;;
1135 | "Danish" ) LanguageCode="da" ;;
1136 | "Finnish" ) LanguageCode="fi" ;;
1137 | "Russian" ) LanguageCode="ru" ;;
1138 | "Polish" ) LanguageCode="pl" ;;
1139 | "Turkish" ) LanguageCode="tr" ;;
1140 | "Chinese (Simplified)" ) LanguageCode="zh-Hans" ;;
1141 | "Chinese (Traditional)" ) LanguageCode="zh-Hant" ;;
1142 | "Korean" ) LanguageCode="ko" ;;
1143 | "Arabic" ) LanguageCode="ar" ;;
1144 | "Czech" ) LanguageCode="cs" ;;
1145 | "Hungarian" ) LanguageCode="hu" ;;
1146 | "Catalan" ) LanguageCode="ca" ;;
1147 | "Croatian" ) LanguageCode="hr" ;;
1148 | "Romanian" ) LanguageCode="ro" ;;
1149 | "Hebrew" ) LanguageCode="he" ;;
1150 | "Ukrainian" ) LanguageCode="uk" ;;
1151 | "Thai" ) LanguageCode="th" ;;
1152 | "Slovak" ) LanguageCode="sk" ;;
1153 | "Greek" ) LanguageCode="el" ;;
1154 | * ) LanguageCode="en" ;;
1155 | esac
1156 | }
1157 |
1158 | function refresh_Language {
1159 | set_Languages
1160 | i=0 ; for LANGUAGE in "${Languages[@]}" ; do if [ "${LANGUAGE}" == "${Language}" ] ; then i=1 ; break ; fi ; done
1161 | if [ ${i} -eq 0 ] ; then Language="English" ; fi
1162 | set_LanguageCode "${Language}"
1163 | set_AppleLanguages "${LanguageCode}"
1164 | }
1165 |
1166 | function set_Localization {
1167 | # ${1}: Language Name
1168 | case "${1}" in
1169 | "Japanese" ) Localization="Japanese" ;;
1170 | "French" ) Localization="French" ;;
1171 | "German" ) Localization="German" ;;
1172 | "Spanish" ) Localization="Spanish" ;;
1173 | "Italian" ) Localization="Italian" ;;
1174 | "Portuguese" ) Localization="pt" ;;
1175 | "Portuguese (Portugal)" ) Localization="pt_PT" ;;
1176 | "Dutch" ) Localization="Dutch" ;;
1177 | "Swedish" ) Localization="sv" ;;
1178 | "Norwegian" ) Localization="no" ;;
1179 | "Danish" ) Localization="da" ;;
1180 | "Finnish" ) Localization="fi" ;;
1181 | "Russian" ) Localization="ru" ;;
1182 | "Polish" ) Localization="pl" ;;
1183 | "Turkish" ) Localization="tr" ;;
1184 | "Chinese (Simplified)" ) Localization="zh_CN" ;;
1185 | "Chinese (Traditional)" ) Localization="zh_TW" ;;
1186 | "Korean" ) Localization="ko" ;;
1187 | "Arabic" ) Localization="ar" ;;
1188 | "Czech" ) Localization="cs" ;;
1189 | "Hungarian" ) Localization="hu" ;;
1190 | "Catalan" ) Localization="ca" ;;
1191 | "Croatian" ) Localization="hr" ;;
1192 | "Romanian" ) Localization="ro" ;;
1193 | "Hebrew" ) Localization="he" ;;
1194 | "Ukrainian" ) Localization="uk" ;;
1195 | "Thai" ) Localization="th" ;;
1196 | "Slovak" ) Localization="sk" ;;
1197 | "Greek" ) Localization="el" ;;
1198 | * ) Localization="English" ;;
1199 | esac
1200 | }
1201 |
1202 | function set_AppleLanguages {
1203 | # ${1}: Language Code
1204 | if [ ${TargetOSMinor} -ge 8 ] ; then
1205 | AppleLanguages=( "ar" "ca" "cs" "da" "nl" "el" "en" "fi" "fr" "de" "he" "hr" "hu" "it" "ja" "ko" "nb" "pl" "pt" "pt-PT" "ro" "ru" "sk" "es" "sv" "th" "tr" "uk" "zh-Hans" "zh-Hant" )
1206 | else
1207 | AppleLanguages=( "en" "ja" "fr" "de" "es" "it" "nl" "sv" "nb" "da" "fi" "pl" "pt" "pt-PT" "ru" "zh-Hans" "zh-Hant" "ko" )
1208 | fi
1209 | i=0
1210 | for Element in "${AppleLanguages[@]}" ; do
1211 | if [ "${1}" == "${Element}" ] ; then unset AppleLanguages[i] ; break ; fi
1212 | let i++
1213 | done
1214 | AppleLanguages=( "${1}" "${AppleLanguages[@]}" )
1215 | }
1216 |
1217 | function set_ScriptManager {
1218 | # ${1}: Language Code
1219 | case "${1}" in
1220 | "ja" ) ScriptManager="smJapanese" ;;
1221 | "ru" ) ScriptManager="smCyrillic" ;;
1222 | "pl" ) ScriptManager="smCentralEuroRoman" ;;
1223 | "zh-Hans" ) ScriptManager="smSimpChinese" ;;
1224 | "zh-Hant" ) ScriptManager="smTradChinese" ;;
1225 | "ko" ) ScriptManager="smKorean" ;;
1226 | * ) ScriptManager="smRoman" ;;
1227 | esac
1228 | }
1229 |
1230 | function set_ITLB {
1231 | # ${1}: Language Code
1232 | case "${1}" in
1233 | "ja" ) ITLB=16895 ;;
1234 | "ru" ) ITLB=19967 ;;
1235 | "pl" ) ITLB=31231 ;;
1236 | "zh-Hans" ) ITLB=29183 ;;
1237 | "zh-Hant" ) ITLB=17407 ;;
1238 | "ko" ) ITLB=17919 ;;
1239 | * ) ITLB=16383 ;;
1240 | esac
1241 | }
1242 |
1243 | # Section: Country
1244 |
1245 | function set_AllCountryCodes {
1246 | case ${TargetOSMinor} in
1247 | 5 ) AllCountryCodes=( "AD" "AE" "AF" "AG" "AI" "AL" "AM" "AN" "AO" "AQ" "AR" "AS" "AT" "AU" "AW" "AZ" "BA" "BB" "BD" "BE" "BF" "BG" "BH" "BI" "BJ" "BM" "BN" "BO" "BR" "BS" "BT" "BV" "BW" "BY" "BZ" "CA" "CC" "CD" "CF" "CG" "CH" "CI" "CK" "CL" "CM" "CN" "CO" "CR" "CV" "CX" "CY" "CZ" "DE" "DJ" "DK" "DM" "DO" "DZ" "EC" "EE" "EG" "EH" "ER" "ES" "ET" "FI" "FJ" "FK" "FM" "FO" "FR" "GA" "GB" "GD" "GE" "GF" "GH" "GI" "GL" "GM" "GN" "GP" "GQ" "GR" "GS" "GT" "GU" "GW" "GY" "HK" "HM" "HN" "HR" "HT" "HU" "ID" "IE" "IL" "IN" "IO" "IQ" "IS" "IT" "JM" "JO" "JP" "KE" "KG" "KH" "KI" "KM" "KN" "KR" "KW" "KY" "KZ" "LA" "LB" "LC" "LI" "LK" "LR" "LS" "LT" "LU" "LV" "MA" "MC" "MD" "MG" "MH" "MK" "ML" "MM" "MN" "MO" "MP" "MQ" "MR" "MS" "MT" "MU" "MV" "MW" "MX" "MY" "MZ" "NA" "NC" "NE" "NF" "NG" "NI" "NL" "NO" "NP" "NR" "NU" "NZ" "OM" "PA" "PE" "PF" "PG" "PH" "PK" "PL" "PM" "PN" "PR" "PS" "PT" "PW" "PY" "QA" "RE" "RO" "RU" "RW" "SA" "SB" "SC" "SE" "SG" "SH" "SI" "SJ" "SK" "SL" "SM" "SN" "SO" "SR" "ST" "SV" "SZ" "TC" "TD" "TF" "TG" "TH" "TJ" "TK" "TM" "TN" "TO" "TP" "TR" "TT" "TV" "TW" "TZ" "UA" "UG" "UM" "US" "UY" "UZ" "VA" "VC" "VE" "VG" "VI" "VN" "VU" "WF" "WS" "YE" "YT" "YU" "ZA" "ZM" "ZW" ) ;;
1248 | 6 ) AllCountryCodes=( "AD" "AE" "AF" "AG" "AI" "AL" "AM" "AN" "AO" "AQ" "AR" "AS" "AT" "AU" "AW" "AZ" "BA" "BB" "BD" "BE" "BF" "BG" "BH" "BI" "BJ" "BM" "BN" "BO" "BR" "BS" "BT" "BV" "BW" "BY" "BZ" "CA" "CC" "CD" "CF" "CG" "CH" "CI" "CK" "CL" "CM" "CN" "CO" "CR" "CV" "CX" "CY" "CZ" "DE" "DJ" "DK" "DM" "DO" "DZ" "EC" "EE" "EG" "EH" "ER" "ES" "ET" "FI" "FJ" "FK" "FM" "FO" "FR" "GA" "GB" "GD" "GE" "GF" "GH" "GI" "GL" "GM" "GN" "GP" "GQ" "GR" "GS" "GT" "GU" "GW" "GY" "HK" "HM" "HN" "HR" "HT" "HU" "ID" "IE" "IL" "IN" "IO" "IQ" "IS" "IT" "JM" "JO" "JP" "KE" "KG" "KH" "KI" "KM" "KN" "KR" "KW" "KY" "KZ" "LA" "LB" "LC" "LI" "LK" "LR" "LS" "LT" "LU" "LV" "MA" "MC" "MD" "ME" "MG" "MH" "MK" "ML" "MM" "MN" "MO" "MP" "MQ" "MR" "MS" "MT" "MU" "MV" "MW" "MX" "MY" "MZ" "NA" "NC" "NE" "NF" "NG" "NI" "NL" "NO" "NP" "NR" "NU" "NZ" "OM" "PA" "PE" "PF" "PG" "PH" "PK" "PL" "PM" "PN" "PR" "PS" "PT" "PW" "PY" "QA" "RE" "RO" "RU" "RS" "RW" "SA" "SB" "SC" "SE" "SG" "SH" "SI" "SJ" "SK" "SL" "SM" "SN" "SO" "SR" "ST" "SV" "SZ" "TC" "TD" "TF" "TG" "TH" "TJ" "TK" "TM" "TN" "TO" "TR" "TT" "TV" "TW" "TZ" "UA" "UG" "UM" "US" "UY" "UZ" "VA" "VC" "VE" "VG" "VI" "VN" "VU" "WF" "WS" "YE" "YT" "ZA" "ZM" "ZW" ) ;;
1249 | * ) AllCountryCodes=( "AD" "AE" "AF" "AG" "AI" "AL" "AM" "AN" "AO" "AQ" "AR" "AS" "AT" "AU" "AW" "AZ" "BA" "BB" "BD" "BE" "BF" "BG" "BH" "BI" "BJ" "BM" "BN" "BO" "BR" "BS" "BT" "BV" "BW" "BY" "BZ" "CA" "CC" "CD" "CF" "CG" "CH" "CI" "CK" "CL" "CM" "CN" "CO" "CR" "CV" "CX" "CY" "CZ" "DE" "DJ" "DK" "DM" "DO" "DZ" "EC" "EE" "EG" "EH" "ER" "ES" "ET" "FI" "FJ" "FK" "FM" "FO" "FR" "GA" "GB" "GD" "GE" "GF" "GH" "GI" "GL" "GM" "GN" "GP" "GQ" "GR" "GS" "GT" "GU" "GW" "GY" "HK" "HM" "HN" "HR" "HT" "HU" "ID" "IE" "IL" "IN" "IO" "IQ" "IS" "IT" "JM" "JO" "JP" "KE" "KG" "KH" "KI" "KM" "KN" "KR" "KW" "KY" "KZ" "LA" "LB" "LC" "LI" "LK" "LR" "LS" "LT" "LU" "LV" "MA" "MC" "MD" "ME" "MG" "MH" "MK" "ML" "MM" "MN" "MO" "MP" "MQ" "MR" "MS" "MT" "MU" "MV" "MW" "MX" "MY" "MZ" "NA" "NC" "NE" "NF" "NG" "NI" "NL" "NO" "NP" "NR" "NU" "NZ" "OM" "PA" "PE" "PF" "PG" "PH" "PK" "PL" "PM" "PN" "PR" "PS" "PT" "PW" "PY" "QA" "RE" "RO" "RS" "RU" "RW" "SA" "SB" "SC" "SE" "SG" "SH" "SI" "SJ" "SK" "SL" "SM" "SN" "SO" "SR" "ST" "SV" "SZ" "TC" "TD" "TF" "TG" "TH" "TJ" "TK" "TM" "TN" "TO" "TR" "TT" "TV" "TW" "TZ" "UA" "UG" "UM" "US" "UY" "UZ" "VA" "VC" "VE" "VG" "VI" "VN" "VU" "WF" "WS" "YE" "YT" "ZA" "ZM" "ZW" ) ;;
1250 | esac
1251 | }
1252 |
1253 | function convert_SACountryCodeToName {
1254 | # ${1}: OS Minor Version
1255 | # ${2}: Country Code
1256 | case "${2}" in
1257 | "AD" ) echo "Andorra" ;;
1258 | "AE" ) echo "United Arab Emirates" ;;
1259 | "AF" ) echo "Afghanistan" ;;
1260 | "AG" ) echo "Antigua and Barbuda" ;;
1261 | "AI" ) echo "Anguilla" ;;
1262 | "AL" ) echo "Albania" ;;
1263 | "AM" ) echo "Armenia" ;;
1264 | "AN" ) echo "Netherlands Antilles" ;;
1265 | "AO" ) echo "Angola" ;;
1266 | "AQ" ) echo "Antarctica" ;;
1267 | "AR" ) echo "Argentina" ;;
1268 | "AS" ) echo "American Samoa" ;;
1269 | "AT" ) echo "Austria" ;;
1270 | "AU" ) echo "Australia" ;;
1271 | "AW" ) echo "Aruba" ;;
1272 | "AZ" ) echo "Azerbaijan" ;;
1273 | "BA" ) echo "Bosnia and Herzegovina" ;;
1274 | "BB" ) echo "Barbados" ;;
1275 | "BD" ) echo "Bangladesh" ;;
1276 | "BE" ) echo "Belgium" ;;
1277 | "BF" ) echo "Burkina Faso" ;;
1278 | "BG" ) echo "Bulgaria" ;;
1279 | "BH" ) echo "Bahrain" ;;
1280 | "BI" ) echo "Burundi" ;;
1281 | "BJ" ) echo "Benin" ;;
1282 | "BM" ) echo "Bermuda" ;;
1283 | "BN" )
1284 | case ${1} in
1285 | 5 ) echo "Brunei Darussalam" ;;
1286 | * ) echo "Brunei" ;;
1287 | esac ;;
1288 | "BO" ) echo "Bolivia" ;;
1289 | "BR" ) echo "Brazil" ;;
1290 | "BS" ) echo "Bahamas" ;;
1291 | "BT" ) echo "Bhutan" ;;
1292 | "BV" ) echo "Bouvet Island" ;;
1293 | "BW" ) echo "Botswana" ;;
1294 | "BY" ) echo "Belarus" ;;
1295 | "BZ" ) echo "Belize" ;;
1296 | "CA" ) echo "Canada" ;;
1297 | "CC" )
1298 | case ${1} in
1299 | 5 ) echo "Cocos (Keeling) Islands" ;;
1300 | 6 ) echo "Cocos Islands" ;;
1301 | * ) echo "Cocos [Keeling] Islands" ;;
1302 | esac ;;
1303 | "CD" )
1304 | case ${1} in
1305 | 5 ) echo "Congo, The Democratic Republic Of The" ;;
1306 | * ) echo "Congo - Kinshasa" ;;
1307 | esac ;;
1308 | "CF" ) echo "Central African Republic" ;;
1309 | "CG" )
1310 | case ${1} in
1311 | 5 ) echo "Congo" ;;
1312 | * ) echo "Congo - Brazzaville" ;;
1313 | esac ;;
1314 | "CH" ) echo "Switzerland" ;;
1315 | "CI" )
1316 | case ${1} in
1317 | 5 ) echo "Cote D'Ivoire" ;;
1318 | 6 ) echo "Ivory Coast" ;;
1319 | * ) echo "Côte d’Ivoire" ;;
1320 | esac ;;
1321 | "CK" ) echo "Cook Islands" ;;
1322 | "CL" ) echo "Chile" ;;
1323 | "CM" ) echo "Cameroon" ;;
1324 | "CN" ) echo "China" ;;
1325 | "CO" ) echo "Colombia" ;;
1326 | "CR" ) echo "Costa Rica" ;;
1327 | "CV" ) echo "Cape Verde" ;;
1328 | "CX" ) echo "Christmas Island" ;;
1329 | "CY" ) echo "Cyprus" ;;
1330 | "CZ" ) echo "Czech Republic" ;;
1331 | "DE" ) echo "Germany" ;;
1332 | "DJ" ) echo "Djibouti" ;;
1333 | "DK" ) echo "Denmark" ;;
1334 | "DM" ) echo "Dominica" ;;
1335 | "DO" ) echo "Dominican Republic" ;;
1336 | "DZ" ) echo "Algeria" ;;
1337 | "EC" ) echo "Ecuador" ;;
1338 | "EE" ) echo "Estonia" ;;
1339 | "EG" ) echo "Egypt" ;;
1340 | "EH" ) echo "Western Sahara" ;;
1341 | "ER" ) echo "Eritrea" ;;
1342 | "ES" ) echo "Spain" ;;
1343 | "ET" ) echo "Ethiopia" ;;
1344 | "FI" ) echo "Finland" ;;
1345 | "FJ" ) echo "Fiji" ;;
1346 | "FK" )
1347 | case ${1} in
1348 | 5 ) echo "Falkland Islands (Malvinas)" ;;
1349 | * ) echo "Falkland Islands" ;;
1350 | esac ;;
1351 | "FM" )
1352 | case ${1} in
1353 | 5 ) echo "Micronesia, Federated States Of" ;;
1354 | * ) echo "Micronesia" ;;
1355 | esac ;;
1356 | "FO" ) echo "Faroe Islands" ;;
1357 | "FR" ) echo "France" ;;
1358 | "GA" ) echo "Gabon" ;;
1359 | "GB" ) echo "United Kingdom" ;;
1360 | "GD" ) echo "Grenada" ;;
1361 | "GE" ) echo "Georgia" ;;
1362 | "GF" ) echo "French Guiana" ;;
1363 | "GH" ) echo "Ghana" ;;
1364 | "GI" ) echo "Gibraltar" ;;
1365 | "GL" ) echo "Greenland" ;;
1366 | "GM" ) echo "Gambia" ;;
1367 | "GN" ) echo "Guinea" ;;
1368 | "GP" ) echo "Guadeloupe" ;;
1369 | "GQ" ) echo "Equatorial Guinea" ;;
1370 | "GR" ) echo "Greece" ;;
1371 | "GS" )
1372 | case ${1} in
1373 | 5 ) echo "South Georgia and The South Sandwich Islands" ;;
1374 | * ) echo "South Georgia and the South Sandwich Islands" ;;
1375 | esac ;;
1376 | "GT" ) echo "Guatemala" ;;
1377 | "GU" ) echo "Guam" ;;
1378 | "GW" ) echo "Guinea-Bissau" ;;
1379 | "GY" ) echo "Guyana" ;;
1380 | "HK" )
1381 | case ${1} in
1382 | 5 ) echo "Hong Kong" ;;
1383 | * ) echo "Hong Kong SAR China" ;;
1384 | esac ;;
1385 | "HM" )
1386 | case ${1} in
1387 | 5 ) echo "Heard and Mc Donald Islands" ;;
1388 | * ) echo "Heard Island and McDonald Islands" ;;
1389 | esac ;;
1390 | "HN" ) echo "Honduras" ;;
1391 | "HR" ) echo "Croatia" ;;
1392 | "HT" ) echo "Haiti" ;;
1393 | "HU" ) echo "Hungary" ;;
1394 | "ID" ) echo "Indonesia" ;;
1395 | "IE" ) echo "Ireland" ;;
1396 | "IL" ) echo "Israel" ;;
1397 | "IN" ) echo "India" ;;
1398 | "IO" ) echo "British Indian Ocean Territory" ;;
1399 | "IQ" ) echo "Iraq" ;;
1400 | "IS" ) echo "Iceland" ;;
1401 | "IT" ) echo "Italy" ;;
1402 | "JM" ) echo "Jamaica" ;;
1403 | "JO" ) echo "Jordan" ;;
1404 | "JP" ) echo "Japan" ;;
1405 | "KE" ) echo "Kenya" ;;
1406 | "KG" ) echo "Kyrgyzstan" ;;
1407 | "KH" ) echo "Cambodia" ;;
1408 | "KI" ) echo "Kiribati" ;;
1409 | "KM" ) echo "Comoros" ;;
1410 | "KN" ) echo "Saint Kitts and Nevis" ;;
1411 | "KR" )
1412 | case ${1} in
1413 | 5 ) echo "Korea, Republic Of" ;;
1414 | * ) echo "South Korea" ;;
1415 | esac ;;
1416 | "KW" ) echo "Kuwait" ;;
1417 | "KY" ) echo "Cayman Islands" ;;
1418 | "KZ" ) echo "Kazakhstan" ;;
1419 | "LA" )
1420 | case ${1} in
1421 | 5 ) echo "Lao People's Democratic Republic" ;;
1422 | * ) echo "Laos" ;;
1423 | esac ;;
1424 | "LB" ) echo "Lebanon" ;;
1425 | "LC" ) echo "Saint Lucia" ;;
1426 | "LI" ) echo "Liechtenstein" ;;
1427 | "LK" ) echo "Sri Lanka" ;;
1428 | "LR" ) echo "Liberia" ;;
1429 | "LS" ) echo "Lesotho" ;;
1430 | "LT" ) echo "Lithuania" ;;
1431 | "LU" ) echo "Luxembourg" ;;
1432 | "LV" ) echo "Latvia" ;;
1433 | "MA" ) echo "Morocco" ;;
1434 | "MC" ) echo "Monaco" ;;
1435 | "MD" ) echo "Moldova" ;;
1436 | "ME" )
1437 | case ${1} in
1438 | 6 | 7 | 8 ) echo "Montenegro" ;;
1439 | esac ;;
1440 | "MG" ) echo "Madagascar" ;;
1441 | "MH" ) echo "Marshall Islands" ;;
1442 | "MK" )
1443 | case ${1} in
1444 | 5 ) echo "Macedonia, The Former Yugoslav Republic Of" ;;
1445 | * ) echo "Macedonia" ;;
1446 | esac ;;
1447 | "ML" ) echo "Mali" ;;
1448 | "MM" )
1449 | case ${1} in
1450 | 5 | 6 ) echo "Myanmar" ;;
1451 | * ) echo "Myanmar [Burma]" ;;
1452 | esac ;;
1453 | "MN" ) echo "Mongolia" ;;
1454 | "MO" )
1455 | case ${1} in
1456 | 5 ) echo "Macau" ;;
1457 | * ) echo "Macau SAR China" ;;
1458 | esac ;;
1459 | "MP" ) echo "Northern Mariana Islands" ;;
1460 | "MQ" ) echo "Martinique" ;;
1461 | "MR" ) echo "Mauritania" ;;
1462 | "MS" ) echo "Montserrat" ;;
1463 | "MT" ) echo "Malta" ;;
1464 | "MU" ) echo "Mauritius" ;;
1465 | "MV" ) echo "Maldives" ;;
1466 | "MW" ) echo "Malawi" ;;
1467 | "MX" ) echo "Mexico" ;;
1468 | "MY" ) echo "Malaysia" ;;
1469 | "MZ" ) echo "Mozambique" ;;
1470 | "NA" ) echo "Namibia" ;;
1471 | "NC" ) echo "New Caledonia" ;;
1472 | "NE" ) echo "Niger" ;;
1473 | "NF" ) echo "Norfolk Island" ;;
1474 | "NG" ) echo "Nigeria" ;;
1475 | "NI" ) echo "Nicaragua" ;;
1476 | "NL" ) echo "Netherlands" ;;
1477 | "NO" ) echo "Norway" ;;
1478 | "NP" ) echo "Nepal" ;;
1479 | "NR" ) echo "Nauru" ;;
1480 | "NU" ) echo "Niue" ;;
1481 | "NZ" ) echo "New Zealand" ;;
1482 | "OM" ) echo "Oman" ;;
1483 | "PA" ) echo "Panama" ;;
1484 | "PE" ) echo "Peru" ;;
1485 | "PF" ) echo "French Polynesia" ;;
1486 | "PG" ) echo "Papua New Guinea" ;;
1487 | "PH" ) echo "Philippines" ;;
1488 | "PK" ) echo "Pakistan" ;;
1489 | "PL" ) echo "Poland" ;;
1490 | "PM" )
1491 | case ${1} in
1492 | 5 ) echo "St. Pierre and Miquelon" ;;
1493 | * ) echo "Saint Pierre and Miquelon" ;;
1494 | esac ;;
1495 | "PN" )
1496 | case ${1} in
1497 | 5 | 6 ) echo "Pitcairn" ;;
1498 | * ) echo "Pitcairn Islands" ;;
1499 | esac ;;
1500 | "PR" ) echo "Puerto Rico" ;;
1501 | "PS" )
1502 | case ${1} in
1503 | 5 ) echo "Palestinian Authority" ;;
1504 | 6 ) echo "Palestinian Territory" ;;
1505 | * ) echo "Palestinian Territories" ;;
1506 | esac ;;
1507 | "PT" ) echo "Portugal" ;;
1508 | "PW" ) echo "Palau" ;;
1509 | "PY" ) echo "Paraguay" ;;
1510 | "QA" ) echo "Qatar" ;;
1511 | "RE" )
1512 | case ${1} in
1513 | 5 | 6 ) echo "Reunion" ;;
1514 | * ) echo "Réunion" ;;
1515 | esac ;;
1516 | "RO" ) echo "Romania" ;;
1517 | "RS" )
1518 | case ${1} in
1519 | 6 | 7 | 8 ) echo "Serbia" ;;
1520 | esac ;;
1521 | "RU" )
1522 | case ${1} in
1523 | 5 ) echo "Russian Federation" ;;
1524 | * ) echo "Russia" ;;
1525 | esac ;;
1526 | "RW" ) echo "Rwanda" ;;
1527 | "SA" ) echo "Saudi Arabia" ;;
1528 | "SB" ) echo "Solomon Islands" ;;
1529 | "SC" ) echo "Seychelles" ;;
1530 | "SE" ) echo "Sweden" ;;
1531 | "SG" ) echo "Singapore" ;;
1532 | "SH" )
1533 | case ${1} in
1534 | 5 ) echo "St. Helena" ;;
1535 | * ) echo "Saint Helena" ;;
1536 | esac ;;
1537 | "SI" ) echo "Slovenia" ;;
1538 | "SJ" )
1539 | case ${1} in
1540 | 5 ) echo "Svalbard and Jan Mayen Islands" ;;
1541 | * ) echo "Svalbard and Jan Mayen" ;;
1542 | esac ;;
1543 | "SK" )
1544 | case ${1} in
1545 | 5 ) echo "Slovak Republic" ;;
1546 | * ) echo "Slovakia" ;;
1547 | esac ;;
1548 | "SL" ) echo "Sierra Leone" ;;
1549 | "SM" ) echo "San Marino" ;;
1550 | "SN" ) echo "Senegal" ;;
1551 | "SO" ) echo "Somalia" ;;
1552 | "SR" ) echo "Suriname" ;;
1553 | "ST" )
1554 | case ${1} in
1555 | 5 | 6 ) echo "Sao Tome and Principe" ;;
1556 | * ) echo "São Tomé and Príncipe" ;;
1557 | esac ;;
1558 | "SV" ) echo "El Salvador" ;;
1559 | "SZ" ) echo "Swaziland" ;;
1560 | "TC" ) echo "Turks and Caicos Islands" ;;
1561 | "TD" ) echo "Chad" ;;
1562 | "TF" ) echo "French Southern Territories" ;;
1563 | "TG" ) echo "Togo" ;;
1564 | "TH" ) echo "Thailand" ;;
1565 | "TJ" ) echo "Tajikistan" ;;
1566 | "TK" ) echo "Tokelau" ;;
1567 | "TM" ) echo "Turkmenistan" ;;
1568 | "TN" ) echo "Tunisia" ;;
1569 | "TO" ) echo "Tonga" ;;
1570 | "TP" )
1571 | case ${1} in
1572 | 5 ) echo "East Timor" ;;
1573 | esac ;;
1574 | "TR" ) echo "Turkey" ;;
1575 | "TT" ) echo "Trinidad and Tobago" ;;
1576 | "TV" ) echo "Tuvalu" ;;
1577 | "TW" ) echo "Taiwan" ;;
1578 | "TZ" )
1579 | case ${1} in
1580 | 5 ) echo "Tanzania, United Republic Of" ;;
1581 | * ) echo "Tanzania" ;;
1582 | esac ;;
1583 | "UA" ) echo "Ukraine" ;;
1584 | "UG" ) echo "Uganda" ;;
1585 | "UM" )
1586 | case ${1} in
1587 | 5 | 6 ) echo "United States Minor Outlying Islands" ;;
1588 | * ) echo "U.S. Minor Outlying Islands" ;;
1589 | esac ;;
1590 | "UY" ) echo "Uruguay" ;;
1591 | "UZ" ) echo "Uzbekistan" ;;
1592 | "VA" )
1593 | case ${1} in
1594 | 5 ) echo "Holy See (Vatican City State)" ;;
1595 | 6 ) echo "Vatican" ;;
1596 | * ) echo "Vatican City" ;;
1597 | esac ;;
1598 | "VC" )
1599 | case ${1} in
1600 | 5 ) echo "Saint Vincent and The Grenadines" ;;
1601 | * ) echo "Saint Vincent and the Grenadines" ;;
1602 | esac ;;
1603 | "VE" ) echo "Venezuela" ;;
1604 | "VG" )
1605 | case ${1} in
1606 | 5 ) echo "Virgin Islands (British)" ;;
1607 | * ) echo "British Virgin Islands" ;;
1608 | esac ;;
1609 | "VI" )
1610 | case ${1} in
1611 | 5 ) echo "Virgin Islands (U.S.)" ;;
1612 | * ) echo "U.S. Virgin Islands" ;;
1613 | esac ;;
1614 | "VN" )
1615 | case ${1} in
1616 | 5 ) echo "Viet Nam" ;;
1617 | * ) echo "Vietnam" ;;
1618 | esac ;;
1619 | "VU" ) echo "Vanuatu" ;;
1620 | "WF" )
1621 | case ${1} in
1622 | 5 ) echo "Wallis and Futuna Islands" ;;
1623 | * ) echo "Wallis and Futuna" ;;
1624 | esac ;;
1625 | "WS" ) echo "Samoa" ;;
1626 | "YE" ) echo "Yemen" ;;
1627 | "YT" ) echo "Mayotte" ;;
1628 | "YU" )
1629 | case ${1} in
1630 | 5 ) echo "Serbia and Montenegro" ;;
1631 | esac ;;
1632 | "ZA" ) echo "South Africa" ;;
1633 | "ZM" ) echo "Zambia" ;;
1634 | "ZW" ) echo "Zimbabwe" ;;
1635 | * ) echo "United States" ;;
1636 | esac
1637 | }
1638 |
1639 | function refresh_Country {
1640 | set_AllCountryCodes
1641 | i=0 ; for Code in "${AllCountryCodes[@]}" ; do if [ "${Code}" == "${SACountryCode}" ] ; then i=1 ; break ; fi ; done
1642 | if [ ${i} -eq 0 ] ; then SACountryCode="US" ; fi
1643 | SACountry=`convert_SACountryCodeToName ${TargetOSMinor} "${SACountryCode}"`
1644 | }
1645 |
1646 | function set_LanguageCountryCodes {
1647 | # ${1}: Language Code
1648 | set_AllCountryCodes
1649 | LanguageCountryCodes=( `/usr/libexec/PlistBuddy -c "Print ':${1}'" "${Target}/System/Library/PrivateFrameworks/International.framework/Resources/SALanguageToCountry.plist" 2>/dev/null | grep -v "{\|}"` )
1650 | i=0 ; for LanguageCountryCode in "${LanguageCountryCodes[@]}" ; do
1651 | j=0 ; for Code in "${AllCountryCodes[@]}" ; do if [ "${Code}" == "${LanguageCountryCode}" ] ; then j=1 ; break ; fi ; done
1652 | if [ ${j} -eq 0 ] ; then unset LanguageCountryCodes[i] ; fi
1653 | let i++
1654 | done
1655 | if [ ${#LanguageCountryCodes[@]} -eq 0 ] ; then LanguageCountryCodes=( "US" ) ; fi
1656 | }
1657 |
1658 | function set_LanguageCountryNames {
1659 | unset LanguageCountryNames[@]
1660 | IFS=$'\n'
1661 | for Code in "${LanguageCountryCodes[@]}" ; do
1662 | LanguageCountryNames=( "${LanguageCountryNames[@]}" $(convert_SACountryCodeToName ${TargetOSMinor} "${Code}") )
1663 | done
1664 | unset IFS
1665 | }
1666 |
1667 | function set_OtherCountryCodes {
1668 | unset OtherCountryCodes[@]
1669 | for Code in "${AllCountryCodes[@]}" ; do
1670 | j=0 ; for LanguageCountryCode in "${LanguageCountryCodes[@]}" ; do
1671 | if [ "${Code}" == "${LanguageCountryCode}" ] ; then j=1 ; break ; fi
1672 | done
1673 | if [ ${j} -eq 0 ] ; then OtherCountryCodes=( "${OtherCountryCodes[@]}" "${Code}" ) ; fi
1674 | done
1675 | }
1676 |
1677 | function set_OtherCountryNames {
1678 | unset OtherCountryNames[@]
1679 | IFS=$'\n'
1680 | for Code in "${OtherCountryCodes[@]}" ; do
1681 | OtherCountryNames=( "${OtherCountryNames[@]}" $(convert_SACountryCodeToName ${TargetOSMinor} "${Code}") )
1682 | done
1683 | OtherCountryNames=( `for COUNTRY in "${OtherCountryNames[@]}" ; do echo "${COUNTRY}" ; done | sort -u` )
1684 | unset IFS
1685 | }
1686 |
1687 | function set_SACountryCode {
1688 | # ${1}: Country Name
1689 | case "${1}" in
1690 | "Andorra" ) SACountryCode="AD" ;;
1691 | "United Arab Emirates" ) SACountryCode="AE" ;;
1692 | "Afghanistan" ) SACountryCode="AF" ;;
1693 | "Antigua and Barbuda" ) SACountryCode="AG" ;;
1694 | "Anguilla" ) SACountryCode="AI" ;;
1695 | "Albania" ) SACountryCode="AL" ;;
1696 | "Armenia" ) SACountryCode="AM" ;;
1697 | "Netherlands Antilles" ) SACountryCode="AN" ;;
1698 | "Angola" ) SACountryCode="AO" ;;
1699 | "Antarctica" ) SACountryCode="AQ" ;;
1700 | "Argentina" ) SACountryCode="AR" ;;
1701 | "American Samoa" ) SACountryCode="AS" ;;
1702 | "Austria" ) SACountryCode="AT" ;;
1703 | "Australia" ) SACountryCode="AU" ;;
1704 | "Aruba" ) SACountryCode="AW" ;;
1705 | "Azerbaijan" ) SACountryCode="AZ" ;;
1706 | "Bosnia and Herzegovina" ) SACountryCode="BA" ;;
1707 | "Barbados" ) SACountryCode="BB" ;;
1708 | "Bangladesh" ) SACountryCode="BD" ;;
1709 | "Belgium" ) SACountryCode="BE" ;;
1710 | "Burkina Faso" ) SACountryCode="BF" ;;
1711 | "Bulgaria" ) SACountryCode="BG" ;;
1712 | "Bahrain" ) SACountryCode="BH" ;;
1713 | "Burundi" ) SACountryCode="BI" ;;
1714 | "Benin" ) SACountryCode="BJ" ;;
1715 | "Bermuda" ) SACountryCode="BM" ;;
1716 | "Brunei Darussalam" | "Brunei" ) SACountryCode="BN" ;;
1717 | "Bolivia" ) SACountryCode="BO" ;;
1718 | "Brazil" ) SACountryCode="BR" ;;
1719 | "Bahamas" ) SACountryCode="BS" ;;
1720 | "Bhutan" ) SACountryCode="BT" ;;
1721 | "Bouvet Island" ) SACountryCode="BV" ;;
1722 | "Botswana" ) SACountryCode="BW" ;;
1723 | "Belarus" ) SACountryCode="BY" ;;
1724 | "Belize" ) SACountryCode="BZ" ;;
1725 | "Canada" ) SACountryCode="CA" ;;
1726 | "Cocos (Keeling) Islands" | "Cocos Islands" | "Cocos [Keeling] Islands" ) SACountryCode="CC" ;;
1727 | "Congo, The Democratic Republic Of The" | "Congo - Kinshasa" ) SACountryCode="CD" ;;
1728 | "Central African Republic" ) SACountryCode="CF" ;;
1729 | "Congo" | "Congo - Brazzaville" ) SACountryCode="CG" ;;
1730 | "Switzerland" ) SACountryCode="CH" ;;
1731 | "Cote D'Ivoire" | "Ivory Coast" | "Côte d’Ivoire" ) SACountryCode="CI" ;;
1732 | "Cook Islands" ) SACountryCode="CK" ;;
1733 | "Chile" ) SACountryCode="CL" ;;
1734 | "Cameroon" ) SACountryCode="CM" ;;
1735 | "China" ) SACountryCode="CN" ;;
1736 | "Colombia" ) SACountryCode="CO" ;;
1737 | "Costa Rica" ) SACountryCode="CR" ;;
1738 | "Cape Verde" ) SACountryCode="CV" ;;
1739 | "Christmas Island" ) SACountryCode="CX" ;;
1740 | "Cyprus" ) SACountryCode="CY" ;;
1741 | "Czech Republic" ) SACountryCode="CZ" ;;
1742 | "Germany" ) SACountryCode="DE" ;;
1743 | "Djibouti" ) SACountryCode="DJ" ;;
1744 | "Denmark" ) SACountryCode="DK" ;;
1745 | "Dominica" ) SACountryCode="DM" ;;
1746 | "Dominican Republic" ) SACountryCode="DO" ;;
1747 | "Algeria" ) SACountryCode="DZ" ;;
1748 | "Ecuador" ) SACountryCode="EC" ;;
1749 | "Estonia" ) SACountryCode="EE" ;;
1750 | "Egypt" ) SACountryCode="EG" ;;
1751 | "Western Sahara" ) SACountryCode="EH" ;;
1752 | "Eritrea" ) SACountryCode="ER" ;;
1753 | "Spain" ) SACountryCode="ES" ;;
1754 | "Ethiopia" ) SACountryCode="ET" ;;
1755 | "Finland" ) SACountryCode="FI" ;;
1756 | "Fiji" ) SACountryCode="FJ" ;;
1757 | "Falkland Islands (Malvinas)" | "Falkland Islands" ) SACountryCode="FK" ;;
1758 | "Micronesia, Federated States Of" | "Micronesia" ) SACountryCode="FM" ;;
1759 | "Faroe Islands" ) SACountryCode="FO" ;;
1760 | "France" ) SACountryCode="FR" ;;
1761 | "Gabon" ) SACountryCode="GA" ;;
1762 | "United Kingdom" ) SACountryCode="GB" ;;
1763 | "Grenada" ) SACountryCode="GD" ;;
1764 | "Georgia" ) SACountryCode="GE" ;;
1765 | "French Guiana" ) SACountryCode="GF" ;;
1766 | "Ghana" ) SACountryCode="GH" ;;
1767 | "Gibraltar" ) SACountryCode="GI" ;;
1768 | "Greenland" ) SACountryCode="GL" ;;
1769 | "Gambia" ) SACountryCode="GM" ;;
1770 | "Guinea" ) SACountryCode="GN" ;;
1771 | "Guadeloupe" ) SACountryCode="GP" ;;
1772 | "Equatorial Guinea" ) SACountryCode="GQ" ;;
1773 | "Greece" ) SACountryCode="GR" ;;
1774 | "South Georgia and The South Sandwich Islands" | "South Georgia and the South Sandwich Islands" ) SACountryCode="GS" ;;
1775 | "Guatemala" ) SACountryCode="GT" ;;
1776 | "Guam" ) SACountryCode="GU" ;;
1777 | "Guinea-Bissau" ) SACountryCode="GW" ;;
1778 | "Guyana" ) SACountryCode="GY" ;;
1779 | "Hong Kong" | "Hong Kong SAR China" ) SACountryCode="HK" ;;
1780 | "Heard and Mc Donald Islands" | "Heard Island and McDonald Islands" ) SACountryCode="HM" ;;
1781 | "Honduras" ) SACountryCode="HN" ;;
1782 | "Croatia" ) SACountryCode="HR" ;;
1783 | "Haiti" ) SACountryCode="HT" ;;
1784 | "Hungary" ) SACountryCode="HU" ;;
1785 | "Indonesia" ) SACountryCode="ID" ;;
1786 | "Ireland" ) SACountryCode="IE" ;;
1787 | "Israel" ) SACountryCode="IL" ;;
1788 | "India" ) SACountryCode="IN" ;;
1789 | "British Indian Ocean Territory" ) SACountryCode="IO" ;;
1790 | "Iraq" ) SACountryCode="IQ" ;;
1791 | "Iceland" ) SACountryCode="IS" ;;
1792 | "Italy" ) SACountryCode="IT" ;;
1793 | "Jamaica" ) SACountryCode="JM" ;;
1794 | "Jordan" ) SACountryCode="JO" ;;
1795 | "Japan" ) SACountryCode="JP" ;;
1796 | "Kenya" ) SACountryCode="KE" ;;
1797 | "Kyrgyzstan" ) SACountryCode="KG" ;;
1798 | "Cambodia" ) SACountryCode="KH" ;;
1799 | "Kiribati" ) SACountryCode="KI" ;;
1800 | "Comoros" ) SACountryCode="KM" ;;
1801 | "Saint Kitts and Nevis" ) SACountryCode="KN" ;;
1802 | "Korea, Republic Of" | "South Korea" ) SACountryCode="KR" ;;
1803 | "Kuwait" ) SACountryCode="KW" ;;
1804 | "Cayman Islands" ) SACountryCode="KY" ;;
1805 | "Kazakhstan" ) SACountryCode="KZ" ;;
1806 | "Lao People's Democratic Republic" | "Laos" ) SACountryCode="LA" ;;
1807 | "Lebanon" ) SACountryCode="LB" ;;
1808 | "Saint Lucia" ) SACountryCode="LC" ;;
1809 | "Liechtenstein" ) SACountryCode="LI" ;;
1810 | "Sri Lanka" ) SACountryCode="LK" ;;
1811 | "Liberia" ) SACountryCode="LR" ;;
1812 | "Lesotho" ) SACountryCode="LS" ;;
1813 | "Lithuania" ) SACountryCode="LT" ;;
1814 | "Luxembourg" ) SACountryCode="LU" ;;
1815 | "Latvia" ) SACountryCode="LV" ;;
1816 | "Morocco" ) SACountryCode="MA" ;;
1817 | "Monaco" ) SACountryCode="MC" ;;
1818 | "Moldova" ) SACountryCode="MD" ;;
1819 | "Montenegro" ) SACountryCode="ME" ;;
1820 | "Madagascar" ) SACountryCode="MG" ;;
1821 | "Marshall Islands" ) SACountryCode="MH" ;;
1822 | "Macedonia, The Former Yugoslav Republic Of" | "Macedonia" ) SACountryCode="MK" ;;
1823 | "Mali" ) SACountryCode="ML" ;;
1824 | "Myanmar" | "Myanmar [Burma]" ) SACountryCode="MM" ;;
1825 | "Mongolia" ) SACountryCode="MN" ;;
1826 | "Macau" | "Macau SAR China" ) SACountryCode="MO" ;;
1827 | "Northern Mariana Islands" ) SACountryCode="MP" ;;
1828 | "Martinique" ) SACountryCode="MQ" ;;
1829 | "Mauritania" ) SACountryCode="MR" ;;
1830 | "Montserrat" ) SACountryCode="MS" ;;
1831 | "Malta" ) SACountryCode="MT" ;;
1832 | "Mauritius" ) SACountryCode="MU" ;;
1833 | "Maldives" ) SACountryCode="MV" ;;
1834 | "Malawi" ) SACountryCode="MW" ;;
1835 | "Mexico" ) SACountryCode="MX" ;;
1836 | "Malaysia" ) SACountryCode="MY" ;;
1837 | "Mozambique" ) SACountryCode="MZ" ;;
1838 | "Namibia" ) SACountryCode="NA" ;;
1839 | "New Caledonia" ) SACountryCode="NC" ;;
1840 | "Niger" ) SACountryCode="NE" ;;
1841 | "Norfolk Island" ) SACountryCode="NF" ;;
1842 | "Nigeria" ) SACountryCode="NG" ;;
1843 | "Nicaragua" ) SACountryCode="NI" ;;
1844 | "Netherlands" ) SACountryCode="NL" ;;
1845 | "Norway" ) SACountryCode="NO" ;;
1846 | "Nepal" ) SACountryCode="NP" ;;
1847 | "Nauru" ) SACountryCode="NR" ;;
1848 | "Niue" ) SACountryCode="NU" ;;
1849 | "New Zealand" ) SACountryCode="NZ" ;;
1850 | "Oman" ) SACountryCode="OM" ;;
1851 | "Panama" ) SACountryCode="PA" ;;
1852 | "Peru" ) SACountryCode="PE" ;;
1853 | "French Polynesia" ) SACountryCode="PF" ;;
1854 | "Papua New Guinea" ) SACountryCode="PG" ;;
1855 | "Philippines" ) SACountryCode="PH" ;;
1856 | "Pakistan" ) SACountryCode="PK" ;;
1857 | "Poland" ) SACountryCode="PL" ;;
1858 | "St. Pierre and Miquelon" | "Saint Pierre and Miquelon" ) SACountryCode="PM" ;;
1859 | "Pitcairn" | "Pitcairn Islands" ) SACountryCode="PN" ;;
1860 | "Puerto Rico" ) SACountryCode="PR" ;;
1861 | "Palestinian Authority" | "Palestinian Territory" | "Palestinian Territories" ) SACountryCode="PS" ;;
1862 | "Portugal" ) SACountryCode="PT" ;;
1863 | "Palau" ) SACountryCode="PW" ;;
1864 | "Paraguay" ) SACountryCode="PY" ;;
1865 | "Qatar" ) SACountryCode="QA" ;;
1866 | "Reunion" | "Réunion" ) SACountryCode="RE" ;;
1867 | "Romania" ) SACountryCode="RO" ;;
1868 | "Serbia" ) SACountryCode="RS" ;;
1869 | "Russian Federation" | "Russia" ) SACountryCode="RU" ;;
1870 | "Rwanda" ) SACountryCode="RW" ;;
1871 | "Saudi Arabia" ) SACountryCode="SA" ;;
1872 | "Solomon Islands" ) SACountryCode="SB" ;;
1873 | "Seychelles" ) SACountryCode="SC" ;;
1874 | "Sweden" ) SACountryCode="SE" ;;
1875 | "Singapore" ) SACountryCode="SG" ;;
1876 | "St. Helena" | "Saint Helena" ) SACountryCode="SH" ;;
1877 | "Slovenia" ) SACountryCode="SI" ;;
1878 | "Svalbard and Jan Mayen Islands" | "Svalbard and Jan Mayen" ) SACountryCode="SJ" ;;
1879 | "Slovak Republic" | "Slovakia" ) SACountryCode="SK" ;;
1880 | "Sierra Leone" ) SACountryCode="SL" ;;
1881 | "San Marino" ) SACountryCode="SM" ;;
1882 | "Senegal" ) SACountryCode="SN" ;;
1883 | "Somalia" ) SACountryCode="SO" ;;
1884 | "Suriname" ) SACountryCode="SR" ;;
1885 | "Sao Tome and Principe" | "São Tomé and Príncipe" ) SACountryCode="ST" ;;
1886 | "El Salvador" ) SACountryCode="SV" ;;
1887 | "Swaziland" ) SACountryCode="SZ" ;;
1888 | "Turks and Caicos Islands" ) SACountryCode="TC" ;;
1889 | "Chad" ) SACountryCode="TD" ;;
1890 | "French Southern Territories" ) SACountryCode="TF" ;;
1891 | "Togo" ) SACountryCode="TG" ;;
1892 | "Thailand" ) SACountryCode="TH" ;;
1893 | "Tajikistan" ) SACountryCode="TJ" ;;
1894 | "Tokelau" ) SACountryCode="TK" ;;
1895 | "Turkmenistan" ) SACountryCode="TM" ;;
1896 | "Tunisia" ) SACountryCode="TN" ;;
1897 | "Tonga" ) SACountryCode="TO" ;;
1898 | "East Timor" ) SACountryCode="TP" ;;
1899 | "Turkey" ) SACountryCode="TR" ;;
1900 | "Trinidad and Tobago" ) SACountryCode="TT" ;;
1901 | "Tuvalu" ) SACountryCode="TV" ;;
1902 | "Taiwan" ) SACountryCode="TW" ;;
1903 | "Tanzania, United Republic Of" | "Tanzania" ) SACountryCode="TZ" ;;
1904 | "Ukraine" ) SACountryCode="UA" ;;
1905 | "Uganda" ) SACountryCode="UG" ;;
1906 | "United States Minor Outlying Islands" | "U.S. Minor Outlying Islands" ) SACountryCode="UM" ;;
1907 | "United States" ) SACountryCode="US" ;;
1908 | "Uruguay" ) SACountryCode="UY" ;;
1909 | "Uzbekistan" ) SACountryCode="UZ" ;;
1910 | "Holy See (Vatican City State)" | "Vatican" | "Vatican City" ) SACountryCode="VA" ;;
1911 | "Saint Vincent and The Grenadines" | "Saint Vincent and the Grenadines" ) SACountryCode="VC" ;;
1912 | "Venezuela" ) SACountryCode="VE" ;;
1913 | "Virgin Islands (British)" | "British Virgin Islands" ) SACountryCode="VG" ;;
1914 | "Virgin Islands (U.S.)" | "U.S. Virgin Islands" ) SACountryCode="VI" ;;
1915 | "Viet Nam" | "Vietnam" ) SACountryCode="VN" ;;
1916 | "Vanuatu" ) SACountryCode="VU" ;;
1917 | "Wallis and Futuna Islands" | "Wallis and Futuna" ) SACountryCode="WF" ;;
1918 | "Samoa" ) SACountryCode="WS" ;;
1919 | "Yemen" ) SACountryCode="YE" ;;
1920 | "Mayotte" ) SACountryCode="YT" ;;
1921 | "Serbia and Montenegro" ) SACountryCode="YU" ;;
1922 | "South Africa" ) SACountryCode="ZA" ;;
1923 | "Zambia" ) SACountryCode="ZM" ;;
1924 | "Zimbabwe" ) SACountryCode="ZW" ;;
1925 | esac
1926 | }
1927 |
1928 | function set_ResourceID {
1929 | # ${1}: Language Code
1930 | # ${2}: Country Code
1931 | unset ResourceID
1932 | case "${1}" in
1933 | "ja" ) case ${TargetOSMinor} in
1934 | 5 ) ResourceID=16384 ;;
1935 | * ) case "${2}" in
1936 | "JP" ) ResourceID=16384 ;;
1937 | esac ;;
1938 | esac ;;
1939 | "fr" ) case ${TargetOSMinor} in
1940 | 5 ) case "${2}" in
1941 | "CA" ) ResourceID=11 ;;
1942 | "CH" ) ResourceID=18 ;;
1943 | "DE" ) ResourceID=3 ;;
1944 | "ES" ) ResourceID=8 ;;
1945 | "IE" ) ResourceID=108 ;;
1946 | "IT" ) ResourceID=4 ;;
1947 | "US" ) ResourceID=0 ;;
1948 | * ) ResourceID=1 ;;
1949 | esac ;;
1950 | * ) case "${2}" in
1951 | "CA" ) ResourceID=11 ;;
1952 | "CH" ) ResourceID=18 ;;
1953 | "FR" ) ResourceID=1 ;;
1954 | esac ;;
1955 | esac ;;
1956 | "de" ) case ${TargetOSMinor} in
1957 | 5 ) case "${2}" in
1958 | "AT" ) ResourceID=92 ;;
1959 | "CH" ) ResourceID=19 ;;
1960 | "ES" ) ResourceID=8 ;;
1961 | "FR" ) ResourceID=1 ;;
1962 | "IE" ) ResourceID=108 ;;
1963 | "IT" ) ResourceID=4 ;;
1964 | "US" ) ResourceID=0 ;;
1965 | * ) ResourceID=3 ;;
1966 | esac ;;
1967 | * ) case "${2}" in
1968 | "AT" ) ResourceID=92 ;;
1969 | "CH" ) ResourceID=19 ;;
1970 | "DE" ) ResourceID=3 ;;
1971 | esac ;;
1972 | esac ;;
1973 | "es" ) case ${TargetOSMinor} in
1974 | 5 ) case "${2}" in
1975 | "DE" ) ResourceID=3 ;;
1976 | "FR" ) ResourceID=1 ;;
1977 | "IE" ) ResourceID=108 ;;
1978 | "IT" ) ResourceID=4 ;;
1979 | "US" ) ResourceID=0 ;;
1980 | * ) ResourceID=8 ;;
1981 | esac ;;
1982 | * ) case "${2}" in
1983 | "ES" ) ResourceID=8 ;;
1984 | esac ;;
1985 | esac ;;
1986 | "it" ) case ${TargetOSMinor} in
1987 | 5 ) case "${2}" in
1988 | "CH" ) ResourceID=36 ;;
1989 | "DE" ) ResourceID=3 ;;
1990 | "ES" ) ResourceID=8 ;;
1991 | "FR" ) ResourceID=1 ;;
1992 | "IE" ) ResourceID=108 ;;
1993 | "US" ) ResourceID=0 ;;
1994 | * ) ResourceID=4 ;;
1995 | esac ;;
1996 | * ) case "${2}" in
1997 | "CH" ) ResourceID=36 ;;
1998 | "IT" ) ResourceID=4 ;;
1999 | esac ;;
2000 | esac ;;
2001 | "pt" ) case ${TargetOSMinor} in
2002 | 5 ) case "${2}" in
2003 | "DE" ) ResourceID=3 ;;
2004 | "ES" ) ResourceID=8 ;;
2005 | "FR" ) ResourceID=1 ;;
2006 | "IE" ) ResourceID=108 ;;
2007 | "IT" ) ResourceID=4 ;;
2008 | "PT" ) ResourceID=10 ;;
2009 | "US" ) ResourceID=0 ;;
2010 | * ) ResourceID=71 ;;
2011 | esac ;;
2012 | * ) case "${2}" in
2013 | "BR" ) ResourceID=71 ;;
2014 | "PT" ) ResourceID=10 ;;
2015 | esac ;;
2016 | esac ;;
2017 | "pt-PT" ) case ${TargetOSMinor} in
2018 | 5 ) case "${2}" in
2019 | "DE" ) ResourceID=3 ;;
2020 | "ES" ) ResourceID=8 ;;
2021 | "FR" ) ResourceID=1 ;;
2022 | "IE" ) ResourceID=108 ;;
2023 | "IT" ) ResourceID=4 ;;
2024 | "US" ) ResourceID=0 ;;
2025 | * ) ResourceID=10 ;;
2026 | esac ;;
2027 | * ) case "${2}" in
2028 | "PT" ) ResourceID=10 ;;
2029 | esac ;;
2030 | esac ;;
2031 | "nl" ) case ${TargetOSMinor} in
2032 | 5 ) case "${2}" in
2033 | "BE" ) ResourceID=6 ;;
2034 | "DE" ) ResourceID=3 ;;
2035 | "ES" ) ResourceID=8 ;;
2036 | "FR" ) ResourceID=1 ;;
2037 | "IE" ) ResourceID=108 ;;
2038 | "IT" ) ResourceID=4 ;;
2039 | "US" ) ResourceID=0 ;;
2040 | * ) ResourceID=5 ;;
2041 | esac ;;
2042 | * ) case "${2}" in
2043 | "BE" ) ResourceID=6 ;;
2044 | "NL" ) ResourceID=5 ;;
2045 | esac ;;
2046 | esac ;;
2047 | "sv" ) case ${TargetOSMinor} in
2048 | 5 ) case "${2}" in
2049 | "DE" ) ResourceID=3 ;;
2050 | "ES" ) ResourceID=8 ;;
2051 | "FR" ) ResourceID=1 ;;
2052 | "IE" ) ResourceID=108 ;;
2053 | "IT" ) ResourceID=4 ;;
2054 | "US" ) ResourceID=0 ;;
2055 | * ) ResourceID=7 ;;
2056 | esac ;;
2057 | * ) case "${2}" in
2058 | "SE" ) ResourceID=7 ;;
2059 | esac ;;
2060 | esac ;;
2061 | "nb" ) case ${TargetOSMinor} in
2062 | 5 ) case "${2}" in
2063 | "DE" ) ResourceID=3 ;;
2064 | "ES" ) ResourceID=8 ;;
2065 | "FR" ) ResourceID=1 ;;
2066 | "IE" ) ResourceID=108 ;;
2067 | "IT" ) ResourceID=4 ;;
2068 | "US" ) ResourceID=0 ;;
2069 | * ) ResourceID=12 ;;
2070 | esac ;;
2071 | * ) case "${2}" in
2072 | "NO" ) ResourceID=12 ;;
2073 | esac ;;
2074 | esac ;;
2075 | "da" ) case ${TargetOSMinor} in
2076 | 5 ) case "${2}" in
2077 | "DE" ) ResourceID=3 ;;
2078 | "ES" ) ResourceID=8 ;;
2079 | "FR" ) ResourceID=1 ;;
2080 | "IE" ) ResourceID=108 ;;
2081 | "IT" ) ResourceID=4 ;;
2082 | "US" ) ResourceID=0 ;;
2083 | * ) ResourceID=9 ;;
2084 | esac ;;
2085 | * ) case "${2}" in
2086 | "DK" ) ResourceID=9 ;;
2087 | esac ;;
2088 | esac ;;
2089 | "fi" ) case ${TargetOSMinor} in
2090 | 5 ) case "${2}" in
2091 | "DE" ) ResourceID=3 ;;
2092 | "ES" ) ResourceID=8 ;;
2093 | "FR" ) ResourceID=1 ;;
2094 | "IE" ) ResourceID=108 ;;
2095 | "IT" ) ResourceID=4 ;;
2096 | "US" ) ResourceID=0 ;;
2097 | * ) ResourceID=17 ;;
2098 | esac ;;
2099 | * ) case "${2}" in
2100 | "FI" ) ResourceID=17 ;;
2101 | esac ;;
2102 | esac ;;
2103 | "ru" ) case ${TargetOSMinor} in
2104 | 5 ) ResourceID=19456 ;;
2105 | * ) case "${2}" in
2106 | "RU" ) ResourceID=19456 ;;
2107 | esac ;;
2108 | esac ;;
2109 | "pl" ) case ${TargetOSMinor} in
2110 | 5 ) ResourceID=30776 ;;
2111 | * ) case "${2}" in
2112 | "PL" ) ResourceID=30776 ;;
2113 | esac ;;
2114 | esac ;;
2115 | "zh-Hans" ) case ${TargetOSMinor} in
2116 | 5 ) ResourceID=28672 ;;
2117 | * ) case "${2}" in
2118 | "CN" ) ResourceID=28672 ;;
2119 | esac ;;
2120 | esac ;;
2121 | "zh-Hant" ) case ${TargetOSMinor} in
2122 | 5 ) ResourceID=16896 ;;
2123 | * ) case "${2}" in
2124 | "TW" ) ResourceID=16896 ;;
2125 | esac ;;
2126 | esac ;;
2127 | "ko" ) case ${TargetOSMinor} in
2128 | 5 ) ResourceID=17408 ;;
2129 | * ) case "${2}" in
2130 | "KR" ) ResourceID=17408 ;;
2131 | esac ;;
2132 | esac ;;
2133 | * ) case ${TargetOSMinor} in
2134 | 5 ) case "${2}" in
2135 | "AU" ) ResourceID=15 ;;
2136 | "DE" ) ResourceID=3 ;;
2137 | "ES" ) ResourceID=8 ;;
2138 | "FR" ) ResourceID=1 ;;
2139 | "GB" ) ResourceID=2 ;;
2140 | "IE" ) ResourceID=108 ;;
2141 | "IT" ) ResourceID=4 ;;
2142 | * ) ResourceID=0 ;;
2143 | esac ;;
2144 | * ) case "${2}" in
2145 | "AU" ) ResourceID=15 ;;
2146 | "GB" ) ResourceID=2 ;;
2147 | "IE" ) ResourceID=108 ;;
2148 | "NZ" ) ResourceID=15 ;;
2149 | "US" ) ResourceID=0 ;;
2150 | esac ;;
2151 | esac ;;
2152 | esac
2153 | }
2154 |
2155 | # Section: Keyboard
2156 |
2157 | function set_SAKeyboard_SATypingStyle {
2158 | # ${1}: InputSourceID
2159 | unset SAKeyboard
2160 | unset SATypingStyle
2161 | case "${1}" in
2162 | "AfghanDari" ) SAKeyboard="Afghan Dari" ;;
2163 | "AfghanPashto" ) SAKeyboard="Afghan Pashto" ;;
2164 | "AfghanUzbek" ) SAKeyboard="Afghan Uzbek" ;;
2165 | "Arabic" ) SAKeyboard="Arabic" ;;
2166 | "ArabicPC" ) SAKeyboard="Arabic - PC" ;;
2167 | "Arabic-QWERTY" ) SAKeyboard="Arabic - QWERTY" ;;
2168 | "Armenian-HMQWERTY" ) SAKeyboard="Armenian - HM QWERTY" ;;
2169 | "Armenian-WesternQWERTY" ) SAKeyboard="Armenian - Western QWERTY" ;;
2170 | "Australian" ) SAKeyboard="Australian" ;;
2171 | "Austrian" ) SAKeyboard="Austrian" ;;
2172 | "Azeri" ) SAKeyboard="Azeri" ;;
2173 | "Bangla" ) SAKeyboard="Bangla" ;;
2174 | "Bangla-QWERTY" ) SAKeyboard="Bangla - Qwerty" ;;
2175 | "Belgian" ) SAKeyboard="Belgian" ;;
2176 | "Brazilian" ) SAKeyboard="Brazilian" ;;
2177 | "British" ) SAKeyboard="British" ;;
2178 | "British-PC" ) SAKeyboard="British - PC" ;;
2179 | "Bulgarian" ) SAKeyboard="Bulgarian" ;;
2180 | "Bulgarian-Phonetic" ) SAKeyboard="Bulgarian - Phonetic" ;;
2181 | "Byelorussian" ) SAKeyboard="Byelorussian" ;;
2182 | "Canadian" ) SAKeyboard="Canadian English" ;;
2183 | "Canadian-CSA" ) SAKeyboard="Canadian French - CSA" ;;
2184 | "Cherokee-Nation" ) SAKeyboard="Cherokee - Nation" ;;
2185 | "Cherokee-QWERTY" ) SAKeyboard="Cherokee - QWERTY" ;;
2186 | "SCIM.ITABC" )
2187 | case ${TargetOSMinor} in
2188 | 5 ) SAKeyboard="Simplified Chinese" ; SATypingStyle="ITABC" ;;
2189 | * ) SAKeyboard="Chinese - Simplified" ; SATypingStyle="Pinyin - Simplified" ;;
2190 | esac ;;
2191 | "SCIM.WBH" )
2192 | case ${TargetOSMinor} in
2193 | 5 ) SAKeyboard="Simplified Chinese" ; SATypingStyle="Wubi Hua" ;;
2194 | * ) SAKeyboard="Chinese - Simplified" ; SATypingStyle="Wubi Hua" ;;
2195 | esac ;;
2196 | "SCIM.WBX" )
2197 | case ${TargetOSMinor} in
2198 | 5 ) SAKeyboard="Simplified Chinese" ; SATypingStyle="Wubi Xing" ;;
2199 | * ) SAKeyboard="Chinese - Simplified" ; SATypingStyle="Wubi Xing" ;;
2200 | esac ;;
2201 | "TCIM.Cangjie" )
2202 | case ${TargetOSMinor} in
2203 | 5 ) SAKeyboard="Traditional Chinese" ; SATypingStyle="Cangjie" ;;
2204 | * ) SAKeyboard="Chinese - Traditional" ; SATypingStyle="Cangjie" ;;
2205 | esac ;;
2206 | "TCIM.Dayi" )
2207 | case ${TargetOSMinor} in
2208 | 5 ) SAKeyboard="Traditional Chinese" ; SATypingStyle="Dayi(Pro)" ;;
2209 | * ) SAKeyboard="Chinese - Traditional" ; SATypingStyle="Dayi Pro" ;;
2210 | esac ;;
2211 | "TCIM.Hanin" ) SAKeyboard="Traditional Chinese" ; SATypingStyle="Hanin" ;;
2212 | "TCIM.Jianyi" )
2213 | case ${TargetOSMinor} in
2214 | 5 ) SAKeyboard="Traditional Chinese" ; SATypingStyle="Jianyi" ;;
2215 | 6 | 7 ) SAKeyboard="Chinese - Traditional" ; SATypingStyle="Jianyi" ;;
2216 | * ) SAKeyboard="Chinese - Traditional" ; SATypingStyle="Sucheng" ;;
2217 | esac ;;
2218 | "TCIM.Pinyin" )
2219 | case ${TargetOSMinor} in
2220 | 5 ) SAKeyboard="Traditional Chinese" ; SATypingStyle="Pinyin" ;;
2221 | * ) SAKeyboard="Chinese - Traditional" ; SATypingStyle="Pinyin - Traditional" ;;
2222 | esac ;;
2223 | "TCIM.Zhuyin" )
2224 | case ${TargetOSMinor} in
2225 | 5 ) SAKeyboard="Traditional Chinese" ; SATypingStyle="Zhuyin" ;;
2226 | * ) SAKeyboard="Chinese - Traditional" ; SATypingStyle="Zhuyin" ;;
2227 | esac ;;
2228 | "TCIM.ZhuyinEten" ) SAKeyboard="Chinese - Traditional" ; SATypingStyle="Zhuyin - Eten" ;;
2229 | "Colemak" ) SAKeyboard="Colemak" ;;
2230 | "Croatian" ) SAKeyboard="Croatian" ;;
2231 | "Croatian-PC" ) SAKeyboard="Croatian - PC" ;;
2232 | "Czech" ) SAKeyboard="Czech" ;;
2233 | "Czech-QWERTY" ) SAKeyboard="Czech - QWERTY" ;;
2234 | "Danish" ) SAKeyboard="Danish" ;;
2235 | "Devanagari" ) SAKeyboard="Devanagari" ;;
2236 | "Devanagari-QWERTY" ) SAKeyboard="Devanagari - QWERTY" ;;
2237 | "Dutch" ) SAKeyboard="Dutch" ;;
2238 | "Dvorak" ) SAKeyboard="Dvorak" ;;
2239 | "Dvorak-Left" ) SAKeyboard="Dvorak - Left" ;;
2240 | "DVORAK-QWERTYCMD" ) SAKeyboard="Dvorak - Qwerty ⌘" ;;
2241 | "Dvorak-Right" ) SAKeyboard="Dvorak - Right" ;;
2242 | "Estonian" ) SAKeyboard="Estonian" ;;
2243 | "Faroese" ) SAKeyboard="Faroese" ;;
2244 | "Finnish" ) SAKeyboard="Finnish" ;;
2245 | "FinnishExtended" ) SAKeyboard="Finnish Extended" ;;
2246 | "FinnishSami-PC" ) SAKeyboard="Finnish Sami - PC" ;;
2247 | "French" ) SAKeyboard="French" ;;
2248 | "French-numerical" ) SAKeyboard="French - Numerical" ;;
2249 | "Georgian-QWERTY" ) SAKeyboard="Georgian - QWERTY" ;;
2250 | "German" ) SAKeyboard="German" ;;
2251 | "Greek" ) SAKeyboard="Greek" ;;
2252 | "GreekPolytonic" ) SAKeyboard="Greek Polytonic" ;;
2253 | "Gujarati" ) SAKeyboard="Gujarati" ;;
2254 | "Gujarati-QWERTY" ) SAKeyboard="Gujarati - QWERTY" ;;
2255 | "Gurmukhi" ) SAKeyboard="Gurmukhi" ;;
2256 | "Gurmukhi-QWERTY" ) SAKeyboard="Gurmukhi - QWERTY" ;;
2257 | "Korean.2SetKorean" ) SAKeyboard="Hangul" ; SATypingStyle="2-Set Korean" ;;
2258 | "Korean.3SetKorean" ) SAKeyboard="Hangul" ; SATypingStyle="3-Set Korean" ;;
2259 | "Korean.390Sebulshik" ) SAKeyboard="Hangul" ; SATypingStyle="390 Sebulshik" ;;
2260 | "Korean.GongjinCheongRomaja" ) SAKeyboard="Hangul" ; SATypingStyle="GongjinCheong Romaja" ;;
2261 | "Korean.HNCRomaja" ) SAKeyboard="Hangul" ; SATypingStyle="HNC Romaja" ;;
2262 | "Hawaiian" ) SAKeyboard="Hawaiian" ;;
2263 | "Hebrew" ) SAKeyboard="Hebrew" ;;
2264 | "Hebrew-PC" ) SAKeyboard="Hebrew - PC" ;;
2265 | "Hebrew-QWERTY" ) SAKeyboard="Hebrew - QWERTY" ;;
2266 | "Hungarian" ) SAKeyboard="Hungarian" ;;
2267 | "Icelandic" ) SAKeyboard="Icelandic" ;;
2268 | "Inuktitut-Nunavut" ) SAKeyboard="Inuktitut - Nunavut" ;;
2269 | "Inuktitut-Nutaaq" ) SAKeyboard="Inuktitut - Nutaaq" ;;
2270 | "Inuktitut-QWERTY" ) SAKeyboard="Inuktitut - QWERTY" ;;
2271 | "InuttitutNunavik" ) SAKeyboard="Inuttitut Nunavik" ;;
2272 | "Irish" ) SAKeyboard="Irish" ;;
2273 | "IrishExtended" ) SAKeyboard="Irish Extended" ;;
2274 | "Italian" )
2275 | case ${TargetOSMinor} in
2276 | 5 | 6 ) SAKeyboard="Italian" ;;
2277 | 7 | 8 ) SAKeyboard="Italian Typewriter" ;;
2278 | esac ;;
2279 | "Italian-Pro" )
2280 | case ${TargetOSMinor} in
2281 | 5 | 6 ) SAKeyboard="Italian - Pro" ;;
2282 | 7 | 8 ) SAKeyboard="Italian" ;;
2283 | esac ;;
2284 | "Jawi-QWERTY" ) SAKeyboard="Jawi - QWERTY" ;;
2285 | "Kannada" ) SAKeyboard="Kannada" ;;
2286 | "Kannada-QWERTY" ) SAKeyboard="Kannada - QWERTY" ;;
2287 | "Kazakh" ) SAKeyboard="Kazakh" ;;
2288 | "Khmer" ) SAKeyboard="Khmer" ;;
2289 | "Japanese.Katakana" ) SAKeyboard="Kotoeri" ; SATypingStyle="Kana" ;;
2290 | "Japanese.Roman" ) SAKeyboard="Kotoeri" ; SATypingStyle="Romaji" ;;
2291 | "Kurdish-Sorani" ) SAKeyboard="Kurdish-Sorani" ;;
2292 | "Latvian" ) SAKeyboard="Latvian" ;;
2293 | "Lithuanian" ) SAKeyboard="Lithuanian" ;;
2294 | "Macedonian" ) SAKeyboard="Macedonian" ;;
2295 | "Malayalam" ) SAKeyboard="Malayalam" ;;
2296 | "Malayalam-QWERTY" ) SAKeyboard="Malayalam - QWERTY" ;;
2297 | "Maltese" ) SAKeyboard="Maltese" ;;
2298 | "Maori" ) SAKeyboard="Maori" ;;
2299 | "Myanmar-QWERTY" ) SAKeyboard="Myanmar - QWERTY" ;;
2300 | "Nepali" ) SAKeyboard="Nepali" ;;
2301 | "NorthernSami" ) SAKeyboard="Northern Sami" ;;
2302 | "Norwegian" ) SAKeyboard="Norwegian" ;;
2303 | "NorwegianExtended" ) SAKeyboard="Norwegian Extended" ;;
2304 | "NorwegianSami-PC" ) SAKeyboard="Norwegian Sami - PC" ;;
2305 | "Oriya" ) SAKeyboard="Oriya" ;;
2306 | "Oriya-QWERTY" ) SAKeyboard="Oriya - QWERTY" ;;
2307 | "Persian" ) SAKeyboard="Persian" ;;
2308 | "Persian-ISIRI2901" )
2309 | case ${TargetOSMinor} in
2310 | 8 ) SAKeyboard="Persian - ISIRI" ;;
2311 | * ) SAKeyboard="Persian - ISIRI 2901" ;;
2312 | esac ;;
2313 | "Persian-QWERTY" ) SAKeyboard="Persian - QWERTY" ;;
2314 | "Polish" ) SAKeyboard="Polish" ;;
2315 | "PolishPro" ) SAKeyboard="Polish Pro" ;;
2316 | "Portuguese" ) SAKeyboard="Portuguese" ;;
2317 | "Romanian" ) SAKeyboard="Romanian" ;;
2318 | "Romanian-Standard" ) SAKeyboard="Romanian - Standard" ;;
2319 | "Russian" ) SAKeyboard="Russian" ;;
2320 | "RussianWin" ) SAKeyboard="Russian - PC" ;;
2321 | "Russian-Phonetic" ) SAKeyboard="Russian - Phonetic" ;;
2322 | "Sami-PC" ) SAKeyboard="Sami - PC" ;;
2323 | "Serbian" ) SAKeyboard="Serbian" ;;
2324 | "Serbian-Latin" ) SAKeyboard="Serbian - Latin" ;;
2325 | "Sinhala" ) SAKeyboard="Sinhala" ;;
2326 | "Sinhala-QWERTY" ) SAKeyboard="Sinhala - QWERTY" ;;
2327 | "Slovak" ) SAKeyboard="Slovak" ;;
2328 | "Slovak-QWERTY" ) SAKeyboard="Slovak - QWERTY" ;;
2329 | "Slovenian" ) SAKeyboard="Slovenian" ;;
2330 | "Spanish" ) SAKeyboard="Spanish" ;;
2331 | "Spanish-ISO" ) SAKeyboard="Spanish - ISO" ;;
2332 | "Swedish" ) SAKeyboard="Swedish" ;;
2333 | "Swedish-Pro" ) SAKeyboard="Swedish - Pro" ;;
2334 | "SwedishSami-PC" ) SAKeyboard="Swedish Sami - PC" ;;
2335 | "SwissFrench" ) SAKeyboard="Swiss French" ;;
2336 | "SwissGerman" ) SAKeyboard="Swiss German" ;;
2337 | "Tamil.AnjalIM" ) SAKeyboard="Tamil Input Method" ; SATypingStyle="Anjal" ;;
2338 | "Tamil.Tamil99" ) SAKeyboard="Tamil Input Method" ; SATypingStyle="Tamil99" ;;
2339 | "Telugu" ) SAKeyboard="Telugu" ;;
2340 | "Telugu-QWERTY" ) SAKeyboard="Telugu - QWERTY" ;;
2341 | "Thai" ) SAKeyboard="Thai" ;;
2342 | "Thai-PattaChote" ) SAKeyboard="Thai - PattaChote" ;;
2343 | "TibetanOtaniUS" ) SAKeyboard="Tibetan - Otani" ;;
2344 | "Tibetan-QWERTY" ) SAKeyboard="Tibetan - QWERTY" ;;
2345 | "Tibetan-Wylie" ) SAKeyboard="Tibetan - Wylie" ;;
2346 | "Turkish" ) SAKeyboard="Turkish" ;;
2347 | "Turkish-QWERTY" ) SAKeyboard="Turkish - QWERTY" ;;
2348 | "Turkish-QWERTY-PC" ) SAKeyboard="Turkish - QWERTY PC" ;;
2349 | "US" ) SAKeyboard="U.S." ;;
2350 | "USExtended" ) SAKeyboard="U.S. Extended" ;;
2351 | "USInternational-PC" ) SAKeyboard="U.S. International - PC" ;;
2352 | "Ukrainian" ) SAKeyboard="Ukrainian" ;;
2353 | "UnicodeHexInput" ) SAKeyboard="Unicode Hex Input" ;;
2354 | "Urdu" ) SAKeyboard="Urdu" ;;
2355 | "Uyghur" ) SAKeyboard="Uyghur" ;;
2356 | "Uyghur-QWERTY" ) SAKeyboard="Uyghur - QWERTY" ;;
2357 | "Vietnamese" ) SAKeyboard="Vietnamese" ;;
2358 | "VietnameseSimpleTelex" ) SAKeyboard="Vietnamese UniKey" ; SATypingStyle="Simple Telex" ;;
2359 | "VietnameseTelex" ) SAKeyboard="Vietnamese UniKey" ; SATypingStyle="Telex" ;;
2360 | "VietnameseVIQR" ) SAKeyboard="Vietnamese UniKey" ; SATypingStyle="VIQR" ;;
2361 | "VietnameseVNI" ) SAKeyboard="Vietnamese UniKey" ; SATypingStyle="VNI" ;;
2362 | "Welsh" ) SAKeyboard="Welsh" ;;
2363 | esac
2364 | }
2365 |
2366 | function set_InputSourceIDs {
2367 | case ${TargetOSMinor} in
2368 | 5 ) InputSourceIDs=( "AfghanDari" "AfghanPashto" "AfghanUzbek" "Arabic" "Arabic-QWERTY" "ArabicPC" "Armenian-HMQWERTY" "Armenian-WesternQWERTY" "Australian" "Austrian" "Azeri" "Belgian" "Brazilian" "British" "Bulgarian" "Bulgarian-Phonetic" "Byelorussian" "Canadian" "Canadian-CSA" "Cherokee-Nation" "Cherokee-QWERTY" "Croatian" "Czech" "Czech-QWERTY" "Danish" "Devanagari" "Devanagari-QWERTY" "Dutch" "Dvorak" "DVORAK-QWERTYCMD" "Estonian" "Faroese" "Finnish" "FinnishExtended" "FinnishSami-PC" "French" "French-numerical" "German" "Greek" "GreekPolytonic" "Gujarati" "Gujarati-QWERTY" "Gurmukhi" "Gurmukhi-QWERTY" "Hawaiian" "Hebrew" "Hebrew-QWERTY" "Hungarian" "Icelandic" "Inuktitut-Nunavut" "Inuktitut-Nutaaq" "Inuktitut-QWERTY" "InuttitutNunavik" "Irish" "IrishExtended" "Italian" "Italian-Pro" "Japanese.Katakana" "Japanese.Roman" "Jawi-QWERTY" "Kazakh" "Korean.2SetKorean" "Korean.390Sebulshik" "Korean.3SetKorean" "Korean.GongjinCheongRomaja" "Korean.HNCRomaja" "Latvian" "Lithuanian" "Macedonian" "Maltese" "Maori" "Nepali" "NorthernSami" "Norwegian" "NorwegianExtended" "NorwegianSami-PC" "Persian" "Persian-ISIRI2901" "Persian-QWERTY" "Polish" "PolishPro" "Portuguese" "Romanian" "Romanian-Standard" "Russian" "Russian-Phonetic" "RussianWin" "Sami-PC" "SCIM.ITABC" "SCIM.WBH" "SCIM.WBX" "Serbian" "Serbian-Latin" "Slovak" "Slovak-QWERTY" "Slovenian" "Spanish" "Spanish-ISO" "Swedish" "Swedish-Pro" "SwedishSami-PC" "SwissFrench" "SwissGerman" "Tamil.AnjalIM" "Tamil.Tamil99" "TCIM.Cangjie" "TCIM.Dayi" "TCIM.Hanin" "TCIM.Jianyi" "TCIM.Pinyin" "TCIM.Zhuyin" "Thai" "Thai-PattaChote" "Tibetan-QWERTY" "Tibetan-Wylie" "TibetanOtaniUS" "Turkish" "Turkish-QWERTY" "Turkish-QWERTY-PC" "Ukrainian" "UnicodeHexInput" "US" "USExtended" "Vietnamese" "VietnameseSimpleTelex" "VietnameseTelex" "VietnameseVIQR" "VietnameseVNI" "Welsh" ) ;;
2369 | 6 ) InputSourceIDs=( "AfghanDari" "AfghanPashto" "AfghanUzbek" "Arabic" "Arabic-QWERTY" "ArabicPC" "Armenian-HMQWERTY" "Armenian-WesternQWERTY" "Australian" "Austrian" "Azeri" "Belgian" "Brazilian" "British" "Bulgarian" "Bulgarian-Phonetic" "Byelorussian" "Canadian" "Canadian-CSA" "Cherokee-Nation" "Cherokee-QWERTY" "Croatian" "Croatian-PC" "Czech" "Czech-QWERTY" "Danish" "Devanagari" "Devanagari-QWERTY" "Dutch" "Dvorak" "Dvorak-Left" "DVORAK-QWERTYCMD" "Dvorak-Right" "Estonian" "Faroese" "Finnish" "FinnishExtended" "FinnishSami-PC" "French" "French-numerical" "German" "Greek" "GreekPolytonic" "Gujarati" "Gujarati-QWERTY" "Gurmukhi" "Gurmukhi-QWERTY" "Hawaiian" "Hebrew" "Hebrew-QWERTY" "Hungarian" "Icelandic" "Inuktitut-Nunavut" "Inuktitut-Nutaaq" "Inuktitut-QWERTY" "InuttitutNunavik" "Irish" "IrishExtended" "Italian" "Italian-Pro" "Japanese.Katakana" "Japanese.Roman" "Jawi-QWERTY" "Kazakh" "Korean.2SetKorean" "Korean.390Sebulshik" "Korean.3SetKorean" "Korean.GongjinCheongRomaja" "Korean.HNCRomaja" "Latvian" "Lithuanian" "Macedonian" "Maltese" "Maori" "Nepali" "NorthernSami" "Norwegian" "NorwegianExtended" "NorwegianSami-PC" "Persian" "Persian-ISIRI2901" "Persian-QWERTY" "Polish" "PolishPro" "Portuguese" "Romanian" "Romanian-Standard" "Russian" "Russian-Phonetic" "RussianWin" "Sami-PC" "SCIM.ITABC" "SCIM.WBH" "SCIM.WBX" "Serbian" "Serbian-Latin" "Slovak" "Slovak-QWERTY" "Slovenian" "Spanish" "Spanish-ISO" "Swedish" "Swedish-Pro" "SwedishSami-PC" "SwissFrench" "SwissGerman" "Tamil.AnjalIM" "Tamil.Tamil99" "TCIM.Cangjie" "TCIM.Dayi" "TCIM.Jianyi" "TCIM.Pinyin" "TCIM.Zhuyin" "Thai" "Thai-PattaChote" "Tibetan-QWERTY" "Tibetan-Wylie" "TibetanOtaniUS" "Turkish" "Turkish-QWERTY" "Turkish-QWERTY-PC" "Ukrainian" "UnicodeHexInput" "US" "USExtended" "USInternational-PC" "Uyghur-QWERTY" "Vietnamese" "VietnameseSimpleTelex" "VietnameseTelex" "VietnameseVIQR" "VietnameseVNI" "Welsh" ) ;;
2370 | 7 ) InputSourceIDs=( "AfghanDari" "AfghanPashto" "AfghanUzbek" "Arabic" "Arabic-QWERTY" "ArabicPC" "Armenian-HMQWERTY" "Armenian-WesternQWERTY" "Australian" "Austrian" "Azeri" "Bangla" "Bangla-QWERTY" "Belgian" "Brazilian" "British" "Bulgarian" "Bulgarian-Phonetic" "Byelorussian" "Canadian" "Canadian-CSA" "Cherokee-Nation" "Cherokee-QWERTY" "Colemak" "Croatian" "Croatian-PC" "Czech" "Czech-QWERTY" "Danish" "Devanagari" "Devanagari-QWERTY" "Dutch" "Dvorak" "Dvorak-Left" "DVORAK-QWERTYCMD" "Dvorak-Right" "Estonian" "Faroese" "Finnish" "FinnishExtended" "FinnishSami-PC" "French" "French-numerical" "German" "Greek" "GreekPolytonic" "Gujarati" "Gujarati-QWERTY" "Gurmukhi" "Gurmukhi-QWERTY" "Hawaiian" "Hebrew" "Hebrew-PC" "Hebrew-QWERTY" "Hungarian" "Icelandic" "Inuktitut-Nunavut" "Inuktitut-Nutaaq" "Inuktitut-QWERTY" "InuttitutNunavik" "Irish" "IrishExtended" "Italian" "Italian-Pro" "Japanese.Katakana" "Japanese.Roman" "Jawi-QWERTY" "Kannada" "Kannada-QWERTY" "Kazakh" "Khmer" "Korean.2SetKorean" "Korean.390Sebulshik" "Korean.3SetKorean" "Korean.GongjinCheongRomaja" "Korean.HNCRomaja" "Kurdish-Sorani" "Latvian" "Lithuanian" "Macedonian" "Malayalam" "Malayalam-QWERTY" "Maltese" "Maori" "Myanmar-QWERTY" "Nepali" "NorthernSami" "Norwegian" "NorwegianExtended" "NorwegianSami-PC" "Oriya" "Oriya-QWERTY" "Persian" "Persian-ISIRI2901" "Persian-QWERTY" "Polish" "PolishPro" "Portuguese" "Romanian" "Romanian-Standard" "Russian" "Russian-Phonetic" "RussianWin" "Sami-PC" "SCIM.ITABC" "SCIM.WBH" "SCIM.WBX" "Serbian" "Serbian-Latin" "Sinhala" "Sinhala-QWERTY" "Slovak" "Slovak-QWERTY" "Slovenian" "Spanish" "Spanish-ISO" "Swedish" "Swedish-Pro" "SwedishSami-PC" "SwissFrench" "SwissGerman" "Tamil.AnjalIM" "Tamil.Tamil99" "TCIM.Cangjie" "TCIM.Jianyi" "TCIM.Pinyin" "TCIM.Zhuyin" "Telugu" "Telugu-QWERTY" "Thai" "Thai-PattaChote" "Tibetan-QWERTY" "Tibetan-Wylie" "TibetanOtaniUS" "Turkish" "Turkish-QWERTY" "Turkish-QWERTY-PC" "Ukrainian" "UnicodeHexInput" "Urdu" "US" "USExtended" "USInternational-PC" "Uyghur-QWERTY" "Vietnamese" "VietnameseSimpleTelex" "VietnameseTelex" "VietnameseVIQR" "VietnameseVNI" "Welsh" ) ;;
2371 | * ) InputSourceIDs=( "AfghanDari" "AfghanPashto" "AfghanUzbek" "Arabic" "Arabic-QWERTY" "ArabicPC" "Armenian-HMQWERTY" "Armenian-WesternQWERTY" "Australian" "Austrian" "Azeri" "Bangla" "Bangla-QWERTY" "Belgian" "Brazilian" "British" "British-PC" "Bulgarian" "Bulgarian-Phonetic" "Byelorussian" "Canadian" "Canadian-CSA" "Cherokee-Nation" "Cherokee-QWERTY" "Colemak" "Croatian" "Croatian-PC" "Czech" "Czech-QWERTY" "Danish" "Devanagari" "Devanagari-QWERTY" "Dutch" "Dvorak" "Dvorak-Left" "DVORAK-QWERTYCMD" "Dvorak-Right" "Estonian" "Faroese" "Finnish" "FinnishExtended" "FinnishSami-PC" "French" "French-numerical" "Georgian-QWERTY" "German" "Greek" "GreekPolytonic" "Gujarati" "Gujarati-QWERTY" "Gurmukhi" "Gurmukhi-QWERTY" "Hawaiian" "Hebrew" "Hebrew-PC" "Hebrew-QWERTY" "Hungarian" "Icelandic" "Inuktitut-Nunavut" "Inuktitut-Nutaaq" "Inuktitut-QWERTY" "InuttitutNunavik" "Irish" "IrishExtended" "Italian" "Italian-Pro" "Japanese.Katakana" "Japanese.Roman" "Jawi-QWERTY" "Kannada" "Kannada-QWERTY" "Kazakh" "Khmer" "Korean.2SetKorean" "Korean.390Sebulshik" "Korean.3SetKorean" "Korean.GongjinCheongRomaja" "Korean.HNCRomaja" "Kurdish-Sorani" "Latvian" "Lithuanian" "Macedonian" "Malayalam" "Malayalam-QWERTY" "Maltese" "Maori" "Myanmar-QWERTY" "Nepali" "NorthernSami" "Norwegian" "NorwegianExtended" "NorwegianSami-PC" "Oriya" "Oriya-QWERTY" "Persian" "Persian-ISIRI2901" "Persian-QWERTY" "Polish" "PolishPro" "Portuguese" "Romanian" "Romanian-Standard" "Russian" "Russian-Phonetic" "RussianWin" "Sami-PC" "SCIM.ITABC" "SCIM.WBH" "SCIM.WBX" "Serbian" "Serbian-Latin" "Sinhala" "Sinhala-QWERTY" "Slovak" "Slovak-QWERTY" "Slovenian" "Spanish" "Spanish-ISO" "Swedish" "Swedish-Pro" "SwedishSami-PC" "SwissFrench" "SwissGerman" "Tamil.AnjalIM" "Tamil.Tamil99" "TCIM.Cangjie" "TCIM.Jianyi" "TCIM.Pinyin" "TCIM.Zhuyin" "TCIM.ZhuyinEten" "Telugu" "Telugu-QWERTY" "Thai" "Thai-PattaChote" "Tibetan-QWERTY" "Tibetan-Wylie" "TibetanOtaniUS" "Turkish" "Turkish-QWERTY" "Turkish-QWERTY-PC" "Ukrainian" "UnicodeHexInput" "Urdu" "US" "USExtended" "USInternational-PC" "Uyghur" "Vietnamese" "VietnameseSimpleTelex" "VietnameseTelex" "VietnameseVIQR" "VietnameseVNI" "Welsh" ) ;;
2372 | esac
2373 | }
2374 |
2375 | function refresh_Keyboard {
2376 | set_InputSourceIDs
2377 | j=0 ; for ID in "${InputSourceIDs[@]}" ; do if [ "${ID}" == "${InputSourceID}" ] ; then j=1 ; break ; fi ; done
2378 | if [ ${j} -eq 0 ] ; then InputSourceID="US" ; fi
2379 | set_SAKeyboard_SATypingStyle "${InputSourceID}"
2380 | }
2381 |
2382 | function set_AllKeyboards {
2383 | case ${TargetOSMinor} in
2384 | 5 ) AllKeyboards=( "Afghan Dari" "Afghan Pashto" "Afghan Uzbek" "Arabic" "Arabic - PC" "Arabic - QWERTY" "Armenian - HM QWERTY" "Armenian - Western QWERTY" "Australian" "Austrian" "Azeri" "Belgian" "Brazilian" "British" "Bulgarian" "Bulgarian - Phonetic" "Byelorussian" "Canadian English" "Canadian French - CSA" "Cherokee - Nation" "Cherokee - QWERTY" "Croatian" "Czech" "Czech - QWERTY" "Danish" "Devanagari" "Devanagari - QWERTY" "Dutch" "Dvorak" "Dvorak - Qwerty ⌘" "Estonian" "Faroese" "Finnish" "Finnish Extended" "Finnish Sami - PC" "French" "French - Numerical" "German" "Greek" "Greek Polytonic" "Gujarati" "Gujarati - QWERTY" "Gurmukhi" "Gurmukhi - QWERTY" "Hangul" "Hawaiian" "Hebrew" "Hebrew - QWERTY" "Hungarian" "Icelandic" "Inuktitut - Nunavut" "Inuktitut - Nutaaq" "Inuktitut - QWERTY" "Inuttitut Nunavik" "Irish" "Irish Extended" "Italian" "Italian - Pro" "Jawi - QWERTY" "Kazakh" "Kotoeri" "Latvian" "Lithuanian" "Macedonian" "Maltese" "Maori" "Nepali" "Northern Sami" "Norwegian" "Norwegian Extended" "Norwegian Sami - PC" "Persian" "Persian - ISIRI 2901" "Persian - QWERTY" "Polish" "Polish Pro" "Portuguese" "Romanian" "Romanian - Standard" "Russian" "Russian - PC" "Russian - Phonetic" "Sami - PC" "Serbian" "Serbian - Latin" "Simplified Chinese" "Slovak" "Slovak - QWERTY" "Slovenian" "Spanish" "Spanish - ISO" "Swedish" "Swedish - Pro" "Swedish Sami - PC" "Swiss French" "Swiss German" "Tamil Input Method" "Thai" "Thai - PattaChote" "Tibetan - Otani" "Tibetan - QWERTY" "Tibetan - Wylie" "Traditional Chinese" "Turkish" "Turkish - QWERTY" "Turkish - QWERTY PC" "U.S." "U.S. Extended" "Ukrainian" "Unicode Hex Input" "Vietnamese" "Vietnamese UniKey" "Welsh" ) ;;
2385 | 6 ) AllKeyboards=( "Afghan Dari" "Afghan Pashto" "Afghan Uzbek" "Arabic" "Arabic - PC" "Arabic - QWERTY" "Armenian - HM QWERTY" "Armenian - Western QWERTY" "Australian" "Austrian" "Azeri" "Belgian" "Brazilian" "British" "Bulgarian" "Bulgarian - Phonetic" "Byelorussian" "Canadian English" "Canadian French - CSA" "Cherokee - Nation" "Cherokee - QWERTY" "Chinese - Simplified" "Chinese - Traditional" "Croatian" "Croatian - PC" "Czech" "Czech - QWERTY" "Danish" "Devanagari" "Devanagari - QWERTY" "Dutch" "Dvorak" "Dvorak - Left" "Dvorak - Qwerty ⌘" "Dvorak - Right" "Estonian" "Faroese" "Finnish" "Finnish Extended" "Finnish Sami - PC" "French" "French - Numerical" "German" "Greek" "Greek Polytonic" "Gujarati" "Gujarati - QWERTY" "Gurmukhi" "Gurmukhi - QWERTY" "Hangul" "Hawaiian" "Hebrew" "Hebrew - QWERTY" "Hungarian" "Icelandic" "Inuktitut - Nunavut" "Inuktitut - Nutaaq" "Inuktitut - QWERTY" "Inuttitut Nunavik" "Irish" "Irish Extended" "Italian" "Italian - Pro" "Jawi - QWERTY" "Kazakh" "Kotoeri" "Latvian" "Lithuanian" "Macedonian" "Maltese" "Maori" "Nepali" "Northern Sami" "Norwegian" "Norwegian Extended" "Norwegian Sami - PC" "Persian" "Persian - ISIRI 2901" "Persian - QWERTY" "Polish" "Polish Pro" "Portuguese" "Romanian" "Romanian - Standard" "Russian" "Russian - PC" "Russian - Phonetic" "Sami - PC" "Serbian" "Serbian - Latin" "Slovak" "Slovak - QWERTY" "Slovenian" "Spanish" "Spanish - ISO" "Swedish" "Swedish - Pro" "Swedish Sami - PC" "Swiss French" "Swiss German" "Tamil Input Method" "Thai" "Thai - PattaChote" "Tibetan - Otani" "Tibetan - QWERTY" "Tibetan - Wylie" "Turkish" "Turkish - QWERTY" "Turkish - QWERTY PC" "U.S." "U.S. Extended" "U.S. International - PC" "Ukrainian" "Unicode Hex Input" "Uyghur - QWERTY" "Vietnamese" "Vietnamese UniKey" "Welsh" ) ;;
2386 | 7 ) AllKeyboards=( "Afghan Dari" "Afghan Pashto" "Afghan Uzbek" "Arabic" "Arabic - PC" "Arabic - QWERTY" "Armenian - HM QWERTY" "Armenian - Western QWERTY" "Australian" "Austrian" "Azeri" "Bangla" "Bangla - Qwerty" "Belgian" "Brazilian" "British" "Bulgarian" "Bulgarian - Phonetic" "Byelorussian" "Canadian English" "Canadian French - CSA" "Cherokee - Nation" "Cherokee - QWERTY" "Chinese - Simplified" "Chinese - Traditional" "Colemak" "Croatian" "Croatian - PC" "Czech" "Czech - QWERTY" "Danish" "Devanagari" "Devanagari - QWERTY" "Dutch" "Dvorak" "Dvorak - Left" "Dvorak - Qwerty ⌘" "Dvorak - Right" "Estonian" "Faroese" "Finnish" "Finnish Extended" "Finnish Sami - PC" "French" "French - Numerical" "German" "Greek" "Greek Polytonic" "Gujarati" "Gujarati - QWERTY" "Gurmukhi" "Gurmukhi - QWERTY" "Hangul" "Hawaiian" "Hebrew" "Hebrew - PC" "Hebrew - QWERTY" "Hungarian" "Icelandic" "Inuktitut - Nunavut" "Inuktitut - Nutaaq" "Inuktitut - QWERTY" "Inuttitut Nunavik" "Irish" "Irish Extended" "Italian" "Italian Typewriter" "Jawi - QWERTY" "Kannada" "Kannada - QWERTY" "Kazakh" "Khmer" "Kotoeri" "Kurdish-Sorani" "Latvian" "Lithuanian" "Macedonian" "Malayalam" "Malayalam - QWERTY" "Maltese" "Maori" "Myanmar - QWERTY" "Nepali" "Northern Sami" "Norwegian" "Norwegian Extended" "Norwegian Sami - PC" "Oriya" "Oriya - QWERTY" "Persian" "Persian - ISIRI 2901" "Persian - QWERTY" "Polish" "Polish Pro" "Portuguese" "Romanian" "Romanian - Standard" "Russian" "Russian - PC" "Russian - Phonetic" "Sami - PC" "Serbian" "Serbian - Latin" "Sinhala" "Sinhala - QWERTY" "Slovak" "Slovak - QWERTY" "Slovenian" "Spanish" "Spanish - ISO" "Swedish" "Swedish - Pro" "Swedish Sami - PC" "Swiss French" "Swiss German" "Tamil Input Method" "Telugu" "Telugu - QWERTY" "Thai" "Thai - PattaChote" "Tibetan - Otani" "Tibetan - QWERTY" "Tibetan - Wylie" "Turkish" "Turkish - QWERTY" "Turkish - QWERTY PC" "U.S." "U.S. Extended" "U.S. International - PC" "Ukrainian" "Unicode Hex Input" "Urdu" "Uyghur - QWERTY" "Vietnamese" "Vietnamese UniKey" "Welsh" ) ;;
2387 | * ) AllKeyboards=( "Afghan Dari" "Afghan Pashto" "Afghan Uzbek" "Arabic" "Arabic - PC" "Arabic - QWERTY" "Armenian - HM QWERTY" "Armenian - Western QWERTY" "Australian" "Austrian" "Azeri" "Bangla" "Bangla - Qwerty" "Belgian" "Brazilian" "British" "British - PC" "Bulgarian" "Bulgarian - Phonetic" "Byelorussian" "Canadian English" "Canadian French - CSA" "Cherokee - Nation" "Cherokee - QWERTY" "Chinese - Simplified" "Chinese - Traditional" "Colemak" "Croatian" "Croatian - PC" "Czech" "Czech - QWERTY" "Danish" "Devanagari" "Devanagari - QWERTY" "Dutch" "Dvorak" "Dvorak - Left" "Dvorak - Qwerty ⌘" "Dvorak - Right" "Estonian" "Faroese" "Finnish" "Finnish Extended" "Finnish Sami - PC" "French" "French - Numerical" "Georgian - QWERTY" "German" "Greek" "Greek Polytonic" "Gujarati" "Gujarati - QWERTY" "Gurmukhi" "Gurmukhi - QWERTY" "Hangul" "Hawaiian" "Hebrew" "Hebrew - PC" "Hebrew - QWERTY" "Hungarian" "Icelandic" "Inuktitut - Nunavut" "Inuktitut - Nutaaq" "Inuktitut - QWERTY" "Inuttitut Nunavik" "Irish" "Irish Extended" "Italian" "Italian Typewriter" "Jawi - QWERTY" "Kannada" "Kannada - QWERTY" "Kazakh" "Khmer" "Kotoeri" "Kurdish-Sorani" "Latvian" "Lithuanian" "Macedonian" "Malayalam" "Malayalam - QWERTY" "Maltese" "Maori" "Myanmar - QWERTY" "Nepali" "Northern Sami" "Norwegian" "Norwegian Extended" "Norwegian Sami - PC" "Oriya" "Oriya - QWERTY" "Persian" "Persian - ISIRI" "Persian - QWERTY" "Polish" "Polish Pro" "Portuguese" "Romanian" "Romanian - Standard" "Russian" "Russian - PC" "Russian - Phonetic" "Sami - PC" "Serbian" "Serbian - Latin" "Sinhala" "Sinhala - QWERTY" "Slovak" "Slovak - QWERTY" "Slovenian" "Spanish" "Spanish - ISO" "Swedish" "Swedish - Pro" "Swedish Sami - PC" "Swiss French" "Swiss German" "Tamil Input Method" "Telugu" "Telugu - QWERTY" "Thai" "Thai - PattaChote" "Tibetan - Otani" "Tibetan - QWERTY" "Tibetan - Wylie" "Turkish" "Turkish - QWERTY" "Turkish - QWERTY PC" "U.S." "U.S. Extended" "U.S. International - PC" "Ukrainian" "Unicode Hex Input" "Urdu" "Uyghur" "Vietnamese" "Vietnamese UniKey" "Welsh" ) ;;
2388 | esac
2389 | }
2390 |
2391 | function set_TypingStyles {
2392 | # ${1}: Keyboard
2393 | case "${1}" in
2394 | "Chinese - Simplified" ) TypingStyles=( "Pinyin - Simplified" "Wubi Hua" "Wubi Xing" ) ;;
2395 | "Chinese - Traditional" )
2396 | case ${TargetOSMinor} in
2397 | 6 ) TypingStyles=( "Zhuyin" "Cangjie" "Dayi Pro" "Jianyi" "Pinyin - Traditional" ) ;;
2398 | 7 ) TypingStyles=( "Zhuyin" "Cangjie" "Jianyi" "Pinyin - Traditional" ) ;;
2399 | * ) TypingStyles=( "Zhuyin" "Cangjie" "Zhuyin - Eten" "Sucheng" "Pinyin - Traditional" ) ;;
2400 | esac ;;
2401 | "Hangul" ) TypingStyles=( "3-Set Korean" "2-Set Korean" "HNC Romaja" "390 Sebulshik" "GongjinCheong Romaja" ) ;;
2402 | "Kotoeri" ) TypingStyles=( "Romaji" "Kana" ) ;;
2403 | "Simplified Chinese" ) TypingStyles=( "ITABC" "Wubi Hua" "Wubi Xing" ) ;;
2404 | "Tamil Input Method" ) TypingStyles=( "Anjal" "Tamil99" ) ;;
2405 | "Traditional Chinese" ) TypingStyles=( "Zhuyin" "Pinyin" "Cangjie" "Jianyi" "Dayi(Pro)" "Hanin" ) ;;
2406 | "Vietnamese UniKey" ) TypingStyles=( "Simple Telex" "VNI" "VIQR" "Telex" ) ;;
2407 | * ) unset TypingStyles[@] ;;
2408 | esac
2409 | }
2410 |
2411 | function set_CurrentKeyboards {
2412 | # ${1}: Language Code
2413 | # ${2}: Country Code
2414 | unset DefaultKeyboard
2415 | unset LanguageKeyboards[@]
2416 | unset CountryKeyboards[@]
2417 | if [ ${TargetOSMinor} -lt 8 ] ; then DefaultKeyboard="U.S." ; fi
2418 | case "${1}" in
2419 | "en" ) LanguageKeyboards=( "U.S." ) ;;
2420 | "ja" ) LanguageKeyboards=( "Kotoeri" ) ;;
2421 | "fr" ) LanguageKeyboards=( "French" "French - Numerical" ) ;;
2422 | "de" ) LanguageKeyboards=( "German" ) ;;
2423 | "es" ) LanguageKeyboards=( "Spanish - ISO" "Spanish" ) ;;
2424 | "it" )
2425 | case ${TargetOSMinor} in
2426 | 5 | 6 ) LanguageKeyboards=( "Italian - Pro" ) ;;
2427 | * ) LanguageKeyboards=( "Italian" ) ;;
2428 | esac ;;
2429 | "pt" ) LanguageKeyboards=( "Portuguese" "Brazilian" ) ;;
2430 | "pt-PT" )
2431 | case ${TargetOSMinor} in
2432 | 6 | 7 | 8 ) LanguageKeyboards=( "Portuguese" "Brazilian" ) ;;
2433 | esac ;;
2434 | "nl" ) LanguageKeyboards=( "Dutch" "Belgian" ) ;;
2435 | "sv" ) LanguageKeyboards=( "Swedish - Pro" ) ;;
2436 | "nb" ) LanguageKeyboards=( "Norwegian" ) ;;
2437 | "da" ) LanguageKeyboards=( "Danish" ) ;;
2438 | "fi" ) LanguageKeyboards=( "Finnish" ) ;;
2439 | "ru" ) LanguageKeyboards=( "Russian" "Russian - Phonetic" ) ;;
2440 | "pl" ) LanguageKeyboards=( "Polish Pro" "Polish" ) ;;
2441 | "zh-Hans" )
2442 | case ${TargetOSMinor} in
2443 | 5 ) LanguageKeyboards=( "Simplified Chinese" ) ;;
2444 | * ) LanguageKeyboards=( "Chinese - Simplified" ) ;;
2445 | esac ;;
2446 | "zh-Hant" )
2447 | case ${TargetOSMinor} in
2448 | 5 ) LanguageKeyboards=( "Traditional Chinese" ) ;;
2449 | * ) LanguageKeyboards=( "Chinese - Traditional" ) ;;
2450 | esac ;;
2451 | "ko" ) LanguageKeyboards=( "Hangul" ) ;;
2452 | "ar" )
2453 | case ${TargetOSMinor} in
2454 | 8 ) LanguageKeyboards=( "Arabic" "Arabic - PC" "Arabic - QWERTY" ) ;;
2455 | esac ;;
2456 | "el" )
2457 | case ${TargetOSMinor} in
2458 | 8 ) LanguageKeyboards=( "U.S." "Greek" "Greek Polytonic" ) ;;
2459 | esac ;;
2460 | esac
2461 | case "${2}" in
2462 | "AE" ) CountryKeyboards=( "Arabic" "Arabic - PC" "Arabic - QWERTY" ) ;;
2463 | "AF" ) CountryKeyboards=( "Afghan Pashto" "Afghan Dari" "Afghan Uzbek " ) ;;
2464 | "AM" ) CountryKeyboards=( "Armenian - HM QWERTY" "Armenian - Western QWERTY" ) ;;
2465 | "AT" ) CountryKeyboards=( "Austrian" ) ;;
2466 | "AU" ) CountryKeyboards=( "Australian" ) ;;
2467 | "AZ" ) CountryKeyboards=( "Azeri" ) ;;
2468 | "BE" ) CountryKeyboards=( "Belgian" "French" ) ;;
2469 | "BG" ) CountryKeyboards=( "Bulgarian" "Bulgarian - Phonetic" ) ;;
2470 | "BR" )
2471 | case ${TargetOSMinor} in
2472 | 5 ) CountryKeyboards=( "Brazilian" ) ;;
2473 | * ) CountryKeyboards=( "Brazilian" "U.S. International - PC" ) ;;
2474 | esac ;;
2475 | "BY" ) CountryKeyboards=( "Byelorussian" ) ;;
2476 | "CA" ) CountryKeyboards=( "Canadian English" "Canadian French - CSA" ) ;;
2477 | "CN" )
2478 | case ${TargetOSMinor} in
2479 | 5 ) CountryKeyboards=( "Simplified Chinese" ) ;;
2480 | * ) CountryKeyboards=( "Chinese - Simplified" ) ;;
2481 | esac ;;
2482 | "CY" )
2483 | case ${TargetOSMinor} in
2484 | 8 ) CountryKeyboards=( "U.S." "Greek" "Greek Polytonic" ) ;;
2485 | esac ;;
2486 | "CZ" ) CountryKeyboards=( "Czech - QWERTY" "Czech" ) ;;
2487 | "DE" ) CountryKeyboards=( "German" ) ;;
2488 | "DK" ) CountryKeyboards=( "Danish" ) ;;
2489 | "EE" ) CountryKeyboards=( "Estonian" ) ;;
2490 | "EG" ) CountryKeyboards=( "Arabic" "Arabic - PC" "Arabic - QWERTY" ) ;;
2491 | "ES" ) CountryKeyboards=( "Spanish - ISO" "Spanish" ) ;;
2492 | "FI" ) CountryKeyboards=( "Finnish" ) ;;
2493 | "FO" ) CountryKeyboards=( "Faroese" ) ;;
2494 | "FR" ) CountryKeyboards=( "French" "French - Numerical" ) ;;
2495 | "GB" ) CountryKeyboards=( "British" ) ;;
2496 | "GR" ) CountryKeyboards=( "U.S." "Greek" "Greek Polytonic" ) ;;
2497 | "HR" ) CountryKeyboards=( "Croatian" ) ;;
2498 | "HU" ) CountryKeyboards=( "Hungarian" ) ;;
2499 | "IE" ) CountryKeyboards=( "British" "Irish" ) ;;
2500 | "IL" ) CountryKeyboards=( "Hebrew" "Hebrew - QWERTY" ) ;;
2501 | "IN" ) CountryKeyboards=( "Devanagari" "Devanagari - QWERTY" "Gurmukhi" "Gurmukhi -QWERTY" "Gujarati" "Gujarati - QWERTY" ) ;;
2502 | "IS" ) CountryKeyboards=( "Icelandic" ) ;;
2503 | "IT" )
2504 | case ${TargetOSMinor} in
2505 | 5 | 6 ) CountryKeyboards=( "Italian - Pro" ) ;;
2506 | * ) CountryKeyboards=( "Italian" ) ;;
2507 | esac ;;
2508 | "JP" ) CountryKeyboards=( "Kotoeri" ) ;;
2509 | "KR" ) CountryKeyboards=( "Hangul" ) ;;
2510 | "KZ" ) CountryKeyboards=( "Kazakh" ) ;;
2511 | "LB" ) CountryKeyboards=( "Arabic" "Arabic - PC" "Arabic - QWERTY" ) ;;
2512 | "LT" ) CountryKeyboards=( "Lithuanian" ) ;;
2513 | "LV" ) CountryKeyboards=( "Latvian" ) ;;
2514 | "MK" ) CountryKeyboards=( "Macedonian" ) ;;
2515 | "MT" ) CountryKeyboards=( "Maltese" ) ;;
2516 | "NL" ) CountryKeyboards=( "Dutch" ) ;;
2517 | "NO" ) CountryKeyboards=( "Norwegian" ) ;;
2518 | "NP" ) CountryKeyboards=( "Nepali" ) ;;
2519 | "NZ" ) CountryKeyboards=( "Australian" ) ;;
2520 | "PL" ) CountryKeyboards=( "Polish Pro" "Polish" ) ;;
2521 | "PT" ) CountryKeyboards=( "Portuguese" "Brazilian" ) ;;
2522 | "RO" ) CountryKeyboards=( "Romanian - Standard" "Romanian" ) ;;
2523 | "RS" ) CountryKeyboards=( "Serbian" "Serbian - Latin" ) ;;
2524 | "RU" ) CountryKeyboards=( "Russian" "Russian - Phonetic" ) ;;
2525 | "SA" ) CountryKeyboards=( "Arabic" "Arabic - PC" "Arabic - QWERTY" ) ;;
2526 | "SE" ) CountryKeyboards=( "Swedish - Pro" ) ;;
2527 | "SG" )
2528 | case ${TargetOSMinor} in
2529 | 5 ) CountryKeyboards=( "Simplified Chinese" ) ;;
2530 | * ) CountryKeyboards=( "Chinese - Simplified" ) ;;
2531 | esac ;;
2532 | "SI" ) CountryKeyboards=( "Slovenian" ) ;;
2533 | "SK" ) CountryKeyboards=( "Slovak" "Slovak - QWERTY" ) ;;
2534 | "TH" ) CountryKeyboards=( "Thai" "Thai - PattaChote" ) ;;
2535 | "TR" ) CountryKeyboards=( "Turkish" "Turkish - QWERTY" "Turkish - QWERTY PC" ) ;;
2536 | "TW" )
2537 | case ${TargetOSMinor} in
2538 | 5 ) CountryKeyboards=( "Traditional Chinese" ) ;;
2539 | * ) CountryKeyboards=( "Chinese - Traditional" ) ;;
2540 | esac ;;
2541 | "UA" )
2542 | case ${TargetOSMinor} in
2543 | 5 | 6 ) CountryKeyboards=( "Ukrainian" ) ;;
2544 | * ) CountryKeyboards=( "Ukrainian" "Russian" "Russian - Phonetic" ) ;;
2545 | esac ;;
2546 | "US" ) CountryKeyboards=( "U.S." "Canadian English" ) ;;
2547 | "VN" ) CountryKeyboards=( "Vietnamese" ) ;;
2548 | esac
2549 | case "${1}-${2}" in
2550 | "en-US" ) unset LanguageKeyboards[@] ;;
2551 | "en-CA" ) unset LanguageKeyboards[@] ;;
2552 | "en-GB" ) unset LanguageKeyboards[@] ;;
2553 | "en-AU" ) unset LanguageKeyboards[@] ;;
2554 | "en-NZ" ) unset LanguageKeyboards[@] ;;
2555 | "en-IE" ) unset LanguageKeyboards[@] ;;
2556 | "fr-BE" ) unset LanguageKeyboards[@] ;;
2557 | "fr-CA" ) unset LanguageKeyboards[@] ;;
2558 | "fr-CH" ) unset LanguageKeyboards[@] ; CountryKeyboards=( "Swiss French" ) ;;
2559 | "de-AT" ) unset LanguageKeyboards[@] ;;
2560 | "de-CH" ) unset LanguageKeyboards[@] ; CountryKeyboards=( "Swiss German" ) ;;
2561 | "pt-BR" ) unset LanguageKeyboards[@] ;;
2562 | "nl-BE" ) unset LanguageKeyboards[@] ;;
2563 | "nl-NL" ) unset LanguageKeyboards[@] ;;
2564 | "ru-BY" ) unset LanguageKeyboards[@] ;;
2565 | "ru-EE" ) unset LanguageKeyboards[@] ;;
2566 | "ru-KZ" ) unset LanguageKeyboards[@] ;;
2567 | "ru-LV" ) unset LanguageKeyboards[@] ;;
2568 | "ru-UA" ) unset LanguageKeyboards[@] ;;
2569 | esac
2570 | case ${TargetOSMinor} in
2571 | 5 )
2572 | case "${1}-${2}" in
2573 | "fr-LU" ) unset LanguageKeyboards[@] ;;
2574 | "de-LU" ) unset LanguageKeyboards[@] ;;
2575 | "ru-KG" ) unset LanguageKeyboards[@] ;;
2576 | "ru-SJ" ) unset LanguageKeyboards[@] ;;
2577 | "ru-TJ" ) unset LanguageKeyboards[@] ;;
2578 | "ru-UZ" ) unset LanguageKeyboards[@] ;;
2579 | esac ;;
2580 | 7 | 8 )
2581 | case "${1}-${2}" in
2582 | "ru-LT" ) unset LanguageKeyboards[@] ;;
2583 | esac ;;
2584 | esac
2585 | if [ ${TargetOSMinor} -gt 5 ] ; then
2586 | if [ "${1}" == "pt-PT" ] ; then unset CountryKeyboards[@] ; fi
2587 | if [ "${1}" == "zh-Hans" ] || [ "${1}" == "zh-Hant" ] ; then
2588 | if [ ${#CountryKeyboards[@]} -gt 0 ] ; then unset LanguageKeyboards[@] ; fi
2589 | fi
2590 | fi
2591 | i=0 ; for LanguageKeyboard in "${LanguageKeyboards[@]}" ; do
2592 | if [ "${LanguageKeyboard}" == "${DefaultKeyboard}" ] ; then unset LanguageKeyboards[i] ; break ; fi
2593 | let i++
2594 | done
2595 | i=0 ; for CountryKeyboard in "${CountryKeyboards[@]}" ; do
2596 | if [ "${CountryKeyboard}" == "${DefaultKeyboard}" ] ; then unset CountryKeyboards[i] ; break ; fi
2597 | let i++
2598 | done
2599 | i=0 ; for CountryKeyboard in "${CountryKeyboards[@]}" ; do
2600 | for LanguageKeyboard in "${LanguageKeyboards[@]}" ; do
2601 | if [ "${LanguageKeyboard}" == "${CountryKeyboard}" ] ; then unset CountryKeyboards[i] ; fi
2602 | done
2603 | let i++
2604 | done
2605 | if [ -n "${DefaultKeyboard}" ] ; then
2606 | CurrentKeyboards=( "${DefaultKeyboard}" "${LanguageKeyboards[@]}" "${CountryKeyboards[@]}" )
2607 | else
2608 | CurrentKeyboards=( "${LanguageKeyboards[@]}" "${CountryKeyboards[@]}" )
2609 | fi
2610 | i=0 ; for CurrentKeyboard in "${CurrentKeyboards[@]}" ; do
2611 | if [ "${CurrentKeyboard}" == "U.S." ] ; then unset CurrentKeyboards[i] ; CurrentKeyboards=( "U.S." "${CurrentKeyboards[@]}" ) ; break ; fi
2612 | let i++
2613 | done
2614 | }
2615 |
2616 | function set_OtherKeyboards {
2617 | unset OtherKeyboards[@]
2618 | for Keyboard in "${AllKeyboards[@]}" ; do
2619 | j=0 ; for CurrentKeyboard in "${CurrentKeyboards[@]}" ; do
2620 | if [ "${Keyboard}" == "${CurrentKeyboard}" ] ; then j=1 ; break ; fi
2621 | done
2622 | if [ ${j} -eq 0 ] ; then OtherKeyboards=( "${OtherKeyboards[@]}" "${Keyboard}" ) ; fi
2623 | done
2624 | }
2625 |
2626 | function set_Bundle_IDs {
2627 | # ${1}: Typing Style
2628 | unset Bundle_IDs[@]
2629 | case "${1}" in
2630 | "2-Set Korean" ) Bundle_IDs[1]="com.apple.inputmethod.Korean" ; Bundle_IDs[2]="com.apple.inputmethod.Korean" ; Bundle_IDs[3]="com.apple.inputmethod.Korean" ; Bundle_IDs[4]="com.apple.inputmethod.Korean" ; Bundle_IDs[5]="com.apple.inputmethod.Korean" ; Bundle_IDs[6]="com.apple.inputmethod.Korean" ;;
2631 | "3-Set Korean" ) Bundle_IDs[1]="com.apple.inputmethod.Korean" ; Bundle_IDs[2]="com.apple.inputmethod.Korean" ; Bundle_IDs[3]="com.apple.inputmethod.Korean" ; Bundle_IDs[4]="com.apple.inputmethod.Korean" ; Bundle_IDs[5]="com.apple.inputmethod.Korean" ; Bundle_IDs[6]="com.apple.inputmethod.Korean" ;;
2632 | "390 Sebulshik" ) Bundle_IDs[1]="com.apple.inputmethod.Korean" ; Bundle_IDs[2]="com.apple.inputmethod.Korean" ; Bundle_IDs[3]="com.apple.inputmethod.Korean" ; Bundle_IDs[4]="com.apple.inputmethod.Korean" ; Bundle_IDs[5]="com.apple.inputmethod.Korean" ; Bundle_IDs[6]="com.apple.inputmethod.Korean" ;;
2633 | "GongjinCheong Romaja" ) Bundle_IDs[1]="com.apple.inputmethod.Korean" ; Bundle_IDs[2]="com.apple.inputmethod.Korean" ; Bundle_IDs[3]="com.apple.inputmethod.Korean" ; Bundle_IDs[4]="com.apple.inputmethod.Korean" ; Bundle_IDs[5]="com.apple.inputmethod.Korean" ; Bundle_IDs[6]="com.apple.inputmethod.Korean" ;;
2634 | "HNC Romaja" ) Bundle_IDs[1]="com.apple.inputmethod.Korean" ; Bundle_IDs[2]="com.apple.inputmethod.Korean" ; Bundle_IDs[3]="com.apple.inputmethod.Korean" ; Bundle_IDs[4]="com.apple.inputmethod.Korean" ; Bundle_IDs[5]="com.apple.inputmethod.Korean" ; Bundle_IDs[6]="com.apple.inputmethod.Korean" ;;
2635 | "Kana" )
2636 | case ${TargetOSMinor} in
2637 | 5 ) Bundle_IDs[0]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[1]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[2]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[3]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[4]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[5]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[6]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[7]="com.apple.CharacterPaletteIM" ; Bundle_IDs[8]="com.apple.50onPaletteIM" ;;
2638 | * ) Bundle_IDs[0]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[1]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[2]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[3]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[4]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[5]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[6]="com.apple.inputmethod.Kotoeri" ;;
2639 | esac ;;
2640 | "Romaji" )
2641 | case ${TargetOSMinor} in
2642 | 5 ) Bundle_IDs[0]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[1]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[2]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[3]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[4]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[5]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[6]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[7]="com.apple.CharacterPaletteIM" ; Bundle_IDs[8]="com.apple.50onPaletteIM" ;;
2643 | * ) Bundle_IDs[0]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[1]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[2]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[3]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[4]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[5]="com.apple.inputmethod.Kotoeri" ; Bundle_IDs[6]="com.apple.inputmethod.Kotoeri" ;;
2644 | esac ;;
2645 | "ITABC" ) Bundle_IDs[1]="com.apple.inputmethod.SCIM" ; Bundle_IDs[2]="com.apple.inputmethod.SCIM" ; Bundle_IDs[3]="com.apple.inputmethod.SCIM" ; Bundle_IDs[4]="com.apple.inputmethod.SCIM" ;;
2646 | "Pinyin - Simplified" ) Bundle_IDs[1]="com.apple.inputmethod.SCIM" ; Bundle_IDs[2]="com.apple.inputmethod.SCIM" ; Bundle_IDs[3]="com.apple.inputmethod.SCIM" ; Bundle_IDs[4]="com.apple.inputmethod.SCIM" ; Bundle_IDs[5]="com.apple.inputmethod.ChineseHandwriting" ;;
2647 | "Wubi Hua" )
2648 | case ${TargetOSMinor} in
2649 | 5 ) Bundle_IDs[1]="com.apple.inputmethod.SCIM" ; Bundle_IDs[2]="com.apple.inputmethod.SCIM" ; Bundle_IDs[3]="com.apple.inputmethod.SCIM" ; Bundle_IDs[4]="com.apple.inputmethod.SCIM" ;;
2650 | * ) Bundle_IDs[1]="com.apple.inputmethod.SCIM" ; Bundle_IDs[2]="com.apple.inputmethod.SCIM" ; Bundle_IDs[3]="com.apple.inputmethod.SCIM" ; Bundle_IDs[4]="com.apple.inputmethod.SCIM" ; Bundle_IDs[5]="com.apple.inputmethod.ChineseHandwriting" ;;
2651 | esac ;;
2652 | "Wubi Xing" )
2653 | case ${TargetOSMinor} in
2654 | 5 ) Bundle_IDs[1]="com.apple.inputmethod.SCIM" ; Bundle_IDs[2]="com.apple.inputmethod.SCIM" ; Bundle_IDs[3]="com.apple.inputmethod.SCIM" ; Bundle_IDs[4]="com.apple.inputmethod.SCIM" ;;
2655 | * ) Bundle_IDs[1]="com.apple.inputmethod.SCIM" ; Bundle_IDs[2]="com.apple.inputmethod.SCIM" ; Bundle_IDs[3]="com.apple.inputmethod.SCIM" ; Bundle_IDs[4]="com.apple.inputmethod.SCIM" ; Bundle_IDs[5]="com.apple.inputmethod.ChineseHandwriting" ;;
2656 | esac ;;
2657 | "Anjal" ) Bundle_IDs[1]="com.apple.inputmethod.Tamil" ; Bundle_IDs[2]="com.apple.inputmethod.Tamil" ; Bundle_IDs[3]="com.apple.inputmethod.Tamil" ;;
2658 | "Tamil99" ) Bundle_IDs[1]="com.apple.inputmethod.Tamil" ; Bundle_IDs[2]="com.apple.inputmethod.Tamil" ; Bundle_IDs[3]="com.apple.inputmethod.Tamil" ;;
2659 | "Cangjie" )
2660 | case ${TargetOSMinor} in
2661 | 5 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ;;
2662 | 6 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.ChineseHandwriting" ;;
2663 | 7 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.ChineseHandwriting" ;;
2664 | 8 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.ChineseHandwriting" ;;
2665 | esac ;;
2666 | "Dayi Pro" ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.ChineseHandwriting" ;;
2667 | "Dayi(Pro)" ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ;;
2668 | "Hanin" ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.TCIM" ;;
2669 | "Jianyi" )
2670 | case ${TargetOSMinor} in
2671 | 5 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ;;
2672 | 6 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.ChineseHandwriting" ;;
2673 | 7 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.ChineseHandwriting" ;;
2674 | esac ;;
2675 | "Pinyin" ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ;;
2676 | "Pinyin - Traditional" )
2677 | case ${TargetOSMinor} in
2678 | 6 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.ChineseHandwriting" ;;
2679 | 7 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.ChineseHandwriting" ;;
2680 | 8 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.ChineseHandwriting" ;;
2681 | esac ;;
2682 | "Sucheng" ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.ChineseHandwriting" ;;
2683 | "Zhuyin" )
2684 | case ${TargetOSMinor} in
2685 | 5 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ;;
2686 | 6 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.ChineseHandwriting" ;;
2687 | 7 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.ChineseHandwriting" ;;
2688 | 8 ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.ChineseHandwriting" ;;
2689 | esac ;;
2690 | "Zhuyin - Eten" ) Bundle_IDs[1]="com.apple.inputmethod.TCIM" ; Bundle_IDs[2]="com.apple.inputmethod.TCIM" ; Bundle_IDs[3]="com.apple.inputmethod.TCIM" ; Bundle_IDs[4]="com.apple.inputmethod.TCIM" ; Bundle_IDs[5]="com.apple.inputmethod.TCIM" ; Bundle_IDs[6]="com.apple.inputmethod.TCIM" ; Bundle_IDs[7]="com.apple.inputmethod.ChineseHandwriting" ;;
2691 | "Simple Telex" ) Bundle_IDs[0]="com.apple.inputmethod.VietnameseIM" ; Bundle_IDs[1]="com.apple.inputmethod.VietnameseIM" ;;
2692 | "Telex" ) Bundle_IDs[0]="com.apple.inputmethod.VietnameseIM" ; Bundle_IDs[1]="com.apple.inputmethod.VietnameseIM" ; Bundle_IDs[2]="com.apple.inputmethod.VietnameseIM" ;;
2693 | "VIQR" ) Bundle_IDs[0]="com.apple.inputmethod.VietnameseIM" ; Bundle_IDs[1]="com.apple.inputmethod.VietnameseIM" ; Bundle_IDs[2]="com.apple.inputmethod.VietnameseIM" ;;
2694 | "VNI" ) Bundle_IDs[0]="com.apple.inputmethod.VietnameseIM" ; Bundle_IDs[1]="com.apple.inputmethod.VietnameseIM" ; Bundle_IDs[2]="com.apple.inputmethod.VietnameseIM" ;;
2695 | esac
2696 | }
2697 |
2698 | function set_Input_Modes {
2699 | # ${1}: Typing Style
2700 | unset Input_Modes[@]
2701 | case "${1}" in
2702 | "2-Set Korean" ) Input_Modes[1]="com.apple.inputmethod.Korean.3SetKorean" ; Input_Modes[2]="com.apple.inputmethod.Korean.2SetKorean" ; Input_Modes[3]="com.apple.inputmethod.Korean.HNCRomaja" ; Input_Modes[4]="com.apple.inputmethod.Korean.390Sebulshik" ; Input_Modes[5]="com.apple.inputmethod.Korean.GongjinCheongRomaja" ;;
2703 | "3-Set Korean" ) Input_Modes[1]="com.apple.inputmethod.Korean.3SetKorean" ; Input_Modes[2]="com.apple.inputmethod.Korean.2SetKorean" ; Input_Modes[3]="com.apple.inputmethod.Korean.HNCRomaja" ; Input_Modes[4]="com.apple.inputmethod.Korean.390Sebulshik" ; Input_Modes[5]="com.apple.inputmethod.Korean.GongjinCheongRomaja" ;;
2704 | "390 Sebulshik" ) Input_Modes[1]="com.apple.inputmethod.Korean.3SetKorean" ; Input_Modes[2]="com.apple.inputmethod.Korean.2SetKorean" ; Input_Modes[3]="com.apple.inputmethod.Korean.HNCRomaja" ; Input_Modes[4]="com.apple.inputmethod.Korean.390Sebulshik" ; Input_Modes[5]="com.apple.inputmethod.Korean.GongjinCheongRomaja" ;;
2705 | "GongjinCheong Romaja" ) Input_Modes[1]="com.apple.inputmethod.Korean.3SetKorean" ; Input_Modes[2]="com.apple.inputmethod.Korean.2SetKorean" ; Input_Modes[3]="com.apple.inputmethod.Korean.HNCRomaja" ; Input_Modes[4]="com.apple.inputmethod.Korean.390Sebulshik" ; Input_Modes[5]="com.apple.inputmethod.Korean.GongjinCheongRomaja" ;;
2706 | "HNC Romaja" ) Input_Modes[1]="com.apple.inputmethod.Korean.3SetKorean" ; Input_Modes[2]="com.apple.inputmethod.Korean.2SetKorean" ; Input_Modes[3]="com.apple.inputmethod.Korean.HNCRomaja" ; Input_Modes[4]="com.apple.inputmethod.Korean.390Sebulshik" ; Input_Modes[5]="com.apple.inputmethod.Korean.GongjinCheongRomaja" ;;
2707 | "Kana" ) Input_Modes[0]="com.apple.inputmethod.Japanese" ; Input_Modes[1]="com.apple.inputmethod.Japanese.placename" ; Input_Modes[2]="com.apple.inputmethod.Roman" ; Input_Modes[3]="com.apple.inputmethod.Japanese.Katakana" ; Input_Modes[4]="com.apple.inputmethod.Japanese.firstname" ; Input_Modes[5]="com.apple.inputmethod.Japanese.lastname" ;;
2708 | "Romaji" ) Input_Modes[0]="com.apple.inputmethod.Japanese" ; Input_Modes[1]="com.apple.inputmethod.Japanese.placename" ; Input_Modes[2]="com.apple.inputmethod.Roman" ; Input_Modes[3]="com.apple.inputmethod.Japanese.Katakana" ; Input_Modes[4]="com.apple.inputmethod.Japanese.firstname" ; Input_Modes[5]="com.apple.inputmethod.Japanese.lastname" ;;
2709 | "ITABC" ) Input_Modes[1]="com.apple.inputmethod.SCIM.ITABC" ; Input_Modes[2]="com.apple.inputmethod.SCIM.WBX" ; Input_Modes[3]="com.apple.inputmethod.SCIM.WBH" ;;
2710 | "Pinyin - Simplified" ) Input_Modes[1]="com.apple.inputmethod.SCIM.ITABC" ; Input_Modes[2]="com.apple.inputmethod.SCIM.WBH" ; Input_Modes[3]="com.apple.inputmethod.SCIM.WBX" ;;
2711 | "Wubi Hua" )
2712 | case ${TargetOSMinor} in
2713 | 5 ) Input_Modes[1]="com.apple.inputmethod.SCIM.ITABC" ; Input_Modes[2]="com.apple.inputmethod.SCIM.WBX" ; Input_Modes[3]="com.apple.inputmethod.SCIM.WBH" ;;
2714 | * ) Input_Modes[1]="com.apple.inputmethod.SCIM.ITABC" ; Input_Modes[2]="com.apple.inputmethod.SCIM.WBH" ; Input_Modes[3]="com.apple.inputmethod.SCIM.WBX" ;;
2715 | esac ;;
2716 | "Wubi Xing" )
2717 | case ${TargetOSMinor} in
2718 | 5 ) Input_Modes[1]="com.apple.inputmethod.SCIM.ITABC" ; Input_Modes[2]="com.apple.inputmethod.SCIM.WBX" ; Input_Modes[3]="com.apple.inputmethod.SCIM.WBH" ;;
2719 | * ) Input_Modes[1]="com.apple.inputmethod.SCIM.ITABC" ; Input_Modes[2]="com.apple.inputmethod.SCIM.WBH" ; Input_Modes[3]="com.apple.inputmethod.SCIM.WBX" ;;
2720 | esac ;;
2721 | "Anjal" )
2722 | case ${TargetOSMinor} in
2723 | 5 ) Input_Modes[1]="com.apple.inputmethod.Tamil.Tamil99" ; Input_Modes[2]="com.apple.inputmethod.Tamil.AnjalIM" ;;
2724 | * ) Input_Modes[1]="com.apple.inputmethod.Tamil.AnjalIM" ; Input_Modes[2]="com.apple.inputmethod.Tamil.Tamil99" ;;
2725 | esac ;;
2726 | "Tamil99" )
2727 | case ${TargetOSMinor} in
2728 | 5 ) Input_Modes[1]="com.apple.inputmethod.Tamil.Tamil99" ; Input_Modes[2]="com.apple.inputmethod.Tamil.AnjalIM" ;;
2729 | * ) Input_Modes[1]="com.apple.inputmethod.Tamil.AnjalIM" ; Input_Modes[2]="com.apple.inputmethod.Tamil.Tamil99" ;;
2730 | esac ;;
2731 | "Cangjie" )
2732 | case ${TargetOSMinor} in
2733 | 5 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Pinyin" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Cangjie" ;;
2734 | 6 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Pinyin" ;;
2735 | 7 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Pinyin" ;;
2736 | 8 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.ZhuyinEten" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Pinyin" ;;
2737 | esac ;;
2738 | "Dayi Pro" ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Pinyin" ;;
2739 | "Dayi(Pro)" ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Pinyin" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Cangjie" ;;
2740 | "Hanin" ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Pinyin" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[7]="com.apple.inputmethod.TCIM.Hanin" ;;
2741 | "Jianyi" )
2742 | case ${TargetOSMinor} in
2743 | 5 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Pinyin" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Cangjie" ;;
2744 | 6 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Pinyin" ;;
2745 | 7 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Pinyin" ;;
2746 | esac ;;
2747 | "Pinyin" ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Pinyin" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Cangjie" ;;
2748 | "Pinyin - Traditional" )
2749 | case ${TargetOSMinor} in
2750 | 6 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Pinyin" ;;
2751 | 7 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Pinyin" ;;
2752 | 8 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.ZhuyinEten" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Pinyin" ;;
2753 | esac ;;
2754 | "Sucheng" ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.ZhuyinEten" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Pinyin" ;;
2755 | "Zhuyin" )
2756 | case ${TargetOSMinor} in
2757 | 5 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Pinyin" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Cangjie" ;;
2758 | 6 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Dayi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Pinyin" ;;
2759 | 7 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Pinyin" ;;
2760 | 8 ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.ZhuyinEten" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Pinyin" ;;
2761 | esac ;;
2762 | "Zhuyin - Eten" ) Input_Modes[1]="com.apple.inputmethod.TCIM.Zhuyin" ; Input_Modes[2]="com.apple.inputmethod.TCIM.Cangjie" ; Input_Modes[3]="com.apple.inputmethod.TCIM.ZhuyinEten" ; Input_Modes[4]="com.apple.inputmethod.TCIM.Jianyi" ; Input_Modes[5]="com.apple.inputmethod.TCIM.Pinyin" ;;
2763 | "Simple Telex" ) Input_Modes[0]="com.apple.inputmethod.VietnameseSimpleTelex" ;;
2764 | "Telex" ) Input_Modes[0]="com.apple.inputmethod.VietnameseSimpleTelex" ; Input_Modes[2]="com.apple.inputmethod.VietnameseTelex" ;;
2765 | "VIQR" ) Input_Modes[0]="com.apple.inputmethod.VietnameseSimpleTelex" ; Input_Modes[2]="com.apple.inputmethod.VietnameseVIQR" ;;
2766 | "VNI" ) Input_Modes[0]="com.apple.inputmethod.VietnameseSimpleTelex" ; Input_Modes[2]="com.apple.inputmethod.VietnameseVNI" ;;
2767 | esac
2768 | }
2769 |
2770 | function set_InputSourceKinds {
2771 | # ${1}: Keyboard or Typing Style
2772 | unset InputSourceKinds[@]
2773 | case "${1}" in
2774 | "Afghan Dari" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2775 | "Afghan Pashto" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2776 | "Afghan Uzbek" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2777 | "Arabic" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2778 | "Arabic - PC" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2779 | "Arabic - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2780 | "Armenian - HM QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2781 | "Armenian - Western QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2782 | "Azeri" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2783 | "Bangla" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2784 | "Bangla - Qwerty" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2785 | "Bulgarian" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2786 | "Bulgarian - Phonetic" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2787 | "Byelorussian" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2788 | "Cherokee - Nation" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2789 | "Cherokee - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2790 | "Devanagari" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2791 | "Devanagari - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2792 | "Georgian - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2793 | "Greek" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2794 | "Greek Polytonic" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2795 | "Gujarati" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2796 | "Gujarati - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2797 | "Gurmukhi" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2798 | "Gurmukhi - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2799 | "2-Set Korean" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2800 | "3-Set Korean" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2801 | "390 Sebulshik" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2802 | "GongjinCheong Romaja" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2803 | "HNC Romaja" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2804 | "Hebrew" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2805 | "Hebrew - PC" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2806 | "Hebrew - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2807 | "Jawi - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2808 | "Kannada" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2809 | "Kannada - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2810 | "Kazakh" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2811 | "Khmer" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2812 | "Kana" )
2813 | case ${TargetOSMinor} in
2814 | 5 ) InputSourceKinds[0]="Input Mode" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ; InputSourceKinds[8]="Non Keyboard Input Method" ;;
2815 | * ) InputSourceKinds[0]="Input Mode" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2816 | esac ;;
2817 | "Romaji" )
2818 | case ${TargetOSMinor} in
2819 | 5 ) InputSourceKinds[0]="Input Mode" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ; InputSourceKinds[8]="Non Keyboard Input Method" ;;
2820 | * ) InputSourceKinds[0]="Input Mode" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2821 | esac ;;
2822 | "Kurdish-Sorani" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2823 | "Macedonian" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2824 | "Malayalam" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2825 | "Malayalam - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2826 | "Myanmar - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2827 | "Nepali" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2828 | "Oriya" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2829 | "Oriya - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2830 | "Persian" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2831 | "Persian - ISIRI" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2832 | "Persian - ISIRI 2901" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2833 | "Persian - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2834 | "Russian" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2835 | "Russian - PC" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2836 | "Russian - Phonetic" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2837 | "Serbian" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2838 | "ITABC" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Keyboard Input Method" ;;
2839 | "Pinyin - Simplified" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Keyboard Input Method" ; InputSourceKinds[5]="Non Keyboard Input Method" ;;
2840 | "Wubi Hua" )
2841 | case ${TargetOSMinor} in
2842 | 5 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Keyboard Input Method" ;;
2843 | * ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Keyboard Input Method" ; InputSourceKinds[5]="Non Keyboard Input Method" ;;
2844 | esac ;;
2845 | "Wubi Xing" )
2846 | case ${TargetOSMinor} in
2847 | 5 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Keyboard Input Method" ;;
2848 | * ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Keyboard Input Method" ; InputSourceKinds[5]="Non Keyboard Input Method" ;;
2849 | esac ;;
2850 | "Sinhala" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2851 | "Sinhala - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2852 | "Anjal" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Keyboard Input Method" ;;
2853 | "Tamil99" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Keyboard Input Method" ;;
2854 | "Telugu" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2855 | "Telugu - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2856 | "Thai" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2857 | "Thai - PattaChote" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2858 | "Tibetan - Otani" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2859 | "Tibetan - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2860 | "Tibetan - Wylie" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2861 | "Cangjie" )
2862 | case ${TargetOSMinor} in
2863 | 5 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2864 | 6 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ;;
2865 | 7 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Keyboard Input Method" ; InputSourceKinds[6]="Non Keyboard Input Method" ;;
2866 | 8 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ;;
2867 | esac ;;
2868 | "Dayi Pro" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ;;
2869 | "Dayi(Pro)" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2870 | "Hanin" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Input Mode" ;;
2871 | "Jianyi" )
2872 | case ${TargetOSMinor} in
2873 | 5 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2874 | 6 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ;;
2875 | 7 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Keyboard Input Method" ; InputSourceKinds[6]="Non Keyboard Input Method" ;;
2876 | esac ;;
2877 | "Pinyin" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2878 | "Pinyin - Traditional" )
2879 | case ${TargetOSMinor} in
2880 | 6 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ;;
2881 | 7 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Keyboard Input Method" ; InputSourceKinds[6]="Non Keyboard Input Method" ;;
2882 | 8 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ;;
2883 | esac ;;
2884 | "Sucheng" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ;;
2885 | "Zhuyin" )
2886 | case ${TargetOSMinor} in
2887 | 5 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ;;
2888 | 6 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ;;
2889 | 7 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Keyboard Input Method" ; InputSourceKinds[6]="Non Keyboard Input Method" ;;
2890 | 8 ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ;;
2891 | esac ;;
2892 | "Zhuyin - Eten" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Input Mode" ; InputSourceKinds[2]="Input Mode" ; InputSourceKinds[3]="Input Mode" ; InputSourceKinds[4]="Input Mode" ; InputSourceKinds[5]="Input Mode" ; InputSourceKinds[6]="Keyboard Input Method" ; InputSourceKinds[7]="Non Keyboard Input Method" ;;
2893 | "Uighur - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2894 | "Ukrainian" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2895 | "Urdu" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2896 | "Uyghur" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2897 | "Uyghur - QWERTY" ) InputSourceKinds[0]="Keyboard Layout" ; InputSourceKinds[1]="Keyboard Layout" ;;
2898 | "Simple Telex" ) InputSourceKinds[0]="Input Mode" ; InputSourceKinds[1]="Keyboard Input Method" ;;
2899 | "Telex" ) InputSourceKinds[0]="Input Mode" ; InputSourceKinds[1]="Keyboard Input Method" ; InputSourceKinds[2]="Input Mode" ;;
2900 | "VIQR" ) InputSourceKinds[0]="Input Mode" ; InputSourceKinds[1]="Keyboard Input Method" ; InputSourceKinds[2]="Input Mode" ;;
2901 | "VNI" ) InputSourceKinds[0]="Input Mode" ; InputSourceKinds[1]="Keyboard Input Method" ; InputSourceKinds[2]="Input Mode" ;;
2902 | * ) InputSourceKinds[0]="Keyboard Layout" ;;
2903 | esac
2904 | }
2905 |
2906 | function set_KeyboardLayout_IDs {
2907 | # ${1}: Keyboard or Typing Style
2908 | unset KeyboardLayout_IDs[@]
2909 | case "${1}" in
2910 | "Afghan Dari" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-2902 ;;
2911 | "Afghan Pashto" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-2904 ;;
2912 | "Afghan Uzbek" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-2903 ;;
2913 | "Arabic" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-17920 ;;
2914 | "Arabic - PC" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-17921 ;;
2915 | "Arabic - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-18000 ;;
2916 | "Armenian - HM QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-28161 ;;
2917 | "Armenian - Western QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-28164 ;;
2918 | "Australian" ) KeyboardLayout_IDs[0]=15 ;;
2919 | "Austrian" ) KeyboardLayout_IDs[0]=92 ;;
2920 | "Azeri" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-49 ;;
2921 | "Bangla" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-22528 ;;
2922 | "Bangla - Qwerty" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-22529 ;;
2923 | "Belgian" ) KeyboardLayout_IDs[0]=6 ;;
2924 | "Brazilian" ) KeyboardLayout_IDs[0]=71 ;;
2925 | "British" ) KeyboardLayout_IDs[0]=2 ;;
2926 | "British - PC" ) KeyboardLayout_IDs[0]=250 ;;
2927 | "Bulgarian" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=19528 ;;
2928 | "Bulgarian - Phonetic" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=19529 ;;
2929 | "Byelorussian" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=19517 ;;
2930 | "Canadian English" ) KeyboardLayout_IDs[0]=29 ;;
2931 | "Canadian French - CSA" ) KeyboardLayout_IDs[0]=80 ;;
2932 | "Cherokee - Nation" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-26112 ;;
2933 | "Cherokee - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-26113 ;;
2934 | "Colemak" ) KeyboardLayout_IDs[0]=12825 ;;
2935 | "Croatian" ) KeyboardLayout_IDs[0]=-68 ;;
2936 | "Croatian - PC" ) KeyboardLayout_IDs[0]=-69 ;;
2937 | "Czech" ) KeyboardLayout_IDs[0]=30776 ;;
2938 | "Czech - QWERTY" ) KeyboardLayout_IDs[0]=30778 ;;
2939 | "Danish" ) KeyboardLayout_IDs[0]=9 ;;
2940 | "Devanagari" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-20480 ;;
2941 | "Devanagari - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-20481 ;;
2942 | "Dutch" ) KeyboardLayout_IDs[0]=26 ;;
2943 | "Dvorak" ) KeyboardLayout_IDs[0]=16300 ;;
2944 | "Dvorak - Left" ) KeyboardLayout_IDs[0]=16302 ;;
2945 | "Dvorak - Qwerty" ) KeyboardLayout_IDs[0]=16301 ;;
2946 | "Dvorak - Qwerty " ) KeyboardLayout_IDs[0]=16301 ;;
2947 | "Dvorak - Right" ) KeyboardLayout_IDs[0]=16303 ;;
2948 | "Estonian" ) KeyboardLayout_IDs[0]=30764 ;;
2949 | "Faroese" ) KeyboardLayout_IDs[0]=-47 ;;
2950 | "Finnish" ) KeyboardLayout_IDs[0]=17 ;;
2951 | "Finnish Extended" ) KeyboardLayout_IDs[0]=-17 ;;
2952 | "Finnish Sami - PC" ) KeyboardLayout_IDs[0]=-18 ;;
2953 | "French" ) KeyboardLayout_IDs[0]=1 ;;
2954 | "French - Numerical" ) KeyboardLayout_IDs[0]=1111 ;;
2955 | "Georgian - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-27650 ;;
2956 | "German" ) KeyboardLayout_IDs[0]=3 ;;
2957 | "Greek" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-18944 ;;
2958 | "Greek Polytonic" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-18945 ;;
2959 | "Gujarati" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-21504 ;;
2960 | "Gujarati - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-21505 ;;
2961 | "Gurmukhi" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-20992 ;;
2962 | "Gurmukhi - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-20993 ;;
2963 | "Hawaiian" ) KeyboardLayout_IDs[0]=-50 ;;
2964 | "Hebrew" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-18432 ;;
2965 | "Hebrew - PC" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-18433 ;;
2966 | "Hebrew - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-18500 ;;
2967 | "Hungarian" ) KeyboardLayout_IDs[0]=30763 ;;
2968 | "Icelandic" ) KeyboardLayout_IDs[0]=-21 ;;
2969 | "Inuktitut - Nunavut" ) KeyboardLayout_IDs[0]=-30604 ;;
2970 | "Inuktitut - Nutaaq" ) KeyboardLayout_IDs[0]=-30602 ;;
2971 | "Inuktitut - QWERTY" ) KeyboardLayout_IDs[0]=-30600 ;;
2972 | "Inuttitut Nunavik" ) KeyboardLayout_IDs[0]=-30603 ;;
2973 | "Irish" ) KeyboardLayout_IDs[0]=50 ;;
2974 | "Irish Extended" ) KeyboardLayout_IDs[0]=-500 ;;
2975 | "Italian" )
2976 | case ${TargetOSMinor} in
2977 | 5 | 6 ) KeyboardLayout_IDs[0]=4 ;;
2978 | 7 | 8 ) KeyboardLayout_IDs[0]=223 ;;
2979 | esac ;;
2980 | "Italian - Pro" ) KeyboardLayout_IDs[0]=223 ;;
2981 | "Italian Typewriter" ) KeyboardLayout_IDs[0]=4 ;;
2982 | "Jawi - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-19000 ;;
2983 | "Kannada" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-24064 ;;
2984 | "Kannada - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-24065 ;;
2985 | "Kazakh" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-19501 ;;
2986 | "Khmer" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-26114 ;;
2987 | "Kurdish-Sorani" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-17926 ;;
2988 | "Latvian" ) KeyboardLayout_IDs[0]=30765 ;;
2989 | "Lithuanian" ) KeyboardLayout_IDs[0]=30761 ;;
2990 | "Macedonian" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=19523 ;;
2991 | "Malayalam" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-24576 ;;
2992 | "Malayalam - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-24577 ;;
2993 | "Maltese" ) KeyboardLayout_IDs[0]=-501 ;;
2994 | "Maori" ) KeyboardLayout_IDs[0]=-51 ;;
2995 | "Myanmar - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-25601 ;;
2996 | "Nepali" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-20484 ;;
2997 | "Northern Sami" ) KeyboardLayout_IDs[0]=-1200 ;;
2998 | "Norwegian" ) KeyboardLayout_IDs[0]=12 ;;
2999 | "Norwegian Extended" ) KeyboardLayout_IDs[0]=-12 ;;
3000 | "Norwegian Sami - PC" ) KeyboardLayout_IDs[0]=-13 ;;
3001 | "Oriya" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-22016 ;;
3002 | "Oriya - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-22017 ;;
3003 | "Persian" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-17960 ;;
3004 | "Persian - ISIRI" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-2901 ;;
3005 | "Persian - ISIRI 2901" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-2901 ;;
3006 | "Persian - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-1959 ;;
3007 | "Polish" ) KeyboardLayout_IDs[0]=30762 ;;
3008 | "Polish Pro" ) KeyboardLayout_IDs[0]=30788 ;;
3009 | "Portuguese" ) KeyboardLayout_IDs[0]=10 ;;
3010 | "Romanian" ) KeyboardLayout_IDs[0]=-39 ;;
3011 | "Romanian - Standard" ) KeyboardLayout_IDs[0]=-38 ;;
3012 | "Russian" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=19456 ;;
3013 | "Russian - PC" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=19458 ;;
3014 | "Russian - Phonetic" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=19457 ;;
3015 | "Sami - PC" ) KeyboardLayout_IDs[0]=-1201 ;;
3016 | "Serbian" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=19521 ;;
3017 | "Serbian - Latin" ) KeyboardLayout_IDs[0]=-19521 ;;
3018 | "Sinhala" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-25088 ;;
3019 | "Sinhala - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-25089 ;;
3020 | "Slovak" ) KeyboardLayout_IDs[0]=30777 ;;
3021 | "Slovak - QWERTY" ) KeyboardLayout_IDs[0]=30779 ;;
3022 | "Slovenian" ) KeyboardLayout_IDs[0]=-66 ;;
3023 | "Spanish" ) KeyboardLayout_IDs[0]=8 ;;
3024 | "Spanish - ISO" ) KeyboardLayout_IDs[0]=87 ;;
3025 | "Swedish" ) KeyboardLayout_IDs[0]=224 ;;
3026 | "Swedish - Pro" ) KeyboardLayout_IDs[0]=7 ;;
3027 | "Swedish Sami - PC" ) KeyboardLayout_IDs[0]=-15 ;;
3028 | "Swiss French" ) KeyboardLayout_IDs[0]=18 ;;
3029 | "Swiss German" ) KeyboardLayout_IDs[0]=19 ;;
3030 | "Telugu" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-23552 ;;
3031 | "Telugu - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-23553 ;;
3032 | "Thai" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-26624 ;;
3033 | "Thai - PattaChote" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-26626 ;;
3034 | "Tibetan - Otani" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-26628 ;;
3035 | "Tibetan - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-26625 ;;
3036 | "Tibetan - Wylie" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-2398 ;;
3037 | "Turkish" ) KeyboardLayout_IDs[0]=-24 ;;
3038 | "Turkish - QWERTY" ) KeyboardLayout_IDs[0]=-35 ;;
3039 | "Turkish - QWERTY PC" ) KeyboardLayout_IDs[0]=-36 ;;
3040 | "U.S. Extended" ) KeyboardLayout_IDs[0]=-2 ;;
3041 | "U.S. International - PC" ) KeyboardLayout_IDs[0]=15000 ;;
3042 | "Uighur - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-27000 ;;
3043 | "Ukrainian" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=19518 ;;
3044 | "Unicode Hex Input" ) KeyboardLayout_IDs[0]=-1 ;;
3045 | "Urdu" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-17925 ;;
3046 | "Uyghur" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-27000 ;;
3047 | "Uyghur - QWERTY" ) KeyboardLayout_IDs[0]=0 ; KeyboardLayout_IDs[1]=-27000 ;;
3048 | "Vietnamese" ) KeyboardLayout_IDs[0]=-31232 ;;
3049 | "Welsh" ) KeyboardLayout_IDs[0]=-790 ;;
3050 | * ) if [ -z "${Bundle_IDs[0]}" ] ; then KeyboardLayout_IDs[0]=0 ; fi ;;
3051 | esac
3052 | }
3053 |
3054 | function set_KeyboardLayout_Names {
3055 | # ${1}: Keyboard or TypingStyle
3056 | unset KeyboardLayout_Names[@]
3057 | case "${1}" in
3058 | "Afghan Dari" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Afghan Dari" ;;
3059 | "Afghan Pashto" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Afghan Pashto" ;;
3060 | "Afghan Uzbek" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Afghan Uzbek" ;;
3061 | "Arabic" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Arabic" ;;
3062 | "Arabic - PC" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Arabic PC" ;;
3063 | "Arabic - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Arabic-QWERTY" ;;
3064 | "Armenian - HM QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Armenian-HM QWERTY" ;;
3065 | "Armenian - Western QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Armenian-Western QWERTY" ;;
3066 | "Australian" ) KeyboardLayout_Names[0]="Australian" ;;
3067 | "Austrian" ) KeyboardLayout_Names[0]="Austrian" ;;
3068 | "Azeri" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Azeri" ;;
3069 | "Bangla" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Bangla" ;;
3070 | "Bangla - Qwerty" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Bangla-QWERTY" ;;
3071 | "Belgian" ) KeyboardLayout_Names[0]="Belgian" ;;
3072 | "Brazilian" ) KeyboardLayout_Names[0]="Brazilian" ;;
3073 | "British" ) KeyboardLayout_Names[0]="British" ;;
3074 | "British" ) KeyboardLayout_Names[0]="British-PC" ;;
3075 | "Bulgarian" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Bulgarian" ;;
3076 | "Bulgarian - Phonetic" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Bulgarian - Phonetic" ;;
3077 | "Byelorussian" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Byelorussian" ;;
3078 | "Canadian English" ) KeyboardLayout_Names[0]="Canadian" ;;
3079 | "Canadian French - CSA" ) KeyboardLayout_Names[0]="Canadian - CSA" ;;
3080 | "Cherokee - Nation" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Cherokee-Nation" ;;
3081 | "Cherokee - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Cherokee-QWERTY" ;;
3082 | "Colemak" ) KeyboardLayout_Names[0]="Colemak" ;;
3083 | "Croatian" ) KeyboardLayout_Names[0]="Croatian" ;;
3084 | "Croatian - PC" ) KeyboardLayout_Names[0]="Croatian-PC" ;;
3085 | "Czech" ) KeyboardLayout_Names[0]="Czech" ;;
3086 | "Czech - QWERTY" ) KeyboardLayout_Names[0]="Czech-QWERTY" ;;
3087 | "Danish" ) KeyboardLayout_Names[0]="Danish" ;;
3088 | "Devanagari" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Devanagari" ;;
3089 | "Devanagari - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Devanagari-QWERTY" ;;
3090 | "Dutch" ) KeyboardLayout_Names[0]="Dutch" ;;
3091 | "Dvorak" ) KeyboardLayout_Names[0]="Dvorak" ;;
3092 | "Dvorak - Left" ) KeyboardLayout_Names[0]="Dvorak - Left" ;;
3093 | "Dvorak - Qwerty" ) KeyboardLayout_Names[0]="DVORAK - QWERTY CMD" ;;
3094 | "Dvorak - Qwerty " ) KeyboardLayout_Names[0]="DVORAK - QWERTY CMD" ;;
3095 | "Dvorak - Right" ) KeyboardLayout_Names[0]="Dvorak - Right" ;;
3096 | "Estonian" ) KeyboardLayout_Names[0]="Estonian" ;;
3097 | "Faroese" ) KeyboardLayout_Names[0]="Faroese" ;;
3098 | "Finnish" ) KeyboardLayout_Names[0]="Finnish" ;;
3099 | "Finnish Extended" ) KeyboardLayout_Names[0]="Finnish Extended" ;;
3100 | "Finnish Sami - PC" ) KeyboardLayout_Names[0]="FinnishSami-PC" ;;
3101 | "French" ) KeyboardLayout_Names[0]="French" ;;
3102 | "French - Numerical" ) KeyboardLayout_Names[0]="French - numerical" ;;
3103 | "Georgian - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Georgian-QWERTY" ;;
3104 | "German" ) KeyboardLayout_Names[0]="German" ;;
3105 | "Greek" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Greek" ;;
3106 | "Greek Polytonic" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Greek Polytonic" ;;
3107 | "Gujarati" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Gujarati" ;;
3108 | "Gujarati - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Gujarati-QWERTY" ;;
3109 | "Gurmukhi" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Gurmukhi" ;;
3110 | "Gurmukhi - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Gurmukhi-QWERTY" ;;
3111 | "Hawaiian" ) KeyboardLayout_Names[0]="Hawaiian" ;;
3112 | "Hebrew" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Hebrew" ;;
3113 | "Hebrew - PC" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Hebrew-PC" ;;
3114 | "Hebrew - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Hebrew-QWERTY" ;;
3115 | "Hungarian" ) KeyboardLayout_Names[0]="Hungarian" ;;
3116 | "Icelandic" ) KeyboardLayout_Names[0]="Icelandic" ;;
3117 | "Inuktitut - Nunavut" ) KeyboardLayout_Names[0]="Inuktitut-Nunavut" ;;
3118 | "Inuktitut - Nutaaq" ) KeyboardLayout_Names[0]="Inuktitut-Nutaaq" ;;
3119 | "Inuktitut - QWERTY" ) KeyboardLayout_Names[0]="Inuktitut-QWERTY" ;;
3120 | "Inuttitut Nunavik" ) KeyboardLayout_Names[0]="Inuttitut Nunavik" ;;
3121 | "Irish" ) KeyboardLayout_Names[0]="Irish" ;;
3122 | "Irish Extended" ) KeyboardLayout_Names[0]="Irish Extended" ;;
3123 | "Italian" )
3124 | case ${TargetOSMinor} in
3125 | 5 | 6 ) KeyboardLayout_Names[0]="Italian" ;;
3126 | 7 | 8 ) KeyboardLayout_Names[0]="Italian - Pro" ;;
3127 | esac ;;
3128 | "Italian - Pro" ) KeyboardLayout_Names[0]="Italian - Pro" ;;
3129 | "Italian Typewriter" ) KeyboardLayout_Names[0]="Italian" ;;
3130 | "Jawi - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Jawi-QWERTY" ;;
3131 | "Kannada" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Kannada" ;;
3132 | "Kannada - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Kannada-QWERTY" ;;
3133 | "Kazakh" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Kazakh" ;;
3134 | "Khmer" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Khmer" ;;
3135 | "Kurdish-Sorani" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Kurdish-Sorani" ;;
3136 | "Latvian" ) KeyboardLayout_Names[0]="Latvian" ;;
3137 | "Lithuanian" ) KeyboardLayout_Names[0]="Lithuanian" ;;
3138 | "Macedonian" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Macedonian" ;;
3139 | "Malayalam" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Malayalam" ;;
3140 | "Malayalam - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Malayalam-QWERTY" ;;
3141 | "Maltese" ) KeyboardLayout_Names[0]="Maltese" ;;
3142 | "Maori" ) KeyboardLayout_Names[0]="Maori" ;;
3143 | "Myanmar - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Myanmar-QWERTY" ;;
3144 | "Nepali" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Nepali" ;;
3145 | "Northern Sami" ) KeyboardLayout_Names[0]="Northern Sami" ;;
3146 | "Norwegian" ) KeyboardLayout_Names[0]="Norwegian" ;;
3147 | "Norwegian Extended" ) KeyboardLayout_Names[0]="Norwegian Extended" ;;
3148 | "Norwegian Sami - PC" ) KeyboardLayout_Names[0]="NorwegianSami-PC" ;;
3149 | "Oriya" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Oriya" ;;
3150 | "Oriya - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Oriya-QWERTY" ;;
3151 | "Persian" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Persian" ;;
3152 | "Persian - ISIRI" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Persian-ISIRI 2901" ;;
3153 | "Persian - ISIRI 2901" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Persian-ISIRI 2901" ;;
3154 | "Persian - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Persian-QWERTY" ;;
3155 | "Polish" ) KeyboardLayout_Names[0]="Polish" ;;
3156 | "Polish Pro" ) KeyboardLayout_Names[0]="Polish Pro" ;;
3157 | "Portuguese" ) KeyboardLayout_Names[0]="Portuguese" ;;
3158 | "Romanian" ) KeyboardLayout_Names[0]="Romanian" ;;
3159 | "Romanian - Standard" ) KeyboardLayout_Names[0]="Romanian-Standard" ;;
3160 | "Russian" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Russian" ;;
3161 | "Russian - PC" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="RussianWin" ;;
3162 | "Russian - Phonetic" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Russian - Phonetic" ;;
3163 | "Sami - PC" ) KeyboardLayout_Names[0]="Sami-PC" ;;
3164 | "Serbian" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Serbian" ;;
3165 | "Serbian - Latin" ) KeyboardLayout_Names[0]="Serbian-Latin" ;;
3166 | "Sinhala" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Sinhala" ;;
3167 | "Sinhala - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Sinhala-QWERTY" ;;
3168 | "Slovak" ) KeyboardLayout_Names[0]="Slovak" ;;
3169 | "Slovak - QWERTY" ) KeyboardLayout_Names[0]="Slovak-QWERTY" ;;
3170 | "Slovenian" ) KeyboardLayout_Names[0]="Slovenian" ;;
3171 | "Spanish" ) KeyboardLayout_Names[0]="Spanish" ;;
3172 | "Spanish - ISO" ) KeyboardLayout_Names[0]="Spanish - ISO" ;;
3173 | "Swedish" ) KeyboardLayout_Names[0]="Swedish" ;;
3174 | "Swedish - Pro" ) KeyboardLayout_Names[0]="Swedish - Pro" ;;
3175 | "Swedish Sami - PC" ) KeyboardLayout_Names[0]="SwedishSami-PC" ;;
3176 | "Swiss French" ) KeyboardLayout_Names[0]="Swiss French" ;;
3177 | "Swiss German" ) KeyboardLayout_Names[0]="Swiss German" ;;
3178 | "Telugu" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Telugu" ;;
3179 | "Telugu - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Telugu-QWERTY" ;;
3180 | "Thai" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Thai" ;;
3181 | "Thai - PattaChote" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Thai-PattaChote" ;;
3182 | "Tibetan - Otani" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="TibetanOtaniUS" ;;
3183 | "Tibetan - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Tibetan-QWERTY" ;;
3184 | "Tibetan - Wylie" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Tibetan-Wylie" ;;
3185 | "Turkish" ) KeyboardLayout_Names[0]="Turkish" ;;
3186 | "Turkish - QWERTY" ) KeyboardLayout_Names[0]="Turkish-QWERTY" ;;
3187 | "Turkish - QWERTY PC" ) KeyboardLayout_Names[0]="Turkish-QWERTY-PC" ;;
3188 | "U.S. Extended" ) KeyboardLayout_Names[0]="US Extended" ;;
3189 | "U.S. International - PC" ) KeyboardLayout_Names[0]="USInternational-PC" ;;
3190 | "Uighur - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Uyghur-QWERTY" ;;
3191 | "Ukrainian" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Ukrainian" ;;
3192 | "Unicode Hex Input" ) KeyboardLayout_Names[0]="Unicode Hex Input" ;;
3193 | "Urdu" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Urdu" ;;
3194 | "Uyghur" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Uyghur" ;;
3195 | "Uyghur - QWERTY" ) KeyboardLayout_Names[0]="U.S." ; KeyboardLayout_Names[1]="Uyghur-QWERTY" ;;
3196 | "Vietnamese" ) KeyboardLayout_Names[0]="Vietnamese" ;;
3197 | "Welsh" ) KeyboardLayout_Names[0]="Welsh" ;;
3198 | * ) if [ -z "${Bundle_IDs[0]}" ] ; then KeyboardLayout_Names[0]="U.S." ; fi ;;
3199 | esac
3200 | }
3201 |
3202 | function set_SelectedInputSource {
3203 | # ${1}: Keyboard or TypingStyle
3204 | unset SelectedInputSource
3205 | case "${1}" in
3206 | "Afghan Dari" ) SelectedInputSource=1 ;;
3207 | "Afghan Pashto" ) SelectedInputSource=1 ;;
3208 | "Afghan Uzbek" ) SelectedInputSource=1 ;;
3209 | "Arabic" ) SelectedInputSource=1 ;;
3210 | "Arabic - PC" ) SelectedInputSource=1 ;;
3211 | "Arabic - QWERTY" ) SelectedInputSource=1 ;;
3212 | "Armenian - HM QWERTY" ) SelectedInputSource=1 ;;
3213 | "Armenian - Western QWERTY" ) SelectedInputSource=1 ;;
3214 | "Azeri" ) SelectedInputSource=1 ;;
3215 | "Bangla" ) SelectedInputSource=1 ;;
3216 | "Bangla - Qwerty" ) SelectedInputSource=1 ;;
3217 | "Bulgarian" ) SelectedInputSource=1 ;;
3218 | "Bulgarian - Phonetic" ) SelectedInputSource=1 ;;
3219 | "Byelorussian" ) SelectedInputSource=1 ;;
3220 | "Cherokee - Nation" ) SelectedInputSource=1 ;;
3221 | "Cherokee - QWERTY" ) SelectedInputSource=1 ;;
3222 | "Devanagari" ) SelectedInputSource=1 ;;
3223 | "Devanagari - QWERTY" ) SelectedInputSource=1 ;;
3224 | "Georgian - QWERTY" ) SelectedInputSource=1 ;;
3225 | "Greek" ) SelectedInputSource=1 ;;
3226 | "Greek Polytonic" ) SelectedInputSource=1 ;;
3227 | "Gujarati" ) SelectedInputSource=1 ;;
3228 | "Gujarati - QWERTY" ) SelectedInputSource=1 ;;
3229 | "Gurmukhi" ) SelectedInputSource=1 ;;
3230 | "Gurmukhi - QWERTY" ) SelectedInputSource=1 ;;
3231 | "2-Set Korean" ) SelectedInputSource=2 ;;
3232 | "3-Set Korean" ) SelectedInputSource=1 ;;
3233 | "390 Sebulshik" ) SelectedInputSource=4 ;;
3234 | "GongjinCheong Romaja" ) SelectedInputSource=5 ;;
3235 | "HNC Romaja" ) SelectedInputSource=3 ;;
3236 | "Hebrew" ) SelectedInputSource=1 ;;
3237 | "Hebrew - PC" ) SelectedInputSource=1 ;;
3238 | "Hebrew - QWERTY" ) SelectedInputSource=1 ;;
3239 | "Jawi - QWERTY" ) SelectedInputSource=1 ;;
3240 | "Kannada" ) SelectedInputSource=1 ;;
3241 | "Kannada - QWERTY" ) SelectedInputSource=1 ;;
3242 | "Kazakh" ) SelectedInputSource=1 ;;
3243 | "Khmer" ) SelectedInputSource=1 ;;
3244 | "Kana" ) SelectedInputSource=3 ;;
3245 | "Romaji" ) SelectedInputSource=2 ;;
3246 | "Kurdish-Sorani" ) SelectedInputSource=1 ;;
3247 | "Macedonian" ) SelectedInputSource=1 ;;
3248 | "Malayalam" ) SelectedInputSource=1 ;;
3249 | "Malayalam - QWERTY" ) SelectedInputSource=1 ;;
3250 | "Myanmar - QWERTY" ) SelectedInputSource=1 ;;
3251 | "Nepali" ) SelectedInputSource=1 ;;
3252 | "Oriya" ) SelectedInputSource=1 ;;
3253 | "Oriya - QWERTY" ) SelectedInputSource=1 ;;
3254 | "Persian" ) SelectedInputSource=1 ;;
3255 | "Persian - ISIRI" ) SelectedInputSource=1 ;;
3256 | "Persian - ISIRI 2901" ) SelectedInputSource=1 ;;
3257 | "Persian - QWERTY" ) SelectedInputSource=1 ;;
3258 | "Russian" ) SelectedInputSource=1 ;;
3259 | "Russian - PC" ) SelectedInputSource=1 ;;
3260 | "Russian - Phonetic" ) SelectedInputSource=1 ;;
3261 | "Serbian" ) SelectedInputSource=1 ;;
3262 | "ITABC" ) SelectedInputSource=1 ;;
3263 | "Pinyin - Simplified" ) SelectedInputSource=1 ;;
3264 | "Wubi Hua" )
3265 | case ${TargetOSMinor} in
3266 | 5 ) SelectedInputSource=3 ;;
3267 | * ) SelectedInputSource=2 ;;
3268 | esac ;;
3269 | "Wubi Xing" )
3270 | case ${TargetOSMinor} in
3271 | 5 ) SelectedInputSource=2 ;;
3272 | * ) SelectedInputSource=3 ;;
3273 | esac ;;
3274 | "Sinhala" ) SelectedInputSource=1 ;;
3275 | "Sinhala - QWERTY" ) SelectedInputSource=1 ;;
3276 | "Anjal" )
3277 | case ${TargetOSMinor} in
3278 | 5 ) SelectedInputSource=2 ;;
3279 | * ) SelectedInputSource=1 ;;
3280 | esac ;;
3281 | "Tamil99" )
3282 | case ${TargetOSMinor} in
3283 | 5 ) SelectedInputSource=1 ;;
3284 | * ) SelectedInputSource=2 ;;
3285 | esac ;;
3286 | "Telugu" ) SelectedInputSource=1 ;;
3287 | "Telugu - QWERTY" ) SelectedInputSource=1 ;;
3288 | "Thai" ) SelectedInputSource=1 ;;
3289 | "Thai - PattaChote" ) SelectedInputSource=1 ;;
3290 | "Tibetan - Otani" ) SelectedInputSource=1 ;;
3291 | "Tibetan - QWERTY" ) SelectedInputSource=1 ;;
3292 | "Tibetan - Wylie" ) SelectedInputSource=1 ;;
3293 | "Cangjie" )
3294 | case ${TargetOSMinor} in
3295 | 5 ) SelectedInputSource=5 ;;
3296 | * ) SelectedInputSource=2 ;;
3297 | esac ;;
3298 | "Dayi Pro" ) SelectedInputSource=3 ;;
3299 | "Dayi(Pro)" ) SelectedInputSource=2 ;;
3300 | "Hanin" ) SelectedInputSource=7 ;;
3301 | "Jianyi" )
3302 | case ${TargetOSMinor} in
3303 | 6 | 8 ) SelectedInputSource=4 ;;
3304 | * ) SelectedInputSource=3 ;;
3305 | esac ;;
3306 | "Pinyin" ) SelectedInputSource=4 ;;
3307 | "Pinyin - Traditional" )
3308 | case ${TargetOSMinor} in
3309 | 6 | 8 ) SelectedInputSource=5 ;;
3310 | 7 ) SelectedInputSource=4 ;;
3311 | esac ;;
3312 | "Sucheng" ) SelectedInputSource=4 ;;
3313 | "Zhuyin" ) SelectedInputSource=1 ;;
3314 | "Zhuyin - Eten" ) SelectedInputSource=3 ;;
3315 | "Uighur - QWERTY" ) SelectedInputSource=1 ;;
3316 | "Ukrainian" ) SelectedInputSource=1 ;;
3317 | "Urdu" ) SelectedInputSource=1 ;;
3318 | "Uyghur" ) SelectedInputSource=1 ;;
3319 | "Uyghur - QWERTY" ) SelectedInputSource=1 ;;
3320 | "Simple Telex" ) SelectedInputSource=0 ;;
3321 | "Telex" ) SelectedInputSource=2 ;;
3322 | "VNI" ) SelectedInputSource=2 ;;
3323 | "VIQR" ) SelectedInputSource=2 ;;
3324 | * ) SelectedInputSource=0 ;;
3325 | esac
3326 | }
3327 |
3328 | function set_CurrentKeyboardLayoutInputSourceID {
3329 | # ${1}: Keyboard or TypingStyle
3330 | if [ ${TargetOSMinor} -eq 5 ] ; then
3331 | unset CurrentKeyboardLayoutInputSourceID
3332 | else
3333 | case "${1}" in
3334 | "Afghan Dari" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.AfghanDari" ;;
3335 | "Afghan Pashto" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.AfghanPashto" ;;
3336 | "Afghan Uzbek" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.AfghanUzbek" ;;
3337 | "Arabic" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Arabic" ;;
3338 | "Arabic - PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.ArabicPC" ;;
3339 | "Arabic - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Arabic-QWERTY" ;;
3340 | "Armenian - HM QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Armenian-HMQWERTY" ;;
3341 | "Armenian - Western QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Armenian-WesternQWERTY" ;;
3342 | "Australian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Australian" ;;
3343 | "Austrian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Austrian" ;;
3344 | "Azeri" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Azeri" ;;
3345 | "Bangla" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Bangla" ;;
3346 | "Bangla - Qwerty" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Bangla-QWERTY" ;;
3347 | "Belgian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Belgian" ;;
3348 | "Brazilian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Brazilian" ;;
3349 | "British" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.British" ;;
3350 | "British - PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.British-PC" ;;
3351 | "Bulgarian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Bulgarian" ;;
3352 | "Bulgarian - Phonetic" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Bulgarian-Phonetic" ;;
3353 | "Byelorussian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Byelorussian" ;;
3354 | "Canadian English" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Canadian" ;;
3355 | "Canadian French - CSA" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Canadian-CSA" ;;
3356 | "Cherokee - Nation" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Cherokee-Nation" ;;
3357 | "Cherokee - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Cherokee-QWERTY" ;;
3358 | "Colemak" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Colemak" ;;
3359 | "Croatian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Croatian" ;;
3360 | "Croatian - PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Croatian-PC" ;;
3361 | "Czech" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Czech" ;;
3362 | "Czech - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Czech-QWERTY" ;;
3363 | "Danish" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Danish" ;;
3364 | "Devanagari" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Devanagari" ;;
3365 | "Devanagari - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Devanagari-QWERTY" ;;
3366 | "Dutch" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Dutch" ;;
3367 | "Dvorak" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Dvorak" ;;
3368 | "Dvorak - Left" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Dvorak-Left" ;;
3369 | "Dvorak - Qwerty ⌘" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.DVORAK-QWERTYCMD" ;;
3370 | "Dvorak - Right" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Dvorak-Right" ;;
3371 | "Estonian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Estonian" ;;
3372 | "Faroese" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Faroese" ;;
3373 | "Finnish" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Finnish" ;;
3374 | "Finnish Extended" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.FinnishExtended" ;;
3375 | "Finnish Sami - PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.FinnishSami-PC" ;;
3376 | "French" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.French" ;;
3377 | "French - Numerical" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.French-numerical" ;;
3378 | "Georgian - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Georgian-QWERTY" ;;
3379 | "German" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.German" ;;
3380 | "Greek" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Greek" ;;
3381 | "Greek Polytonic" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.GreekPolytonic" ;;
3382 | "Gujarati" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Gujarati" ;;
3383 | "Gujarati - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Gujarati-QWERTY" ;;
3384 | "Gurmukhi" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Gurmukhi" ;;
3385 | "Gurmukhi - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Gurmukhi-QWERTY" ;;
3386 | "Hawaiian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Hawaiian" ;;
3387 | "Hebrew" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Hebrew" ;;
3388 | "Hebrew - PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Hebrew-PC" ;;
3389 | "Hebrew - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Hebrew-QWERTY" ;;
3390 | "Hungarian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Hungarian" ;;
3391 | "Icelandic" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Icelandic" ;;
3392 | "Inuktitut - Nunavut" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Inuktitut-Nunavut" ;;
3393 | "Inuktitut - Nutaaq" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Inuktitut-Nutaaq" ;;
3394 | "Inuktitut - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Inuktitut-QWERTY" ;;
3395 | "Inuttitut Nunavik" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.InuttitutNunavik" ;;
3396 | "Irish" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Irish" ;;
3397 | "Irish Extended" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.IrishExtended" ;;
3398 | "Italian" )
3399 | case ${TargetOSMinor} in
3400 | 6 ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Italian" ;;
3401 | * ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Italian-Pro" ;;
3402 | esac ;;
3403 | "Italian - Pro" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Italian-Pro" ;;
3404 | "Italian Typewriter" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Italian" ;;
3405 | "Jawi - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Jawi-QWERTY" ;;
3406 | "Kannada" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Kannada" ;;
3407 | "Kannada - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Kannada-QWERTY" ;;
3408 | "Kazakh" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Kazakh" ;;
3409 | "Khmer" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Khmer" ;;
3410 | "Kurdish-Sorani" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Kurdish-Sorani" ;;
3411 | "Latvian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Latvian" ;;
3412 | "Lithuanian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Lithuanian" ;;
3413 | "Macedonian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Macedonian" ;;
3414 | "Malayalam" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Malayalam" ;;
3415 | "Malayalam - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Malayalam-QWERTY" ;;
3416 | "Maltese" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Maltese" ;;
3417 | "Maori" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Maori" ;;
3418 | "Myanmar - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Myanmar-QWERTY" ;;
3419 | "Nepali" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Nepali" ;;
3420 | "Northern Sami" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.NorthernSami" ;;
3421 | "Norwegian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Norwegian" ;;
3422 | "Norwegian Extended" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.NorwegianExtended" ;;
3423 | "Norwegian Sami - PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.NorwegianSami-PC" ;;
3424 | "Oriya" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Oriya" ;;
3425 | "Oriya - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Oriya-QWERTY" ;;
3426 | "Persian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Persian" ;;
3427 | "Persian - ISIRI" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Persian-ISIRI2901" ;;
3428 | "Persian - ISIRI 2901" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Persian-ISIRI2901" ;;
3429 | "Persian - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Persian-QWERTY" ;;
3430 | "Polish" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Polish" ;;
3431 | "Polish Pro" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.PolishPro" ;;
3432 | "Portuguese" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Portuguese" ;;
3433 | "Romanian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Romanian" ;;
3434 | "Romanian - Standard" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Romanian-Standard" ;;
3435 | "Russian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Russian" ;;
3436 | "Russian - PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.RussianWin" ;;
3437 | "Russian - Phonetic" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Russian-Phonetic" ;;
3438 | "Sami - PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Sami-PC" ;;
3439 | "Serbian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Serbian" ;;
3440 | "Serbian - Latin" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Serbian-Latin" ;;
3441 | "Sinhala" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Sinhala" ;;
3442 | "Sinhala - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Sinhala-QWERTY" ;;
3443 | "Slovak" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Slovak" ;;
3444 | "Slovak - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Slovak-QWERTY" ;;
3445 | "Slovenian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Slovenian" ;;
3446 | "Spanish" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Spanish" ;;
3447 | "Spanish - ISO" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Spanish-ISO" ;;
3448 | "Swedish" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Swedish" ;;
3449 | "Swedish - Pro" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Swedish-Pro" ;;
3450 | "Swedish Sami - PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.SwedishSami-PC" ;;
3451 | "Swiss French" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.SwissFrench" ;;
3452 | "Swiss German" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.SwissGerman" ;;
3453 | "Telugu" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Telugu" ;;
3454 | "Telugu - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Telugu-QWERTY" ;;
3455 | "Thai" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Thai" ;;
3456 | "Thai - PattaChote" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Thai-PattaChote" ;;
3457 | "Tibetan - Otani" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.TibetanOtaniUS" ;;
3458 | "Tibetan - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Tibetan-QWERTY" ;;
3459 | "Tibetan - Wylie" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Tibetan-Wylie" ;;
3460 | "Turkish" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Turkish" ;;
3461 | "Turkish - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Turkish-QWERTY" ;;
3462 | "Turkish - QWERTY PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Turkish-QWERTY-PC" ;;
3463 | "U.S. Extended" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.USExtended" ;;
3464 | "U.S. International - PC" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.USInternational-PC" ;;
3465 | "Ukrainian" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Ukrainian" ;;
3466 | "Unicode Hex Input" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.UnicodeHexInput" ;;
3467 | "Urdu" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Urdu" ;;
3468 | "Uyghur" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Uyghur" ;;
3469 | "Uyghur - QWERTY" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Uyghur-QWERTY" ;;
3470 | "Vietnamese" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Vietnamese" ;;
3471 | "Welsh" ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.Welsh" ;;
3472 | * ) CurrentKeyboardLayoutInputSourceID="com.apple.keylayout.US" ;;
3473 | esac
3474 | fi
3475 | }
3476 |
3477 | function set_DefaultAsciiInputSource {
3478 | if [ ${#KeyboardLayout_IDs[@]} -eq 0 ] ; then
3479 | InputSourceKind="Keyboard Layout"
3480 | KeyboardLayout_ID=0
3481 | KeyboardLayout_Name="U.S."
3482 | else
3483 | InputSourceKind="${InputSourceKinds[0]}"
3484 | KeyboardLayout_ID=${KeyboardLayout_IDs[0]}
3485 | KeyboardLayout_Name="${KeyboardLayout_Names[0]}"
3486 | fi
3487 | }
3488 |
3489 | function set_InputSourceID {
3490 | # ${1}: SAKeyboard
3491 | # ${1}: SATypingStyle
3492 | unset InputSourceID
3493 | case "${1}" in
3494 | "Afghan Dari" ) InputSourceID="AfghanDari" ;;
3495 | "Afghan Pashto" ) InputSourceID="AfghanPashto" ;;
3496 | "Afghan Uzbek" ) InputSourceID="AfghanUzbek" ;;
3497 | "Arabic" ) InputSourceID="Arabic" ;;
3498 | "Arabic - PC" ) InputSourceID="ArabicPC" ;;
3499 | "Arabic - QWERTY" ) InputSourceID="Arabic-QWERTY" ;;
3500 | "Armenian - HM QWERTY" ) InputSourceID="Armenian-HMQWERTY" ;;
3501 | "Armenian - Western QWERTY" ) InputSourceID="Armenian-WesternQWERTY" ;;
3502 | "Australian" ) InputSourceID="Australian" ;;
3503 | "Austrian" ) InputSourceID="Austrian" ;;
3504 | "Azeri" ) InputSourceID="Azeri" ;;
3505 | "Bangla" ) InputSourceID="Bangla" ;;
3506 | "Bangla - Qwerty" ) InputSourceID="Bangla-QWERTY" ;;
3507 | "Belgian" ) InputSourceID="Belgian" ;;
3508 | "Brazilian" ) InputSourceID="Brazilian" ;;
3509 | "British" ) InputSourceID="British" ;;
3510 | "British - PC" ) InputSourceID="British-PC" ;;
3511 | "Bulgarian" ) InputSourceID="Bulgarian" ;;
3512 | "Bulgarian - Phonetic" ) InputSourceID="Bulgarian-Phonetic" ;;
3513 | "Byelorussian" ) InputSourceID="Byelorussian" ;;
3514 | "Canadian English" ) InputSourceID="Canadian" ;;
3515 | "Canadian French - CSA" ) InputSourceID="Canadian-CSA" ;;
3516 | "Cherokee - Nation" ) InputSourceID="Cherokee-Nation" ;;
3517 | "Cherokee - QWERTY" ) InputSourceID="Cherokee-QWERTY" ;;
3518 | "Simplified Chinese" | "Chinese - Simplified" )
3519 | case "${2}" in
3520 | "ITABC" | "Pinyin - Simplified" ) InputSourceID="SCIM.ITABC" ;;
3521 | "Wubi Hua" ) InputSourceID="SCIM.WBH" ;;
3522 | "Wubi Xing" ) InputSourceID="SCIM.WBX" ;;
3523 | esac ;;
3524 | "Traditional Chinese" | "Chinese - Traditional" )
3525 | case "${2}" in
3526 | "Cangjie" ) InputSourceID="TCIM.Cangjie" ;;
3527 | "Dayi(Pro)" | "Dayi Pro" ) InputSourceID="TCIM.Dayi" ;;
3528 | "Hanin" ) InputSourceID="TCIM.Hanin" ;;
3529 | "Pinyin" | "Pinyin - Traditional" ) InputSourceID="TCIM.Pinyin" ;;
3530 | "Jianyi" | "Sucheng" ) InputSourceID="TCIM.Jianyi" ;;
3531 | "Zhuyin" ) InputSourceID="TCIM.Zhuyin" ;;
3532 | "Zhuyin - Eten" ) InputSourceID="TCIM.ZhuyinEten" ;;
3533 | esac ;;
3534 | "Colemak" ) InputSourceID="Colemak" ;;
3535 | "Croatian" ) InputSourceID="Croatian" ;;
3536 | "Croatian - PC" ) InputSourceID="Croatian-PC" ;;
3537 | "Czech" ) InputSourceID="Czech" ;;
3538 | "Czech - QWERTY" ) InputSourceID="Czech-QWERTY" ;;
3539 | "Danish" ) InputSourceID="Danish" ;;
3540 | "Devanagari" ) InputSourceID="Devanagari" ;;
3541 | "Devanagari - QWERTY" ) InputSourceID="Devanagari-QWERTY" ;;
3542 | "Dutch" ) InputSourceID="Dutch" ;;
3543 | "Dvorak" ) InputSourceID="Dvorak" ;;
3544 | "Dvorak - Left" ) InputSourceID="Dvorak-Left" ;;
3545 | "Dvorak - Qwerty ⌘" ) InputSourceID="DVORAK-QWERTYCMD" ;;
3546 | "Dvorak - Right" ) InputSourceID="Dvorak-Right" ;;
3547 | "Estonian" ) InputSourceID="Estonian" ;;
3548 | "Faroese" ) InputSourceID="Faroese" ;;
3549 | "Finnish" ) InputSourceID="Finnish" ;;
3550 | "Finnish Extended" ) InputSourceID="FinnishExtended" ;;
3551 | "Finnish Sami - PC" ) InputSourceID="FinnishSami-PC" ;;
3552 | "French" ) InputSourceID="French" ;;
3553 | "French - Numerical" ) InputSourceID="French-numerical" ;;
3554 | "Georgian - QWERTY" ) InputSourceID="Georgian-QWERTY" ;;
3555 | "German" ) InputSourceID="German" ;;
3556 | "Greek" ) InputSourceID="Greek" ;;
3557 | "Greek Polytonic" ) InputSourceID="GreekPolytonic" ;;
3558 | "Gujarati" ) InputSourceID="Gujarati" ;;
3559 | "Gujarati - QWERTY" ) InputSourceID="Gujarati-QWERTY" ;;
3560 | "Gurmukhi" ) InputSourceID="Gurmukhi" ;;
3561 | "Gurmukhi - QWERTY" ) InputSourceID="Gurmukhi-QWERTY" ;;
3562 | "Hangul" )
3563 | case "${2}" in
3564 | "2-Set Korean" ) InputSourceID="Korean.2SetKorean" ;;
3565 | "3-Set Korean" ) InputSourceID="Korean.3SetKorean" ;;
3566 | "390 Sebulshik" ) InputSourceID="Korean.390Sebulshik" ;;
3567 | "GongjinCheong Romaja" ) InputSourceID="Korean.GongjinCheongRomaja" ;;
3568 | "HNC Romaja" ) InputSourceID="Korean.HNCRomaja" ;;
3569 | esac ;;
3570 | "Hawaiian" ) InputSourceID="Hawaiian" ;;
3571 | "Hebrew" ) InputSourceID="Hebrew" ;;
3572 | "Hebrew - PC" ) InputSourceID="Hebrew-PC" ;;
3573 | "Hebrew - QWERTY" ) InputSourceID="Hebrew-QWERTY" ;;
3574 | "Hungarian" ) InputSourceID="Hungarian" ;;
3575 | "Icelandic" ) InputSourceID="Icelandic" ;;
3576 | "Inuktitut - Nunavut" ) InputSourceID="Inuktitut-Nunavut" ;;
3577 | "Inuktitut - Nutaaq" ) InputSourceID="Inuktitut-Nutaaq" ;;
3578 | "Inuktitut - QWERTY" ) InputSourceID="Inuktitut-QWERTY" ;;
3579 | "Inuttitut Nunavik" ) InputSourceID="InuttitutNunavik" ;;
3580 | "Irish" ) InputSourceID="Irish" ;;
3581 | "Irish Extended" ) InputSourceID="IrishExtended" ;;
3582 | "Italian" )
3583 | case ${TargetOSMinor} in
3584 | 5 | 6 ) InputSourceID="Italian" ;;
3585 | * ) InputSourceID="Italian-Pro" ;;
3586 | esac ;;
3587 | "Italian Typewriter" ) InputSourceID="Italian" ;;
3588 | "Italian - Pro" ) InputSourceID="Italian-Pro" ;;
3589 | "Jawi - QWERTY" ) InputSourceID="Jawi-QWERTY" ;;
3590 | "Kannada" ) InputSourceID="Kannada" ;;
3591 | "Kannada - QWERTY" ) InputSourceID="Kannada-QWERTY" ;;
3592 | "Kazakh" ) InputSourceID="Kazakh" ;;
3593 | "Khmer" ) InputSourceID="Khmer" ;;
3594 | "Kotoeri" )
3595 | case "${2}" in
3596 | "Kana" ) InputSourceID="Japanese.Katakana" ;;
3597 | "Romaji" ) InputSourceID="Japanese.Roman" ;;
3598 | esac ;;
3599 | "Kurdish-Sorani" ) InputSourceID="Kurdish-Sorani" ;;
3600 | "Latvian" ) InputSourceID="Latvian" ;;
3601 | "Lithuanian" ) InputSourceID="Lithuanian" ;;
3602 | "Macedonian" ) InputSourceID="Macedonian" ;;
3603 | "Malayalam" ) InputSourceID="Malayalam" ;;
3604 | "Malayalam - QWERTY" ) InputSourceID="Malayalam-QWERTY" ;;
3605 | "Maltese" ) InputSourceID="Maltese" ;;
3606 | "Maori" ) InputSourceID="Maori" ;;
3607 | "Myanmar - QWERTY" ) InputSourceID="Myanmar-QWERTY" ;;
3608 | "Nepali" ) InputSourceID="Nepali" ;;
3609 | "Northern Sami" ) InputSourceID="NorthernSami" ;;
3610 | "Norwegian" ) InputSourceID="Norwegian" ;;
3611 | "Norwegian Extended" ) InputSourceID="NorwegianExtended" ;;
3612 | "Norwegian Sami - PC" ) InputSourceID="NorwegianSami-PC" ;;
3613 | "Oriya" ) InputSourceID="Oriya" ;;
3614 | "Oriya - QWERTY" ) InputSourceID="Oriya-QWERTY" ;;
3615 | "Persian" ) InputSourceID="Persian" ;;
3616 | "Persian - ISIRI 2901" | "Persian - ISIRI" ) InputSourceID="Persian-ISIRI2901" ;;
3617 | "Persian - QWERTY" ) InputSourceID="Persian-QWERTY" ;;
3618 | "Polish" ) InputSourceID="Polish" ;;
3619 | "Polish Pro" ) InputSourceID="PolishPro" ;;
3620 | "Portuguese" ) InputSourceID="Portuguese" ;;
3621 | "Romanian" ) InputSourceID="Romanian" ;;
3622 | "Romanian - Standard" ) InputSourceID="Romanian-Standard" ;;
3623 | "Russian" ) InputSourceID="Russian" ;;
3624 | "Russian - PC" ) InputSourceID="RussianWin" ;;
3625 | "Russian - Phonetic" ) InputSourceID="Russian-Phonetic" ;;
3626 | "Sami - PC" ) InputSourceID="Sami-PC" ;;
3627 | "Serbian" ) InputSourceID="Serbian" ;;
3628 | "Serbian - Latin" ) InputSourceID="Serbian-Latin" ;;
3629 | "Sinhala" ) InputSourceID="Sinhala" ;;
3630 | "Sinhala - QWERTY" ) InputSourceID="Sinhala-QWERTY" ;;
3631 | "Slovak" ) InputSourceID="Slovak" ;;
3632 | "Slovak - QWERTY" ) InputSourceID="Slovak-QWERTY" ;;
3633 | "Slovenian" ) InputSourceID="Slovenian" ;;
3634 | "Spanish" ) InputSourceID="Spanish" ;;
3635 | "Spanish - ISO" ) InputSourceID="Spanish-ISO" ;;
3636 | "Swedish" ) InputSourceID="Swedish" ;;
3637 | "Swedish - Pro" ) InputSourceID="Swedish-Pro" ;;
3638 | "Swedish Sami - PC" ) InputSourceID="SwedishSami-PC" ;;
3639 | "Swiss French" ) InputSourceID="SwissFrench" ;;
3640 | "Swiss German" ) InputSourceID="SwissGerman" ;;
3641 | "Tamil Input Method" )
3642 | case "${2}" in
3643 | "Anjal" ) InputSourceID="Tamil.AnjalIM" ;;
3644 | "Tamil99" ) InputSourceID="Tamil.Tamil99" ;;
3645 | esac ;;
3646 | "Telugu" ) InputSourceID="Telugu" ;;
3647 | "Telugu - QWERTY" ) InputSourceID="Telugu-QWERTY" ;;
3648 | "Thai" ) InputSourceID="Thai" ;;
3649 | "Thai - PattaChote" ) InputSourceID="Thai-PattaChote" ;;
3650 | "Tibetan - Otani" ) InputSourceID="TibetanOtaniUS" ;;
3651 | "Tibetan - QWERTY" ) InputSourceID="Tibetan-QWERTY" ;;
3652 | "Tibetan - Wylie" ) InputSourceID="Tibetan-Wylie" ;;
3653 | "Turkish" ) InputSourceID="Turkish" ;;
3654 | "Turkish - QWERTY" ) InputSourceID="Turkish-QWERTY" ;;
3655 | "Turkish - QWERTY PC" ) InputSourceID="Turkish-QWERTY-PC" ;;
3656 | "U.S." ) InputSourceID="US" ;;
3657 | "U.S. Extended" ) InputSourceID="USExtended" ;;
3658 | "U.S. International - PC" ) InputSourceID="USInternational-PC" ;;
3659 | "Ukrainian" ) InputSourceID="Ukrainian" ;;
3660 | "Unicode Hex Input" ) InputSourceID="UnicodeHexInput" ;;
3661 | "Urdu" ) InputSourceID="Urdu" ;;
3662 | "Uyghur" ) InputSourceID="Uyghur" ;;
3663 | "Uyghur - QWERTY" ) InputSourceID="Uyghur-QWERTY" ;;
3664 | "Vietnamese" ) InputSourceID="Vietnamese" ;;
3665 | "Vietnamese UniKey" )
3666 | case "${2}" in
3667 | "Simple Telex" ) InputSourceID="VietnameseSimpleTelex" ;;
3668 | "Telex" ) InputSourceID="VietnameseTelex" ;;
3669 | "VIQR" ) InputSourceID="VietnameseVIQR" ;;
3670 | "VNI" ) InputSourceID="VietnameseVNI" ;;
3671 | esac ;;
3672 | "Welsh" ) InputSourceID="Welsh" ;;
3673 | esac
3674 | }
3675 |
3676 | # Section: NTP Settings
3677 |
3678 | function set_NTPServerName {
3679 | # ${1}: NTP Server
3680 | case "${1}" in
3681 | "time.apple.com" ) NTPServerName="Apple Americas/U.S. (time.apple.com)" ;;
3682 | "time.asia.apple.com" ) NTPServerName="Apple Asia (time.asia.apple.com)" ;;
3683 | "time.euro.apple.com" ) NTPServerName="Apple Europe (time.euro.apple.com)" ;;
3684 | * ) NTPServerName="${1}" ;;
3685 | esac
3686 | }
3687 |
3688 | function set_NTPServerNames {
3689 | NTPServerNames=( "Apple Americas/U.S. (time.apple.com)" "Apple Asia (time.asia.apple.com)" "Apple Europe (time.euro.apple.com)" )
3690 | j=0 ; for ServerName in "${NTPServerNames[@]}" ; do if [ "${ServerName}" == "${NTPServerName}" ] ; then j=1 ; break ; fi ; done
3691 | if [ ${j} -eq 0 ] ; then NTPServerNames=( "${NTPServerNames[@]}" "${NTPServerName}" ) ; fi
3692 | }
3693 |
3694 | function set_NTPServer {
3695 | # ${1}: NTP Server Name
3696 | case "${1}" in
3697 | "Apple Americas/U.S. (time.apple.com)" ) NTPServer="time.apple.com" ;;
3698 | "Apple Asia (time.asia.apple.com)" ) NTPServer="time.asia.apple.com" ;;
3699 | "Apple Europe (time.euro.apple.com)" ) NTPServer="time.euro.apple.com" ;;
3700 | * ) NTPServer="${1}" ;;
3701 | esac
3702 | }
3703 |
3704 | # Section: Time Zone
3705 |
3706 | function convert_CityToGeonameID {
3707 | # ${1}: City
3708 | case "${1}" in
3709 | "Abu Dhabi" ) echo 292968 ;;
3710 | "Accra" ) echo 2306104 ;;
3711 | "Adak" ) echo 5878818 ;;
3712 | "Addis Ababa" ) echo 344979 ;;
3713 | "Adelaide" ) echo 2078025 ;;
3714 | "Algiers" ) echo 2507480 ;;
3715 | "Amman" ) echo 250441 ;;
3716 | "Amsterdam" ) echo 2759794 ;;
3717 | "Anadyr" ) echo 2127202 ;;
3718 | "Antananarivo" ) echo 1070940 ;;
3719 | "Anchorage" ) echo 5879400 ;;
3720 | "Ankara" ) echo 323786 ;;
3721 | "Ashgabat" ) echo 162183 ;;
3722 | "Asmera" ) echo 343300 ;;
3723 | "Asuncion" ) echo 3439389 ;;
3724 | "Athens" ) echo 264371 ;;
3725 | "Atlanta" ) echo 4180439 ;;
3726 | "Austin" ) echo 4671654 ;;
3727 | "Baghdad" ) echo 98182 ;;
3728 | "Baku" ) echo 587084 ;;
3729 | "Bamako" ) echo 2460596 ;;
3730 | "Bangkok" ) echo 1609350 ;;
3731 | "Bangui" ) echo 2389853 ;;
3732 | "Bridgetown" ) echo 3374036 ;;
3733 | "Beijing" ) echo 1816670 ;;
3734 | "Beirut" ) echo 276781 ;;
3735 | "Belgrade" ) echo 792680 ;;
3736 | "Berlin" ) echo 2950159 ;;
3737 | "Blacksburg" ) echo 4747845 ;;
3738 | "Bogota" ) echo 3688689 ;;
3739 | "Boston" ) echo 4930956 ;;
3740 | "Bratislava" ) echo 3060972 ;;
3741 | "Brasalia" ) echo 3469058 ;;
3742 | "Brisbane" ) echo 2174003 ;;
3743 | "Brussels" ) echo 2800866 ;;
3744 | "Bucharest" ) echo 683506 ;;
3745 | "Budapest" ) echo 3054643 ;;
3746 | "Buenos Aires" ) echo 3435910 ;;
3747 | "Cairo" ) echo 360630 ;;
3748 | "Calgary" ) echo 5913490 ;;
3749 | "Canberra" ) echo 2172517 ;;
3750 | "Canton" ) echo 1809858 ;;
3751 | "Cape Town" ) echo 3369157 ;;
3752 | "Caracas" ) echo 3646738 ;;
3753 | "Cardiff" ) echo 2653822 ;;
3754 | "Cayenne" ) echo 3382160 ;;
3755 | "Chennai" ) echo 1264527 ;;
3756 | "Chicago" ) echo 4887398 ;;
3757 | "Colombo" ) echo 1248991 ;;
3758 | "Columbus" ) echo 4509177 ;;
3759 | "Conakry" ) echo 2422465 ;;
3760 | "Copenhagen" ) echo 2618425 ;;
3761 | "Cupertino" ) echo 5341145 ;;
3762 | "Cork" ) echo 2965140 ;;
3763 | "Dhaka" ) echo 1185241 ;;
3764 | "Dakar" ) echo 2253354 ;;
3765 | "Dallas" ) echo 4684888 ;;
3766 | "Damascus" ) echo 170654 ;;
3767 | "Dar es Salaam" ) echo 160263 ;;
3768 | "Darwin" ) echo 2073124 ;;
3769 | "Denver" ) echo 5419384 ;;
3770 | "Detroit" ) echo 4990729 ;;
3771 | "Djibouti" ) echo 223817 ;;
3772 | "Doha" ) echo 290030 ;;
3773 | "Douala" ) echo 2232593 ;;
3774 | "Dublin" ) echo 2964574 ;;
3775 | "Edinburgh" ) echo 2650225 ;;
3776 | "Freetown" ) echo 2409306 ;;
3777 | "Geneva" ) echo 2660646 ;;
3778 | "Georgetown" ) echo 3378644 ;;
3779 | "Grytviken" ) echo 3426466 ;;
3780 | "Guam" ) echo 4043909 ;;
3781 | "Guatemala" ) echo 3598132 ;;
3782 | "Halifax" ) echo 6324729 ;;
3783 | "Hamburg" ) echo 2911298 ;;
3784 | "Hanoi" ) echo 1581130 ;;
3785 | "Harare" ) echo 890299 ;;
3786 | "Havana" ) echo 3553478 ;;
3787 | "Helsinki" ) echo 658225 ;;
3788 | "Hobart" ) echo 2163355 ;;
3789 | "Hong Kong" ) echo 1819729 ;;
3790 | "Honolulu" ) echo 5856195 ;;
3791 | "Houston" ) echo 4699066 ;;
3792 | "Indianapolis" ) echo 4259418 ;;
3793 | "Islamabad" ) echo 1176615 ;;
3794 | "Istanbul" ) echo 745044 ;;
3795 | "Jakarta" ) echo 1642911 ;;
3796 | "Jerusalem" ) echo 281184 ;;
3797 | "Kabul" ) echo 1138958 ;;
3798 | "Kampala" ) echo 232422 ;;
3799 | "Katmandu" ) echo 1283240 ;;
3800 | "Khartoum" ) echo 379252 ;;
3801 | "Kiev" ) echo 703448 ;;
3802 | "Kinshasa" ) echo 2314302 ;;
3803 | "Knoxville" ) echo 4634946 ;;
3804 | "Kolkata" ) echo 1275004 ;;
3805 | "Krasnoyarsk" ) echo 1502026 ;;
3806 | "Kuala Lumpur" ) echo 1735161 ;;
3807 | "Kuwait" ) echo 285787 ;;
3808 | "La Paz" ) echo 3911925 ;;
3809 | "Lagos" ) echo 2332459 ;;
3810 | "Lima" ) echo 3936456 ;;
3811 | "Lisbon" ) echo 2267057 ;;
3812 | "Ljubljana" ) echo 3196359 ;;
3813 | "London" ) echo 2643743 ;;
3814 | "Los Angeles" ) echo 5368361 ;;
3815 | "Luanda" ) echo 2240449 ;;
3816 | "Lusaka" ) echo 909137 ;;
3817 | "Madrid" ) echo 3117735 ;;
3818 | "Male" ) echo 1282027 ;;
3819 | "Managua" ) echo 3617763 ;;
3820 | "Manama" ) echo 290340 ;;
3821 | "Manchester" ) echo 5089178 ;;
3822 | "Manila" ) echo 1701668 ;;
3823 | "Maputo" ) echo 1040652 ;;
3824 | "Mecca" ) echo 104515 ;;
3825 | "Melbourne" ) echo 2158177 ;;
3826 | "Memphis" ) echo 4641239 ;;
3827 | "Mexico City" ) echo 3530597 ;;
3828 | "Miami" ) echo 4164138 ;;
3829 | "Minneapolis" ) echo 5037649 ;;
3830 | "Magadan" ) echo 2123628 ;;
3831 | "Mogadisho" ) echo 53654 ;;
3832 | "Monrovia" ) echo 2274895 ;;
3833 | "Montevideo" ) echo 3441575 ;;
3834 | "Montreal" ) echo 6077243 ;;
3835 | "Moscow" ) echo 524901 ;;
3836 | "Mumbai" ) echo 1275339 ;;
3837 | "Munich" ) echo 2867714 ;;
3838 | "Muscat" ) echo 287286 ;;
3839 | "Nairobi" ) echo 184745 ;;
3840 | "Ndjamena" ) echo 2427123 ;;
3841 | "New Delhi" ) echo 1261481 ;;
3842 | "New York" ) echo 5128581 ;;
3843 | "Nouakchott" ) echo 2377450 ;;
3844 | "Noumea" ) echo 2139521 ;;
3845 | "Novosibirsk" ) echo 1496747 ;;
3846 | "Nuuk" ) echo 3421319 ;;
3847 | "Omsk" ) echo 1496153 ;;
3848 | "Osaka" ) echo 1853909 ;;
3849 | "Oslo" ) echo 3143244 ;;
3850 | "Ottawa" ) echo 6094817 ;;
3851 | "Ougadougou" ) echo 2357048 ;;
3852 | "Pago Pago" ) echo 5881576 ;;
3853 | "Panama" ) echo 3703443 ;;
3854 | "Paramaribo" ) echo 3383330 ;;
3855 | "Paris" ) echo 2988507 ;;
3856 | "Perth" ) echo 2063523 ;;
3857 | "Philadelphia" ) echo 4560349 ;;
3858 | "Phnom Penh" ) echo 1821306 ;;
3859 | "Phoenix" ) echo 5308655 ;;
3860 | "Ponta Delgada" ) echo 3372783 ;;
3861 | "Port Louis" ) echo 934154 ;;
3862 | "Port-au-Prince" ) echo 3718426 ;;
3863 | "Portland" ) echo 5746545 ;;
3864 | "Prague" ) echo 3067696 ;;
3865 | "Pyongyang" ) echo 1871859 ;;
3866 | "Quito" ) echo 3652462 ;;
3867 | "Rabat" ) echo 2538475 ;;
3868 | "Rangoon" ) echo 1298824 ;;
3869 | "Recife" ) echo 3390760 ;;
3870 | "Regina" ) echo 6119109 ;;
3871 | "Reykjavik" ) echo 3413829 ;;
3872 | "Rio de Janeiro" ) echo 3451190 ;;
3873 | "Riyadh" ) echo 108410 ;;
3874 | "Rome" ) echo 3169070 ;;
3875 | "Salt Lake City" ) echo 5780993 ;;
3876 | "San Diego" ) echo 5391811 ;;
3877 | "San Francisco" ) echo 5391959 ;;
3878 | "San Jose" ) echo 3621849 ;;
3879 | "San Juan" ) echo 4568127 ;;
3880 | "San Salvador" ) echo 3583361 ;;
3881 | "Sanaa" ) echo 71137 ;;
3882 | "Santiago" ) echo 3871336 ;;
3883 | "Santo Domingo" ) echo 3492908 ;;
3884 | "Sao Paulo" ) echo 3448439 ;;
3885 | "Seattle" ) echo 5809844 ;;
3886 | "Seoul" ) echo 1835848 ;;
3887 | "Shanghai" ) echo 1796236 ;;
3888 | "Singapore" ) echo 1880252 ;;
3889 | "Sofia" ) echo 727011 ;;
3890 | "St. John's" ) echo 6324733 ;;
3891 | "St. Louis" ) echo 4407066 ;;
3892 | "St. Petersburg" ) echo 498817 ;;
3893 | "Stockholm" ) echo 2673730 ;;
3894 | "Sydney" ) echo 2147714 ;;
3895 | "Taipei" ) echo 1668341 ;;
3896 | "Tashkent" ) echo 1512569 ;;
3897 | "Tegucigalpa" ) echo 3600949 ;;
3898 | "Tehran" ) echo 112931 ;;
3899 | "Thanh Pho Ho Chi Minh" ) echo 1566083 ;;
3900 | "Tientsin" ) echo 1792947 ;;
3901 | "Tokyo" ) echo 1850147 ;;
3902 | "Toronto" ) echo 6167865 ;;
3903 | "Tripoli" ) echo 2210247 ;;
3904 | "Tunis" ) echo 2464470 ;;
3905 | "Ulaanbaatar" ) echo 2028462 ;;
3906 | "UTC" ) echo 1 ;;
3907 | "Vancouver" ) echo 6173331 ;;
3908 | "Victoria" ) echo 241131 ;;
3909 | "Vienna" ) echo 2761369 ;;
3910 | "Vladivostok" ) echo 2013348 ;;
3911 | "Volgograd" ) echo 472757 ;;
3912 | "Warsaw" ) echo 756135 ;;
3913 | "Washington, D.C." ) echo 4140963 ;;
3914 | "Wellington" ) echo 2179537 ;;
3915 | "Winnipeg" ) echo 6183235 ;;
3916 | "Yakutsk" ) echo 2013159 ;;
3917 | "Yekaterinburg" ) echo 1486209 ;;
3918 | "Yerevan" ) echo 616052 ;;
3919 | "Zagreb" ) echo 3186886 ;;
3920 | "Zurich" ) echo 2657896 ;;
3921 | esac
3922 | }
3923 |
3924 | function set_UseGeoKit {
3925 | GeoKitFramework="${Target}/System/Library/PrivateFrameworks/GeoKit.framework/Resources/world.geokit"
3926 | Query="select ZNAME from ${PLACES} where ZGEONAMEID = 5341145;"
3927 | sqlite3 "${GeoKitFramework}" "${Query}" &>/dev/null
3928 | if [ ${?} -ne 0 ] ; then
3929 | UseGeoKit=0
3930 | if [ ${#all_cities_adj_0[@]} -eq 0 ] ; then
3931 | unset all_cities_adj_0[@] # Latitude
3932 | unset all_cities_adj_1[@] # Longitude
3933 | unset all_cities_adj_2[@] # Group
3934 | unset all_cities_adj_3[@] # TZFile
3935 | unset all_cities_adj_4[@] # CountryCode
3936 | unset all_cities_adj_5[@] # City
3937 | unset all_cities_adj_6[@] # Country
3938 | unset all_cities_adj_7[@] # GeonameID
3939 | unset Localizable_Cities[@]
3940 | unset Localizable_Countries[@]
3941 | display_Title
3942 | printf "\nCreating Location Database ... "
3943 | s=1
3944 | TimeZonePrefPane="${Target}/System/Library/PreferencePanes/DateAndTime.prefPane/Contents/Resources/TimeZone.prefPane"
3945 | IsPlist=`file "${TimeZonePrefPane}/Contents/Resources/English.lproj/Localizable_Cities.strings" | grep -vq "property list" ; echo ${?}`
3946 | i=0 ; while : ; do
3947 | Item0=`/usr/libexec/PlistBuddy -c "Print ':${i}:0'" "${TimeZonePrefPane}/Contents/Resources/all_cities_adj.plist" 2>/dev/null`
3948 | if [ ${?} -ne 0 ] ; then break ; fi
3949 | all_cities_adj_0[i]="${Item0}"
3950 | all_cities_adj_1[i]=`/usr/libexec/PlistBuddy -c "Print ':${i}:1'" "${TimeZonePrefPane}/Contents/Resources/all_cities_adj.plist"`
3951 | all_cities_adj_2[i]=`/usr/libexec/PlistBuddy -c "Print ':${i}:2'" "${TimeZonePrefPane}/Contents/Resources/all_cities_adj.plist"`
3952 | all_cities_adj_3[i]=`/usr/libexec/PlistBuddy -c "Print ':${i}:3'" "${TimeZonePrefPane}/Contents/Resources/all_cities_adj.plist"`
3953 | all_cities_adj_4[i]=`/usr/libexec/PlistBuddy -c "Print ':${i}:4'" "${TimeZonePrefPane}/Contents/Resources/all_cities_adj.plist"`
3954 | all_cities_adj_5[i]=`/usr/libexec/PlistBuddy -c "Print ':${i}:5'" "${TimeZonePrefPane}/Contents/Resources/all_cities_adj.plist"`
3955 | all_cities_adj_6[i]=`/usr/libexec/PlistBuddy -c "Print ':${i}:6'" "${TimeZonePrefPane}/Contents/Resources/all_cities_adj.plist"`
3956 | all_cities_adj_7[i]=$(convert_CityToGeonameID "${all_cities_adj_5[i]}")
3957 | if [ ${IsPlist} -eq 1 ] ; then
3958 | Localizable_Cities[i]=`/usr/libexec/PlistBuddy -c "Print ':${all_cities_adj_5[i]}'" "${TimeZonePrefPane}/Contents/Resources/English.lproj/Localizable_Cities.strings"`
3959 | Localizable_Countries[i]=`/usr/libexec/PlistBuddy -c "Print ':${all_cities_adj_6[i]}'" "${TimeZonePrefPane}/Contents/Resources/English.lproj/Localizable_Countries.strings"`
3960 | else
3961 | Localizable_Cities[i]=`cat "${TimeZonePrefPane}/Contents/Resources/English.lproj/Localizable_Cities.strings" | iconv -f UTF-16 -t UTF-8 --unicode-subst="" | grep "\"${all_cities_adj_5[i]}\"" | awk -F "\"" '{print $4}'`
3962 | Localizable_Countries[i]=`cat "${TimeZonePrefPane}/Contents/Resources/English.lproj/Localizable_Countries.strings" | iconv -f UTF-16 -t UTF-8 --unicode-subst="" | grep "\"${all_cities_adj_6[i]}\"" | awk -F "\"" '{print $4}'`
3963 | fi
3964 | printf "\b${spin:s++%${#spin}:1}"
3965 | let i++
3966 | done
3967 | printf "\bdone\n"
3968 | fi
3969 | else
3970 | UseGeoKit=1
3971 | fi
3972 | }
3973 |
3974 | function set_DefaultGeonameID {
3975 | # ${1}: Country Code
3976 | if [ ${UseGeoKit} -eq 0 ] ; then
3977 | case "${1}" in
3978 | "AE" ) GeonameID=292968 ;;
3979 | "AF" ) GeonameID=1138958 ;;
3980 | "AM" ) GeonameID=616052 ;;
3981 | "AO" ) GeonameID=2240449 ;;
3982 | "AR" ) GeonameID=3435910 ;;
3983 | "AT" ) GeonameID=2761369 ;;
3984 | "AU" ) GeonameID=2172517 ;;
3985 | "AZ" ) GeonameID=587084 ;;
3986 | "BB" ) GeonameID=3374036 ;;
3987 | "BD" ) GeonameID=1185241 ;;
3988 | "BE" ) GeonameID=2800866 ;;
3989 | "BG" ) GeonameID=727011 ;;
3990 | "BH" ) GeonameID=290340 ;;
3991 | "BO" ) GeonameID=3911925 ;;
3992 | "BR" ) GeonameID=3469058 ;;
3993 | "BU" ) GeonameID=1298824 ;;
3994 | "CA" ) GeonameID=6094817 ;;
3995 | "CF" ) GeonameID=2389853 ;;
3996 | "CH" ) GeonameID=2657896 ;;
3997 | "CL" ) GeonameID=3871336 ;;
3998 | "CM" ) GeonameID=2232593 ;;
3999 | "CN" ) GeonameID=1816670 ;;
4000 | "CO" ) GeonameID=3688689 ;;
4001 | "CR" ) GeonameID=3621849 ;;
4002 | "CU" ) GeonameID=3553478 ;;
4003 | "CZ" ) GeonameID=3067696 ;;
4004 | "DE" ) GeonameID=2950159 ;;
4005 | "DJ" ) GeonameID=223817 ;;
4006 | "DK" ) GeonameID=2618425 ;;
4007 | "DO" ) GeonameID=3492908 ;;
4008 | "DZ" ) GeonameID=2507480 ;;
4009 | "EC" ) GeonameID=3652462 ;;
4010 | "EG" ) GeonameID=360630 ;;
4011 | "ER" ) GeonameID=343300 ;;
4012 | "ES" ) GeonameID=3117735 ;;
4013 | "ET" ) GeonameID=344979 ;;
4014 | "FI" ) GeonameID=658225 ;;
4015 | "FR" ) GeonameID=2988507 ;;
4016 | "GB" ) GeonameID=2643743 ;;
4017 | "GF" ) GeonameID=3382160 ;;
4018 | "GH" ) GeonameID=2306104 ;;
4019 | "GL" ) GeonameID=3421319 ;;
4020 | "GN" ) GeonameID=2422465 ;;
4021 | "GR" ) GeonameID=264371 ;;
4022 | "GS" ) GeonameID=3426466 ;;
4023 | "GT" ) GeonameID=3598132 ;;
4024 | "GU" ) GeonameID=4043909 ;;
4025 | "GY" ) GeonameID=3378644 ;;
4026 | "HK" ) GeonameID=1819729 ;;
4027 | "HN" ) GeonameID=3600949 ;;
4028 | "HR" ) GeonameID=3186886 ;;
4029 | "HT" ) GeonameID=3718426 ;;
4030 | "HU" ) GeonameID=3054643 ;;
4031 | "HV" ) GeonameID=2357048 ;;
4032 | "ID" ) GeonameID=1642911 ;;
4033 | "IE" ) GeonameID=2964574 ;;
4034 | "IL" ) GeonameID=281184 ;;
4035 | "IN" ) GeonameID=1261481 ;;
4036 | "IQ" ) GeonameID=98182 ;;
4037 | "IR" ) GeonameID=112931 ;;
4038 | "IS" ) GeonameID=3413829 ;;
4039 | "IT" ) GeonameID=3169070 ;;
4040 | "JO" ) GeonameID=250441 ;;
4041 | "JP" ) GeonameID=1850147 ;;
4042 | "KE" ) GeonameID=184745 ;;
4043 | "KH" ) GeonameID=1821306 ;;
4044 | "KR" ) GeonameID=1835848 ;;
4045 | "KW" ) GeonameID=285787 ;;
4046 | "LB" ) GeonameID=276781 ;;
4047 | "LK" ) GeonameID=1248991 ;;
4048 | "LR" ) GeonameID=2274895 ;;
4049 | "LY" ) GeonameID=2210247 ;;
4050 | "MA" ) GeonameID=2538475 ;;
4051 | "MG" ) GeonameID=1070940 ;;
4052 | "ML" ) GeonameID=2460596 ;;
4053 | "MN" ) GeonameID=2028462 ;;
4054 | "MR" ) GeonameID=2377450 ;;
4055 | "MU" ) GeonameID=934154 ;;
4056 | "MV" ) GeonameID=1282027 ;;
4057 | "MX" ) GeonameID=3530597 ;;
4058 | "MY" ) GeonameID=1735161 ;;
4059 | "MZ" ) GeonameID=1040652 ;;
4060 | "NC" ) GeonameID=2139521 ;;
4061 | "NG" ) GeonameID=2332459 ;;
4062 | "NI" ) GeonameID=3617763 ;;
4063 | "NL" ) GeonameID=2759794 ;;
4064 | "NO" ) GeonameID=3143244 ;;
4065 | "NP" ) GeonameID=1283240 ;;
4066 | "NZ" ) GeonameID=2179537 ;;
4067 | "OM" ) GeonameID=287286 ;;
4068 | "PA" ) GeonameID=3703443 ;;
4069 | "PE" ) GeonameID=3936456 ;;
4070 | "PH" ) GeonameID=1701668 ;;
4071 | "PK" ) GeonameID=1176615 ;;
4072 | "PL" ) GeonameID=756135 ;;
4073 | "PT" ) GeonameID=2267057 ;;
4074 | "PY" ) GeonameID=3439389 ;;
4075 | "QA" ) GeonameID=290030 ;;
4076 | "RO" ) GeonameID=683506 ;;
4077 | "RU" ) GeonameID=524901 ;;
4078 | "SA" ) GeonameID=108410 ;;
4079 | "SC" ) GeonameID=241131 ;;
4080 | "SD" ) GeonameID=379252 ;;
4081 | "SE" ) GeonameID=2673730 ;;
4082 | "SG" ) GeonameID=1880252 ;;
4083 | "SI" ) GeonameID=3196359 ;;
4084 | "SK" ) GeonameID=3060972 ;;
4085 | "SL" ) GeonameID=2409306 ;;
4086 | "SN" ) GeonameID=2253354 ;;
4087 | "SO" ) GeonameID=53654 ;;
4088 | "SR" ) GeonameID=3383330 ;;
4089 | "SV" ) GeonameID=3583361 ;;
4090 | "SY" ) GeonameID=170654 ;;
4091 | "TD" ) GeonameID=2427123 ;;
4092 | "TH" ) GeonameID=1609350 ;;
4093 | "TM" ) GeonameID=162183 ;;
4094 | "TN" ) GeonameID=2464470 ;;
4095 | "TR" ) GeonameID=323786 ;;
4096 | "TW" ) GeonameID=1668341 ;;
4097 | "TZ" ) GeonameID=160263 ;;
4098 | "UA" ) GeonameID=703448 ;;
4099 | "UG" ) GeonameID=232422 ;;
4100 | "UY" ) GeonameID=3441575 ;;
4101 | "UZ" ) GeonameID=1512569 ;;
4102 | "VE" ) GeonameID=3646738 ;;
4103 | "VN" ) GeonameID=1581130 ;;
4104 | "WS" ) GeonameID=5881576 ;;
4105 | "YD" ) GeonameID=71137 ;;
4106 | "YU" ) GeonameID=792680 ;;
4107 | "ZA" ) GeonameID=3369157 ;;
4108 | "ZM" ) GeonameID=909137 ;;
4109 | "ZR" ) GeonameID=2314302 ;;
4110 | "ZW" ) GeonameID=890299 ;;
4111 | * ) GeonameID=5341145 ;;
4112 | esac
4113 | else
4114 | Query="select Z_PK from ${PLACES} where ZCODE = '${1}';"
4115 | ZCOUNTRY=`sqlite3 "${GeoKitFramework}" "${Query}"`
4116 | Query="select ZGEONAMEID from ${PLACES} where ZCOUNTRY = ${ZCOUNTRY} and ZISCAPITAL = 1;"
4117 | ZGEONAMEID=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
4118 | if [ "${1}" == "US" ] || [ -z "${ZGEONAMEID}" ] ; then ZGEONAMEID=5341145 ; fi
4119 | GeonameID=${ZGEONAMEID}
4120 | fi
4121 | }
4122 |
4123 | function set_TZCountryCode {
4124 | # ${1}: GeonameID
4125 | if [ ${UseGeoKit} -eq 0 ] ; then
4126 | i=0 ; for Item in "${all_cities_adj_7[@]}" ; do
4127 | if [ "${Item}" == "${1}" ] ; then break ; fi
4128 | let i++
4129 | done
4130 | TZCountryCode="${all_cities_adj_4[i]}"
4131 | else
4132 | Query="select ZCOUNTRY from ${PLACES} where ZGEONAMEID = ${1};"
4133 | ZCOUNTRY=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
4134 | Query="select ZCODE from ${PLACES} where Z_PK = ${ZCOUNTRY};"
4135 | TZCountryCode=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
4136 | fi
4137 | }
4138 |
4139 | function set_TZCountry {
4140 | # ${1}: Country Code
4141 | if [ ${UseGeoKit} -eq 0 ] ; then
4142 | i=0 ; for Item in "${all_cities_adj_4[@]}" ; do
4143 | if [ "${Item}" == "${1}" ] ; then break ; fi
4144 | let i++
4145 | done
4146 | echo "${Localizable_Countries[i]}"
4147 | else
4148 | Query="select ZNAME from ${PLACES} where ZCODE = '${1}';"
4149 | sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null
4150 | fi
4151 | }
4152 |
4153 | function set_ClosestCity {
4154 | # ${1}: GeonameID
4155 | if [ ${UseGeoKit} -eq 0 ] ; then
4156 | i=0 ; for Item in "${all_cities_adj_7[@]}" ; do
4157 | if [ "${Item}" == "${1}" ] ; then break ; fi
4158 | let i++
4159 | done
4160 | ZNAME="${Localizable_Cities[i]}"
4161 | else
4162 | Query="select ZNAME from ${PLACES} where ZGEONAMEID = ${1};"
4163 | ZNAME=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
4164 | Query="select ZREGIONALCODE from ${PLACES} where ZGEONAMEID = ${1};"
4165 | ZREGIONALCODE=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
4166 | fi
4167 | if [ -n "${ZREGIONALCODE}" ] ; then
4168 | echo "${ZNAME}, ${ZREGIONALCODE}"
4169 | else
4170 | echo "${ZNAME}"
4171 | fi
4172 | }
4173 |
4174 | function set_TZFile {
4175 | # ${1}: GeonameID
4176 | if [ ${UseGeoKit} -eq 0 ] ; then
4177 | i=0 ; for Item in "${all_cities_adj_7[@]}" ; do
4178 | if [ "${Item}" == "${1}" ] ; then break ; fi
4179 | let i++
4180 | done
4181 | echo "${all_cities_adj_3[i]}"
4182 | else
4183 | Query="select ZTIMEZONENAME from ${PLACES} where ZGEONAMEID = ${1};"
4184 | sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null
4185 | fi
4186 | }
4187 |
4188 | function set_TimeZone {
4189 | # ${1}: TZFile
4190 | case "${1}" in
4191 | "Africa/Abidjan" | "Africa/Accra" | "Africa/Bamako" | "Africa/Banjul" | "Africa/Bissau" | "Africa/Conakry" | "Africa/Dakar" | "Africa/Freetown" | "Africa/Lome" | "Africa/Monrovia" | "Africa/Nouakchott" | "Africa/Ouagadougou" | "Africa/Sao_Tome" | "Atlantic/Reykjavik" | "Atlantic/St_Helena" | "Europe/Dublin" | "Europe/Guernsey" | "Europe/Isle_of_Man" | "Europe/Jersey" | "Europe/London" ) echo "Greenwich Mean Time" ;;
4192 | "Africa/Addis_Ababa" | "Africa/Asmara" | "Africa/Asmera" | "Africa/Dar_es_Salaam" | "Africa/Djibouti" | "Africa/Kampala" | "Africa/Khartoum" | "Africa/Mogadishu" | "Africa/Nairobi" | "Indian/Antananarivo" | "Indian/Comoro" | "Indian/Mayotte" ) echo "East Africa Time" ;;
4193 | "Africa/Algiers" | "Africa/Ceuta" | "Africa/Tunis" | "Arctic/Longyearbyen" | "Europe/Amsterdam" | "Europe/Andorra" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Bratislava" | "Europe/Brussels" | "Europe/Budapest" | "Europe/Copenhagen" | "Europe/Gibraltar" | "Europe/Ljubljana" | "Europe/Luxembourg" | "Europe/Madrid" | "Europe/Malta" | "Europe/Monaco" | "Europe/Oslo" | "Europe/Paris" | "Europe/Podgorica" | "Europe/Prague" | "Europe/Rome" | "Europe/San_Marino" | "Europe/Sarajevo" | "Europe/Skopje" | "Europe/Stockholm" | "Europe/Tirane" | "Europe/Vaduz" | "Europe/Vatican" | "Europe/Vienna" | "Europe/Warsaw" | "Europe/Zagreb" | "Europe/Zurich" ) echo "Central European Time" ;;
4194 | "Africa/Bangui" | "Africa/Brazzaville" | "Africa/Douala" | "Africa/Kinshasa" | "Africa/Lagos" | "Africa/Libreville" | "Africa/Luanda" | "Africa/Malabo" | "Africa/Ndjamena" | "Africa/Niamey" | "Africa/Porto-Novo" | "Africa/Windhoek" ) echo "West Africa Time" ;;
4195 | "Africa/Blantyre" | "Africa/Bujumbura" | "Africa/Gaborone" | "Africa/Harare" | "Africa/Kigali" | "Africa/Lubumbashi" | "Africa/Lusaka" | "Africa/Maputo" ) echo "Central Africa Time" ;;
4196 | "Africa/Cairo" | "Africa/Tripoli" | "Asia/Amman" | "Asia/Beirut" | "Asia/Damascus" | "Asia/Gaza" | "Asia/Nicosia" | "Europe/Athens" | "Europe/Bucharest" | "Europe/Chisinau" | "Europe/Helsinki" | "Europe/Istanbul" | "Europe/Kiev" | "Europe/Riga" | "Europe/Simferopol" | "Europe/Sofia" | "Europe/Tallinn" | "Europe/Uzhgorod" | "Europe/Vilnius" | "Europe/Zaporozhye" ) echo "Eastern European Time" ;;
4197 | "Africa/Casablanca" | "Africa/El_Aaiun" | "Atlantic/Canary" | "Atlantic/Faroe" | "Atlantic/Madeira" | "Europe/Lisbon" ) echo "Western European Time" ;;
4198 | "Africa/Johannesburg" | "Africa/Maseru" | "Africa/Mbabane" ) echo "South Africa Standard Time" ;;
4199 | "America/Adak" | "Pacific/Honolulu" ) echo "Hawaii-Aleutian Standard Time" ;;
4200 | "America/Anchorage" | "America/Juneau" | "America/Nome" ) echo "Alaska Standard Time" ;;
4201 | "America/Anguilla" | "America/Antigua" | "America/Aruba" | "America/Barbados" | "America/Curacao" | "America/Dominica" | "America/Glace_Bay" | "America/Grenada" | "America/Guadeloupe" | "America/Halifax" | "America/Martinique" | "America/Moncton" | "America/Montserrat" | "America/Port_of_Spain" | "America/Puerto_Rico" | "America/Santo_Domingo" | "America/St_Kitts" | "America/St_Lucia" | "America/St_Thomas" | "America/St_Vincent" | "America/Tortola" | "Atlantic/Bermuda" | "Canada/Atlantic" ) echo "Atlantic Standard Time" ;;
4202 | "America/Araguaina" | "America/Bahia" | "America/Belem" | "America/Fortaleza" | "America/Maceio" | "America/Recife" | "America/Santarem" | "America/Sao_Paulo" | "Brazil/East" ) echo "Brasilia Time" ;;
4203 | "America/Argentina/Buenos_Aires" | "America/Argentina/Catamarca" | "America/Argentina/Cordoba" | "America/Argentina/Jujuy" | "America/Argentina/La_Rioja" | "America/Argentina/Mendoza" | "America/Argentina/Rio_Gallegos" | "America/Argentina/Salta" | "America/Argentina/San_Juan" | "America/Argentina/Tucuman" | "America/Argentina/Ushuaia" | "America/Buenos_Aires" ) echo "Argentina Time" ;;
4204 | "America/Argentina/San_Luis" ) echo "GMT-03:00" ;;
4205 | "America/Asuncion" ) echo "Paraguay Time" ;;
4206 | "America/Belize" | "America/Cancun" | "America/Chicago" | "America/Costa_Rica" | "America/El_Salvador" | "America/Guatemala" | "America/Indiana/Tell_City" | "America/Managua" | "America/Matamoros" | "America/Merida" | "America/Mexico_City" | "America/Monterrey" | "America/North_Dakota/New_Salem" | "America/Regina" | "America/Swift_Current" | "America/Tegucigalpa" | "America/Winnipeg" | "Canada/Saskatchewan" | "US/Central" ) echo "Central Standard Time" ;;
4207 | "America/Boa_Vista" | "America/Campo_Grande" | "America/Cuiaba" | "America/Manaus" | "America/Porto_Velho" | "America/Rio_Branco" ) echo "Amazon Time" ;;
4208 | "America/Bogota" ) echo "Colombia Time" ;;
4209 | "America/Boise" | "America/Chihuahua" | "America/Dawson_Creek" | "America/Denver" | "America/Edmonton" | "America/Hermosillo" | "America/Mazatlan" | "America/Ojinaga" | "America/Phoenix" | "America/Yellowknife" | "Canada/Mountain" | "US/Mountain" ) echo "Mountain Standard Time" ;;
4210 | "America/Caracas" ) echo "Venezuela Time" ;;
4211 | "America/Cayenne" ) echo "French Guiana Time" ;;
4212 | "America/Cayman" | "America/Detroit" | "America/Grand_Turk" | "America/Indiana/Indianapolis" | "America/Indiana/Vincennes" | "America/Indianapolis" | "America/Jamaica" | "America/Kentucky/Louisville" | "America/Kentucky/Monticello" | "America/Montreal" | "America/Nassau" | "America/New_York" | "America/Nipigon" | "America/Panama" | "America/Port-au-Prince" | "America/Thunder_Bay" | "America/Toronto" | "Canada/Eastern" | "US/Eastern" ) echo "Eastern Standard Time" ;;
4213 | "America/Godthab" ) echo "West Greenland Time" ;;
4214 | "America/Guayaquil" ) echo "Ecuador Time" ;;
4215 | "America/Guyana" ) echo "Guyana Time" ;;
4216 | "America/Havana" ) echo "Cuba Standard Time" ;;
4217 | "America/La_Paz" ) echo "Bolivia Time" ;;
4218 | "America/Lima" ) echo "Peru Time" ;;
4219 | "America/Los_Angeles" | "America/Santa_Isabel" | "America/Tijuana" | "America/Vancouver" | "America/Whitehorse" | "US/Pacific" ) echo "Pacific Standard Time" ;;
4220 | "America/Miquelon" ) echo "Pierre and Miquelon Standard Time" ;;
4221 | "America/Montevideo" ) echo "Uruguay Time" ;;
4222 | "America/Noronha" ) echo "Fernando de Noronha Time" ;;
4223 | "America/Paramaribo" ) echo "Suriname Time" ;;
4224 | "America/Santiago" ) echo "Chile Time" ;;
4225 | "America/St_Johns" | "Canada/Newfoundland" ) echo "Newfoundland Standard Time" ;;
4226 | "Antarctica/McMurdo" | "Pacific/Auckland" ) echo "New Zealand Standard Time" ;;
4227 | "Asia/Aden" | "Asia/Baghdad" | "Asia/Bahrain" | "Asia/Kuwait" | "Asia/Qatar" | "Asia/Riyadh" ) echo "Arabian Standard Time" ;;
4228 | "Asia/Almaty" | "Asia/Qyzylorda" ) echo "East Kazakhstan Standard Time" ;;
4229 | "Asia/Anadyr" )
4230 | case ${TargetOSMinor} in
4231 | 7 ) echo "Magadan Time" ;;
4232 | * ) echo "Anadyr Time" ;;
4233 | esac ;;
4234 | "Asia/Aqtau" | "Asia/Aqtobe" | "Asia/Oral" ) echo "West Kazakhstan Standard Time" ;;
4235 | "Asia/Ashgabat" ) echo "Turkmenistan Time" ;;
4236 | "Asia/Baku" ) echo "Azerbaijan Time" ;;
4237 | "Asia/Bangkok" | "Asia/Ho_Chi_Minh" | "Asia/Phnom_Penh" | "Asia/Saigon" | "Asia/Vientiane" ) echo "Indochina Time" ;;
4238 | "Asia/Bishkek" ) echo "Kyrgyzstan Time" ;;
4239 | "Asia/Brunei" ) echo "Brunei Darussalam Time" ;;
4240 | "Asia/Calcutta" | "Asia/Colombo" | "Asia/Kolkata" ) echo "India Standard Time" ;;
4241 | "Asia/Chongqing" | "Asia/Harbin" | "Asia/Kashgar" | "Asia/Macau" | "Asia/Shanghai" | "Asia/Urumqi" ) echo "China Standard Time" ;;
4242 | "Asia/Dhaka" )
4243 | case ${TargetOSMinor} in
4244 | 5 ) echo "GMT+07:00" ;;
4245 | * ) echo "Bangladesh Time" ;;
4246 | esac ;;
4247 | "Asia/Dili" ) echo "East Timor Time" ;;
4248 | "Asia/Dubai" | "Asia/Muscat" ) echo "Gulf Standard Time" ;;
4249 | "Asia/Dushanbe" ) echo "Tajikistan Time" ;;
4250 | "Asia/Hong_Kong" ) echo "Hong Kong Time" ;;
4251 | "Asia/Irkutsk" ) echo "Irkutsk Time" ;;
4252 | "Asia/Jakarta" | "Asia/Pontianak" ) echo "Western Indonesia Time" ;;
4253 | "Asia/Jayapura" ) echo "Eastern Indonesia Time" ;;
4254 | "Asia/Jerusalem" ) echo "Israel Standard Time" ;;
4255 | "Asia/Kabul" ) echo "Afghanistan Time" ;;
4256 | "Asia/Kamchatka" )
4257 | case ${TargetOSMinor} in
4258 | 7 ) echo "Magadan Time" ;;
4259 | * ) echo "Petropavlovsk-Kamchatski Time" ;;
4260 | esac ;;
4261 | "Asia/Karachi" ) echo "Pakistan Time" ;;
4262 | "Asia/Kathmandu" | "Asia/Katmandu" ) echo "Nepal Time" ;;
4263 | "Asia/Krasnoyarsk" ) echo "Krasnoyarsk Time" ;;
4264 | "Asia/Kuala_Lumpur" | "Asia/Kuching" ) echo "Malaysia Time" ;;
4265 | "Asia/Magadan" ) echo "Magadan Time" ;;
4266 | "Asia/Makassar" ) echo "Central Indonesia Time" ;;
4267 | "Asia/Manila" ) echo "Philippine Time" ;;
4268 | "Asia/Novokuznetsk" ) echo "Novosibirsk Time" ;;
4269 | "Asia/Novosibirsk" )
4270 | case ${TargetOSMinor} in
4271 | 5 ) echo "Novosibirsk Time" ;;
4272 | * ) echo "Krasnoyarsk Time" ;;
4273 | esac ;;
4274 | "Asia/Omsk" ) echo "Omsk Time" ;;
4275 | "Asia/Pyongyang" | "Asia/Seoul" ) echo "Korean Standard Time" ;;
4276 | "Asia/Rangoon" ) echo "Myanmar Time" ;;
4277 | "Asia/Sakhalin" ) echo "Sakhalin Time" ;;
4278 | "Asia/Samarkand" | "Asia/Tashkent" ) echo "Uzbekistan Time" ;;
4279 | "Asia/Singapore" ) echo "Singapore Standard Time" ;;
4280 | "Asia/Taipei" )
4281 | case ${TargetOSMinor} in
4282 | 7 ) echo "Taipei Standard Time" ;;
4283 | * ) echo "GMT+08:00" ;;
4284 | esac ;;
4285 | "Asia/Tbilisi" ) echo "Georgia Time" ;;
4286 | "Asia/Tehran" ) echo "Iran Standard Time" ;;
4287 | "Asia/Thimphu" ) echo "Bhutan Time" ;;
4288 | "Asia/Tokyo" ) echo "Japan Standard Time" ;;
4289 | "Asia/Ulaanbaatar" ) echo "Ulan Bator Time" ;;
4290 | "Asia/Vladivostok" ) echo "Vladivostok Time" ;;
4291 | "Asia/Yakutsk" ) echo "Yakutsk Time" ;;
4292 | "Asia/Yekaterinburg" ) echo "Yekaterinburg Time" ;;
4293 | "Asia/Yerevan" ) echo "Armenia Time" ;;
4294 | "Atlantic/Azores" ) echo "Azores Time" ;;
4295 | "Atlantic/Cape_Verde" ) echo "Cape Verde Time" ;;
4296 | "Atlantic/South_Georgia" ) echo "South Georgia Time" ;;
4297 | "Atlantic/Stanley" ) echo "Falkland Islands Time" ;;
4298 | "Australia/Adelaide" | "Australia/Broken_Hill" | "Australia/Darwin" ) echo "Australian Central Standard Time" ;;
4299 | "Australia/Brisbane" | "Australia/Canberra" | "Australia/Hobart" | "Australia/Melbourne" | "Australia/Sydney" ) echo "Australian Eastern Standard Time" ;;
4300 | "Australia/Perth" ) echo "Australian Western Standard Time" ;;
4301 | "Europe/Kaliningrad" )
4302 | case ${TargetOSMinor} in
4303 | 6 ) echo "Eastern European Time" ;;
4304 | * ) echo "GMT+03:00" ;;
4305 | esac ;;
4306 | "Europe/Minsk" )
4307 | case ${TargetOSMinor} in
4308 | 6 ) echo "Eastern European Time" ;;
4309 | * ) echo "GMT+03:00" ;;
4310 | esac ;;
4311 | "Europe/Moscow" ) echo "Moscow Standard Time" ;;
4312 | "Europe/Samara" )
4313 | case ${TargetOSMinor} in
4314 | 7 ) echo "Moscow Standard Time" ;;
4315 | * ) echo "Samara Time" ;;
4316 | esac ;;
4317 | "Europe/Volgograd" ) echo "Volgograd Time" ;;
4318 | "Indian/Christmas" ) echo "Christmas Island Time" ;;
4319 | "Indian/Cocos" ) echo "Cocos Islands Time" ;;
4320 | "Indian/Kerguelen" ) echo "French Southern and Antarctic Time" ;;
4321 | "Indian/Mahe" ) echo "Seychelles Time" ;;
4322 | "Indian/Maldives" ) echo "Maldives Time" ;;
4323 | "Indian/Mauritius" ) echo "Mauritius Time" ;;
4324 | "Indian/Reunion" ) echo "Reunion Time" ;;
4325 | "Pacific/Apia" | "Pacific/Pago_Pago" ) echo "Samoa Standard Time" ;;
4326 | "Pacific/Efate" ) echo "Vanuatu Time" ;;
4327 | "Pacific/Fiji" ) echo "Fiji Time" ;;
4328 | "Pacific/Funafuti" ) echo "Tuvalu Time" ;;
4329 | "Pacific/Guadalcanal" ) echo "Solomon Islands Time" ;;
4330 | "Pacific/Guam" | "Pacific/Saipan" ) echo "Chamorro Standard Time" ;;
4331 | "Pacific/Majuro" ) echo "Marshall Islands Time" ;;
4332 | "Pacific/Nauru" ) echo "Nauru Time" ;;
4333 | "Pacific/Niue" ) echo "Niue Time" ;;
4334 | "Pacific/Norfolk" ) echo "Norfolk Islands Time" ;;
4335 | "Pacific/Noumea" ) echo "New Caledonia Time" ;;
4336 | "Pacific/Palau" ) echo "Palau Time" ;;
4337 | "Pacific/Pitcairn" ) echo "Pitcairn Time" ;;
4338 | "Pacific/Pohnpei" | "Pacific/Ponape" ) echo "Ponape Time" ;;
4339 | "Pacific/Port_Moresby" ) echo "Papua New Guinea Time" ;;
4340 | "Pacific/Rarotonga" ) echo "Cook Islands Time" ;;
4341 | "Pacific/Tahiti" ) echo "Tahiti Time" ;;
4342 | "Pacific/Tarawa" ) echo "Gilbert Islands Time" ;;
4343 | "Pacific/Tongatapu" ) echo "Tonga Time" ;;
4344 | "Pacific/Wallis" ) echo "Wallis and Futuna Time" ;;
4345 | "UTC" ) echo "GMT+00:00" ;;
4346 | esac
4347 | }
4348 |
4349 | function refresh_GeonameID {
4350 | set_UseGeoKit
4351 | j=0
4352 | if [ ${UseGeoKit} -eq 0 ] ; then
4353 | for Item in "${all_cities_adj_7[@]}" ; do
4354 | if [ "${Item}" == "${GeonameID}" ] ; then j=1 ; fi
4355 | done
4356 | else
4357 | Query="select ZGEONAMEID from ${PLACES} where ZGEONAMEID = ${GeonameID};"
4358 | ZGEONAMEID=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
4359 | if [ -n "${ZGEONAMEID}" ] ; then j=1 ; fi
4360 | fi
4361 | if [ ${j} -eq 0 ] ; then
4362 | if [ -n "${TZCountryCode}" ] ; then
4363 | set_DefaultGeonameID "${TZCountryCode}"
4364 | else
4365 | set_DefaultGeonameID "${SACountryCode}"
4366 | fi
4367 | fi
4368 | set_TZCountryCode ${GeonameID}
4369 | TZCountry=$(set_TZCountry "${TZCountryCode}")
4370 | ClosestCity="$(set_ClosestCity ${GeonameID})"
4371 | TimeZone=$(set_TimeZone "$(set_TZFile ${GeonameID})")
4372 | }
4373 |
4374 | function set_CountryTimeZones {
4375 | # ${1}: Country Code
4376 | unset CountryTZFiles[@]
4377 | if [ ${UseGeoKit} -eq 0 ] ; then
4378 | i=0 ; while [ ${i} -lt ${#all_cities_adj_4[@]} ] ; do
4379 | j=0
4380 | if [ "${all_cities_adj_4[i]}" == "${1}" ] ; then
4381 | j=1
4382 | for TZFILE in "${CountryTZFiles[@]}" ; do
4383 | if [ "${TZFILE}" == "${all_cities_adj_3[i]}" ] ; then j=0 ; break ; fi
4384 | done
4385 | fi
4386 | if [ ${j} -eq 1 ] ; then CountryTZFiles=( "${CountryTZFiles[@]}" "${all_cities_adj_3[i]}" ) ; fi
4387 | let i++
4388 | done
4389 | else
4390 | Query="select Z_PK from ${PLACES} where ZCODE = '${1}';"
4391 | ZCOUNTRY=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
4392 | if [ -z "${ZCOUNTRY}" ] ; then
4393 | Query="select Z_PK from ${PLACES} where ZCODE = 'US';"
4394 | ZCOUNTRY=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
4395 | fi
4396 | Query="select distinct ZTIMEZONENAME from ${PLACES} where ZCOUNTRY = ${ZCOUNTRY};"
4397 | CountryTZFiles=( `sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null` )
4398 | fi
4399 | unset CountryTimeZones[@]
4400 | for TZFILE in "${CountryTZFiles[@]}" ; do
4401 | TZFILETIMEZONE=$(set_TimeZone "${TZFILE}")
4402 | j=1
4403 | for TIMEZONE in "${CountryTimeZones[@]}" ; do
4404 | if [ "${TZFILETIMEZONE}" == "${TIMEZONE}" ] ; then j=0 ; fi
4405 | done
4406 | if [ ${j} -eq 1 ] ; then CountryTimeZones=( "${CountryTimeZones[@]}" "${TZFILETIMEZONE}" ) ; fi
4407 | done
4408 | IFS=$'\n'
4409 | CountryTimeZones=( `for TIMEZONE in "${CountryTimeZones[@]}" ; do echo "${TIMEZONE}" ; done | sort -u` )
4410 | unset IFS
4411 | }
4412 |
4413 | function set_AllTimeZones {
4414 | unset AllTZFiles[@]
4415 | display_Title
4416 | printf "\nCreating Time Zone list ... "
4417 | s=1
4418 | if [ ${UseGeoKit} -eq 0 ] ; then
4419 | i=0 ; while [ ${i} -lt ${#all_cities_adj_3[@]} ] ; do
4420 | j=1
4421 | for TZFILE in "${AllTZFiles[@]}" ; do
4422 | if [ "${TZFILE}" == "${all_cities_adj_3[i]}" ] ; then j=0 ; break ; fi
4423 | printf "\b${spin:s++%${#spin}:1}"
4424 | done
4425 | if [ ${j} -eq 1 ] ; then AllTZFiles=( "${AllTZFiles[@]}" "${all_cities_adj_3[i]}" ) ; fi
4426 | let i++
4427 | done
4428 | else
4429 | Query="select distinct ZTIMEZONENAME from ZGEOPLACE;"
4430 | AllTZFiles=( `sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null` )
4431 | fi
4432 | unset AllTimeZones[@]
4433 | for TZFILE in "${AllTZFiles[@]}" ; do
4434 | TZFILETIMEZONE=$(set_TimeZone "${TZFILE}")
4435 | j=1
4436 | for TIMEZONE in "${AllTimeZones[@]}" ; do
4437 | if [ "${TZFILETIMEZONE}" == "${TIMEZONE}" ] ; then j=0 ; fi
4438 | printf "\b${spin:s++%${#spin}:1}"
4439 | done
4440 | if [ ${j} -eq 1 ] ; then AllTimeZones=( "${AllTimeZones[@]}" "${TZFILETIMEZONE}" ) ; fi
4441 | done
4442 | printf "\bdone\n"
4443 | }
4444 |
4445 | function set_OtherTimeZones {
4446 | set_AllTimeZones
4447 | unset OtherTimeZones[@]
4448 | for TIMEZONE in "${AllTimeZones[@]}" ; do
4449 | j=0 ; for COUNTRYTIMEZONE in "${CountryTimeZones[@]}" ; do
4450 | if [ "${TIMEZONE}" == "${COUNTRYTIMEZONE}" ] ; then j=1 ; break ; fi
4451 | done
4452 | if [ ${j} -eq 0 ] ; then OtherTimeZones=( "${OtherTimeZones[@]}" "${TIMEZONE}" ) ; fi
4453 | done
4454 | IFS=$'\n'
4455 | OtherTimeZones=( `for TIMEZONE in "${OtherTimeZones[@]}" ; do echo "${TIMEZONE}" ; done | sort -u` )
4456 | unset IFS
4457 | }
4458 |
4459 | function set_TZFiles {
4460 | # ${1}: Time Zone
4461 | case "${1}" in
4462 | "Afghanistan Time" ) TZFiles=( "Asia/Kabul" ) ;;
4463 | "Alaska Standard Time" ) TZFiles=( "America/Anchorage" "America/Juneau" "America/Nome" ) ;;
4464 | "Amazon Time" ) TZFiles=( "America/Boa_Vista" "America/Campo_Grande" "America/Cuiaba" "America/Manaus" "America/Porto_Velho" "America/Rio_Branco" ) ;;
4465 | "Anadyr Time" ) TZFiles=( "Asia/Anadyr" ) ;;
4466 | "Arabian Standard Time" ) TZFiles=( "Asia/Aden" "Asia/Baghdad" "Asia/Bahrain" "Asia/Kuwait" "Asia/Qatar" "Asia/Riyadh" ) ;;
4467 | "Argentina Time" ) TZFiles=( "America/Argentina/Buenos_Aires" "America/Argentina/Catamarca" "America/Argentina/Cordoba" "America/Argentina/Jujuy" "America/Argentina/La_Rioja" "America/Argentina/Mendoza" "America/Argentina/Rio_Gallegos" "America/Argentina/Salta" "America/Argentina/San_Juan" "America/Argentina/Tucuman" "America/Argentina/Ushuaia" "America/Buenos_Aires" ) ;;
4468 | "Armenia Time" ) TZFiles=( "Asia/Yerevan" ) ;;
4469 | "Atlantic Standard Time" ) TZFiles=( "America/Anguilla" "America/Antigua" "America/Aruba" "America/Barbados" "America/Curacao" "America/Dominica" "America/Glace_Bay" "America/Grenada" "America/Guadeloupe" "America/Halifax" "America/Martinique" "America/Moncton" "America/Montserrat" "America/Port_of_Spain" "America/Puerto_Rico" "America/Santo_Domingo" "America/St_Kitts" "America/St_Lucia" "America/St_Thomas" "America/St_Vincent" "America/Tortola" "Atlantic/Bermuda" "Canada/Atlantic" ) ;;
4470 | "Australian Central Standard Time" ) TZFiles=( "Australia/Adelaide" "Australia/Broken_Hill" "Australia/Darwin" ) ;;
4471 | "Australian Eastern Standard Time" ) TZFiles=( "Australia/Brisbane" "Australia/Canberra" "Australia/Hobart" "Australia/Melbourne" "Australia/Sydney" ) ;;
4472 | "Australian Western Standard Time" ) TZFiles=( "Australia/Perth" ) ;;
4473 | "Azerbaijan Time" ) TZFiles=( "Asia/Baku" ) ;;
4474 | "Azores Time" ) TZFiles=( "Atlantic/Azores" ) ;;
4475 | "Bangladesh Time" ) TZFiles=( "Asia/Dhaka" ) ;;
4476 | "Bhutan Time" ) TZFiles=( "Asia/Thimphu" ) ;;
4477 | "Bolivia Time" ) TZFiles=( "America/La_Paz" ) ;;
4478 | "Brasilia Time" ) TZFiles=( "America/Araguaina" "America/Bahia" "America/Belem" "America/Fortaleza" "America/Maceio" "America/Recife" "America/Santarem" "America/Sao_Paulo" "Brazil/East" ) ;;
4479 | "Brunei Darussalam Time" ) TZFiles=( "Asia/Brunei" ) ;;
4480 | "Cape Verde Time" ) TZFiles=( "Atlantic/Cape_Verde" ) ;;
4481 | "Central Africa Time" ) TZFiles=( "Africa/Blantyre" "Africa/Bujumbura" "Africa/Gaborone" "Africa/Harare" "Africa/Kigali" "Africa/Lubumbashi" "Africa/Lusaka" "Africa/Maputo" ) ;;
4482 | "Central European Time" ) TZFiles=( "Africa/Algiers" "Africa/Ceuta" "Africa/Tunis" "Arctic/Longyearbyen" "Europe/Amsterdam" "Europe/Andorra" "Europe/Belgrade" "Europe/Berlin" "Europe/Bratislava" "Europe/Brussels" "Europe/Budapest" "Europe/Copenhagen" "Europe/Gibraltar" "Europe/Ljubljana" "Europe/Luxembourg" "Europe/Madrid" "Europe/Malta" "Europe/Monaco" "Europe/Oslo" "Europe/Paris" "Europe/Podgorica" "Europe/Prague" "Europe/Rome" "Europe/San_Marino" "Europe/Sarajevo" "Europe/Skopje" "Europe/Stockholm" "Europe/Tirane" "Europe/Vaduz" "Europe/Vatican" "Europe/Vienna" "Europe/Warsaw" "Europe/Zagreb" "Europe/Zurich" ) ;;
4483 | "Central Indonesia Time" ) TZFiles=( "Asia/Makassar" ) ;;
4484 | "Central Standard Time" ) TZFiles=( "America/Belize" "America/Cancun" "America/Chicago" "America/Costa_Rica" "America/El_Salvador" "America/Guatemala" "America/Indiana/Tell_City" "America/Managua" "America/Matamoros" "America/Merida" "America/Mexico_City" "America/Monterrey" "America/North_Dakota/New_Salem" "America/Regina" "America/Swift_Current" "America/Tegucigalpa" "America/Winnipeg" "Canada/Saskatchewan" "US/Central" ) ;;
4485 | "Chamorro Standard Time" ) TZFiles=( "Pacific/Guam" "Pacific/Saipan" ) ;;
4486 | "Chile Time" ) TZFiles=( "America/Santiago" ) ;;
4487 | "China Standard Time" ) TZFiles=( "Asia/Chongqing" "Asia/Harbin" "Asia/Kashgar" "Asia/Macau" "Asia/Shanghai" "Asia/Urumqi" ) ;;
4488 | "Christmas Island Time" ) TZFiles=( "Indian/Christmas" ) ;;
4489 | "Cocos Islands Time" ) TZFiles=( "Indian/Cocos" ) ;;
4490 | "Colombia Time" ) TZFiles=( "America/Bogota" ) ;;
4491 | "Cook Islands Time" ) TZFiles=( "Pacific/Rarotonga" ) ;;
4492 | "Cuba Standard Time" ) TZFiles=( "America/Havana" ) ;;
4493 | "East Africa Time" ) TZFiles=( "Africa/Addis_Ababa" "Africa/Asmara" "Africa/Asmera" "Africa/Dar_es_Salaam" "Africa/Djibouti" "Africa/Kampala" "Africa/Khartoum" "Africa/Mogadishu" "Africa/Nairobi" "Indian/Antananarivo" "Indian/Comoro" "Indian/Mayotte" ) ;;
4494 | "East Kazakhstan Standard Time" ) TZFiles=( "Asia/Almaty" "Asia/Qyzylorda" ) ;;
4495 | "East Timor Time" ) TZFiles=( "Asia/Dili" ) ;;
4496 | "Eastern European Time" ) TZFiles=( "Africa/Cairo" "Africa/Tripoli" "Asia/Amman" "Asia/Beirut" "Asia/Damascus" "Asia/Gaza" "Asia/Nicosia" "Europe/Athens" "Europe/Bucharest" "Europe/Chisinau" "Europe/Helsinki" "Europe/Istanbul" "Europe/Kiev" "Europe/Riga" "Europe/Simferopol" "Europe/Sofia" "Europe/Tallinn" "Europe/Uzhgorod" "Europe/Vilnius" "Europe/Zaporozhye" ) ; if [ ${TargetOSMinor} -eq 6 ] ; then TZFiles=( "${TZFiles[@]}" "Europe/Kaliningrad" "Europe/Minsk" ) ; fi ;;
4497 | "Eastern Indonesia Time" ) TZFiles=( "Asia/Jayapura" ) ;;
4498 | "Eastern Standard Time" ) TZFiles=( "America/Cayman" "America/Detroit" "America/Grand_Turk" "America/Indiana/Indianapolis" "America/Indiana/Vincennes" "America/Indianapolis" "America/Jamaica" "America/Kentucky/Louisville" "America/Kentucky/Monticello" "America/Montreal" "America/Nassau" "America/New_York" "America/Nipigon" "America/Panama" "America/Port-au-Prince" "America/Thunder_Bay" "America/Toronto" "Canada/Eastern" "US/Eastern" ) ;;
4499 | "Ecuador Time" ) TZFiles=( "America/Guayaquil" ) ;;
4500 | "Falkland Islands Time" ) TZFiles=( "Atlantic/Stanley" ) ;;
4501 | "Fernando de Noronha Time" ) TZFiles=( "America/Noronha" ) ;;
4502 | "Fiji Time" ) TZFiles=( "Pacific/Fiji" ) ;;
4503 | "French Guiana Time" ) TZFiles=( "America/Cayenne" ) ;;
4504 | "French Southern and Antarctic Time" ) TZFiles=( "Indian/Kerguelen" ) ;;
4505 | "Georgia Time" ) TZFiles=( "Asia/Tbilisi" ) ;;
4506 | "Gilbert Islands Time" ) TZFiles=( "Pacific/Tarawa" ) ;;
4507 | "GMT-03:00" ) TZFiles=( "America/Argentina/San_Luis" ) ;;
4508 | "GMT+00:00" ) TZFiles=( "UTC" ) ;;
4509 | "GMT+03:00" ) TZFiles=( "Europe/Kaliningrad" "Europe/Minsk" ) ;;
4510 | "GMT+07:00" ) TZFiles=( "Asia/Dhaka" ) ;;
4511 | "GMT+08:00" ) TZFiles=( "Asia/Taipei" ) ;;
4512 | "Greenwich Mean Time" ) TZFiles=( "Africa/Abidjan" "Africa/Accra" "Africa/Bamako" "Africa/Banjul" "Africa/Bissau" "Africa/Conakry" "Africa/Dakar" "Africa/Freetown" "Africa/Lome" "Africa/Monrovia" "Africa/Nouakchott" "Africa/Ouagadougou" "Africa/Sao_Tome" "Atlantic/Reykjavik" "Atlantic/St_Helena" "Europe/Dublin" "Europe/Guernsey" "Europe/Isle_of_Man" "Europe/Jersey" "Europe/London" ) ;;
4513 | "Gulf Standard Time" ) TZFiles=( "Asia/Dubai" "Asia/Muscat" ) ;;
4514 | "Guyana Time" ) TZFiles=( "America/Guyana" ) ;;
4515 | "Hawaii-Aleutian Standard Time" ) TZFiles=( "America/Adak" "Pacific/Honolulu" ) ;;
4516 | "Hong Kong Time" ) TZFiles=( "Asia/Hong_Kong" ) ;;
4517 | "India Standard Time" ) TZFiles=( "Asia/Calcutta" "Asia/Colombo" "Asia/Kolkata" ) ;;
4518 | "Indochina Time" ) TZFiles=( "Asia/Bangkok" "Asia/Ho_Chi_Minh" "Asia/Phnom_Penh" "Asia/Saigon" "Asia/Vientiane" ) ;;
4519 | "Iran Standard Time" ) TZFiles=( "Asia/Tehran" ) ;;
4520 | "Irkutsk Time" ) TZFiles=( "Asia/Irkutsk" ) ;;
4521 | "Israel Standard Time" ) TZFiles=( "Asia/Jerusalem" ) ;;
4522 | "Japan Standard Time" ) TZFiles=( "Asia/Tokyo" ) ;;
4523 | "Korean Standard Time" ) TZFiles=( "Asia/Pyongyang" "Asia/Seoul" ) ;;
4524 | "Krasnoyarsk Time" ) TZFiles=( "Asia/Krasnoyarsk" ) ; if [ ${TargetOSMinor} -ne 5 ] ; then TZFiles=( "${TZFiles[@]}" "Asia/Novosibirsk" ) ; fi ;;
4525 | "Kyrgyzstan Time" ) TZFiles=( "Asia/Bishkek" ) ;;
4526 | "Magadan Time" ) TZFiles=( "Asia/Magadan" ) ; if [ ${TargetOSMinor} -eq 7 ] ; then TZFiles=( "${TZFiles[@]}" "Asia/Anadyr" "Asia/Kamchatka" ) ; fi ;;
4527 | "Malaysia Time" ) TZFiles=( "Asia/Kuala_Lumpur" "Asia/Kuching" ) ;;
4528 | "Maldives Time" ) TZFiles=( "Indian/Maldives" ) ;;
4529 | "Marshall Islands Time" ) TZFiles=( "Pacific/Majuro" ) ;;
4530 | "Mauritius Time" ) TZFiles=( "Indian/Mauritius" ) ;;
4531 | "Moscow Standard Time" ) TZFiles=( "Europe/Moscow" ) ; if [ ${TargetOSMinor} -eq 7 ] ; then TZFiles=( "${TZFiles[@]}" "Europe/Samara" ) ; fi ;;
4532 | "Mountain Standard Time" ) TZFiles=( "America/Boise" "America/Chihuahua" "America/Dawson_Creek" "America/Denver" "America/Edmonton" "America/Hermosillo" "America/Mazatlan" "America/Ojinaga" "America/Phoenix" "America/Yellowknife" "Canada/Mountain" "US/Mountain" ) ;;
4533 | "Myanmar Time" ) TZFiles=( "Asia/Rangoon" ) ;;
4534 | "Nauru Time" ) TZFiles=( "Pacific/Nauru" ) ;;
4535 | "Nepal Time" ) TZFiles=( "Asia/Kathmandu" "Asia/Katmandu" ) ;;
4536 | "New Caledonia Time" ) TZFiles=( "Pacific/Noumea" ) ;;
4537 | "New Zealand Standard Time" ) TZFiles=( "Antarctica/McMurdo" "Pacific/Auckland" ) ;;
4538 | "Newfoundland Standard Time" ) TZFiles=( "America/St_Johns" "Canada/Newfoundland" ) ;;
4539 | "Niue Time" ) TZFiles=( "Pacific/Niue" ) ;;
4540 | "Norfolk Islands Time" ) TZFiles=( "Pacific/Norfolk" ) ;;
4541 | "Novosibirsk Time" ) TZFiles=( "Asia/Novokuznetsk" ) ; if [ ${TargetOSMinor} -eq 5 ] ; then TZFiles=( "${TZFiles[@]}" "Asia/Novosibirsk" ) ; fi ;;
4542 | "Omsk Time" ) TZFiles=( "Asia/Omsk" ) ;;
4543 | "Pacific Standard Time" ) TZFiles=( "America/Los_Angeles" "America/Santa_Isabel" "America/Tijuana" "America/Vancouver" "America/Whitehorse" "US/Pacific" ) ;;
4544 | "Pakistan Time" ) TZFiles=( "Asia/Karachi" ) ;;
4545 | "Palau Time" ) TZFiles=( "Pacific/Palau" ) ;;
4546 | "Papua New Guinea Time" ) TZFiles=( "Pacific/Port_Moresby" ) ;;
4547 | "Paraguay Time" ) TZFiles=( "America/Asuncion" ) ;;
4548 | "Peru Time" ) TZFiles=( "America/Lima" ) ;;
4549 | "Petropavlovsk-Kamchatski Time" ) TZFiles=( "Asia/Kamchatka" ) ;;
4550 | "Philippine Time" ) TZFiles=( "Asia/Manila" ) ;;
4551 | "Pierre and Miquelon Standard Time" ) TZFiles=( "America/Miquelon" ) ;;
4552 | "Pitcairn Time" ) TZFiles=( "Pacific/Pitcairn" ) ;;
4553 | "Ponape Time" ) TZFiles=( "Pacific/Pohnpei" "Pacific/Ponape" ) ;;
4554 | "Reunion Time" ) TZFiles=( "Indian/Reunion" ) ;;
4555 | "Sakhalin Time" ) TZFiles=( "Asia/Sakhalin" ) ;;
4556 | "Samara Time" ) TZFiles=( "Europe/Samara" ) ;;
4557 | "Samoa Standard Time" ) TZFiles=( "Pacific/Apia" "Pacific/Pago_Pago" ) ;;
4558 | "Seychelles Time" ) TZFiles=( "Indian/Mahe" ) ;;
4559 | "Singapore Standard Time" ) TZFiles=( "Asia/Singapore" ) ;;
4560 | "Solomon Islands Time" ) TZFiles=( "Pacific/Guadalcanal" ) ;;
4561 | "South Africa Standard Time" ) TZFiles=( "Africa/Johannesburg" "Africa/Maseru" "Africa/Mbabane" ) ;;
4562 | "South Georgia Time" ) TZFiles=( "Atlantic/South_Georgia" ) ;;
4563 | "Suriname Time" ) TZFiles=( "America/Paramaribo" ) ;;
4564 | "Tahiti Time" ) TZFiles=( "Pacific/Tahiti" ) ;;
4565 | "Tajikistan Time" ) TZFiles=( "Asia/Dushanbe" ) ;;
4566 | "Taipei Standard Time" ) TZFiles=( "Asia/Taipei" ) ;;
4567 | "Tonga Time" ) TZFiles=( "Pacific/Tongatapu" ) ;;
4568 | "Turkmenistan Time" ) TZFiles=( "Asia/Ashgabat" ) ;;
4569 | "Tuvalu Time" ) TZFiles=( "Pacific/Funafuti" ) ;;
4570 | "Ulan Bator Time" ) TZFiles=( "Asia/Ulaanbaatar" ) ;;
4571 | "Uruguay Time" ) TZFiles=( "America/Montevideo" ) ;;
4572 | "Uzbekistan Time" ) TZFiles=( "Asia/Samarkand" "Asia/Tashkent" ) ;;
4573 | "Vanuatu Time" ) TZFiles=( "Pacific/Efate" ) ;;
4574 | "Venezuela Time" ) TZFiles=( "America/Caracas" ) ;;
4575 | "Vladivostok Time" ) TZFiles=( "Asia/Vladivostok" ) ;;
4576 | "Volgograd Time" ) TZFiles=( "Europe/Volgograd" ) ;;
4577 | "Wallis and Futuna Time" ) TZFiles=( "Pacific/Wallis" ) ;;
4578 | "West Africa Time" ) TZFiles=( "Africa/Bangui" "Africa/Brazzaville" "Africa/Douala" "Africa/Kinshasa" "Africa/Lagos" "Africa/Libreville" "Africa/Luanda" "Africa/Malabo" "Africa/Ndjamena" "Africa/Niamey" "Africa/Porto-Novo" "Africa/Windhoek" ) ;;
4579 | "West Greenland Time" ) TZFiles=( "America/Godthab" ) ;;
4580 | "West Kazakhstan Standard Time" ) TZFiles=( "Asia/Aqtau" "Asia/Aqtobe" "Asia/Oral" ) ;;
4581 | "Western European Time" ) TZFiles=( "Africa/Casablanca" "Africa/El_Aaiun" "Atlantic/Canary" "Atlantic/Faroe" "Atlantic/Madeira" "Europe/Lisbon" ) ;;
4582 | "Western Indonesia Time" ) TZFiles=( "Asia/Jakarta" "Asia/Pontianak" ) ;;
4583 | "Yakutsk Time" ) TZFiles=( "Asia/Yakutsk" ) ;;
4584 | "Yekaterinburg Time" ) TZFiles=( "Asia/Yekaterinburg" ) ;;
4585 | esac
4586 | }
4587 |
4588 | function set_TZCountries {
4589 | unset ZCODES[@]
4590 | unset ZNAMES[@]
4591 | unset TZCountries[@]
4592 | if [ ${UseGeoKit} -eq 0 ] ; then
4593 | for TZFILE in "${TZFiles[@]}" ; do
4594 | i=0 ; for Item in "${all_cities_adj_3[@]}" ; do
4595 | j=0
4596 | if [ "${TZFILE}" == "${Item}" ] ; then j=1 ; fi
4597 | for CODE in "${ZCODES[@]}" ; do
4598 | if [ "${CODE}" == "${all_cities_adj_4[i]}" ] ; then j=0 ; break ; fi
4599 | done
4600 | if [ ${j} -eq 1 ] ; then ZCODES=( "${ZCODES[@]}" "${all_cities_adj_4[i]}" ) ; fi
4601 | let i++
4602 | done
4603 | done
4604 | else
4605 | for TZFILE in "${TZFiles[@]}" ; do
4606 | Query="select distinct ZCOUNTRY from ${PLACES} where ZTIMEZONENAME = '${TZFILE}';"
4607 | ZCOUNTRYS=( `sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null` )
4608 | for ZCOUNTRY in "${ZCOUNTRYS[@]}" ; do
4609 | j=1
4610 | Query="select ZCODE from ${PLACES} where Z_PK = ${ZCOUNTRY};"
4611 | ZCODE=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
4612 | for CODE in "${ZCODES[@]}" ; do
4613 | if [ "${ZCODE}" == "${CODE}" ] ; then j=0 ; break ; fi
4614 | done
4615 | if [ ${j} -eq 1 ] ; then ZCODES=( "${ZCODES[@]}" "${ZCODE}" ) ; fi
4616 | done
4617 | done
4618 | fi
4619 | IFS=$'\n'
4620 | for ZCODE in "${ZCODES[@]}" ; do
4621 | ZNAMES=( "${ZNAMES[@]}" $(set_TZCountry "${ZCODE}") )
4622 | done
4623 | TZCountries=( `for ZNAME in "${ZNAMES[@]}" ; do echo "${ZNAME}" ; done | sort -u` )
4624 | unset IFS
4625 | }
4626 |
4627 | function set_ClosestCities {
4628 | # ${1}: TZCountryCode
4629 | unset ZGEONAMEIDS[@]
4630 | unset ZNAMES[@]
4631 | unset ClosestCities[@]
4632 | display_Title
4633 | printf "\nCreating list of Cities ... "
4634 | s=1
4635 | if [ ${UseGeoKit} -eq 0 ] ; then
4636 | for TZFILE in "${TZFiles[@]}" ; do
4637 | j=0
4638 | i=0 ; for Item in "${all_cities_adj_3[@]}" ; do
4639 | if [ "${TZFILE}" == "${Item}" ] ; then
4640 | if [ "${1}" == "${all_cities_adj_4[i]}" ] ; then j=1 ; break ; fi
4641 | fi
4642 | printf "\b${spin:s++%${#spin}:1}"
4643 | let i++
4644 | done
4645 | if [ ${j} -eq 1 ] ; then ZGEONAMEIDS=( ${ZGEONAMEIDS[@]} ${all_cities_adj_7[i]} ) ; fi
4646 | done
4647 | else
4648 | Query="select Z_PK from ${PLACES} where ZCODE = '${1}';"
4649 | ZCOUNTRY=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
4650 | for TZFILE in "${TZFiles[@]}" ; do
4651 | Query="select ZGEONAMEID from ${PLACES} where ZCOUNTRY = ${ZCOUNTRY} AND ZTIMEZONENAME = '${TZFILE}';"
4652 | ZGEONAMEIDS=( ${ZGEONAMEIDS[@]} `sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null` )
4653 | printf "\b${spin:s++%${#spin}:1}"
4654 | done
4655 | fi
4656 | IFS=$'\n'
4657 | for ZGEONAMEID in ${ZGEONAMEIDS[@]} ; do
4658 | ZNAMES=( "${ZNAMES[@]}" "$(set_ClosestCity ${ZGEONAMEID})" )
4659 | printf "\b${spin:s++%${#spin}:1}"
4660 | done
4661 | ClosestCities=( `for ZNAME in "${ZNAMES[@]}" ; do echo "${ZNAME}" ; done | sort -u` )
4662 | unset IFS
4663 | printf "\bdone\n"
4664 | }
4665 |
4666 | # Section: Remote Login
4667 |
4668 | # Section: Remote Management
4669 |
4670 | # Section: Runtime
4671 |
4672 | function display_Language {
4673 | printf "Language: "
4674 | if [ -n "${Language}" ] ; then printf "${Language}" ; else printf "-" ; fi
4675 | printf "\n"
4676 | # echo "Begin: Debug Output"
4677 | # echo "Language Code: ${LanguageCode}"
4678 | # echo "AppleLanguages: ${AppleLanguages[@]}"
4679 | # echo "End: Debug Output"
4680 | printf "\n"
4681 | }
4682 |
4683 | function select_Language {
4684 | display_Subtitle "Select Language"
4685 | display_Language
4686 | display_Options "Languages" "Select the language you wish to use: "
4687 | select Language in "${Languages[@]}" ; do
4688 | if [ -n "${Language}" ] ; then break ; fi
4689 | done
4690 | set_LanguageCode "${Language}"
4691 | set_Localization "${Language}"
4692 | # set_LanguageCountryCodes "${LanguageCode}"
4693 | }
4694 |
4695 | function display_CountryName {
4696 | printf "Country: "
4697 | if [ -n "${SACountry}" ] ; then printf "${SACountry}" ; else printf "-" ; fi
4698 | printf "\n"
4699 | # echo "Begin: Debug Output"
4700 | # echo "Country Code: ${SACountryCode}"
4701 | # echo "Language Country Codes: ${LanguageCountryCodes[@]}"
4702 | # echo "Other Country Codes: ${OtherCountryCodes[@]}"
4703 | # echo "End: Debug Output"
4704 | printf "\n"
4705 | }
4706 |
4707 | function select_Country {
4708 | set_LanguageCountryCodes "${LanguageCode}"
4709 | set_LanguageCountryNames
4710 | unset OtherCountryCodes[@]
4711 | unset OtherCountryNames[@]
4712 | CountryNames=( "Show All" "${LanguageCountryNames[@]}" )
4713 | display_Subtitle "Select Country"
4714 | display_CountryName
4715 | display_Options "Countries" "Select the country or region you wish to use: "
4716 | select Country in "${CountryNames[@]}" ; do
4717 | while [ "${Country}" == "Show All" ] ; do
4718 | set_OtherCountryCodes
4719 | set_OtherCountryNames
4720 | CountryNames=( "${LanguageCountryNames[@]}" "${OtherCountryNames[@]}" )
4721 | display_Subtitle "Select Country"
4722 | display_CountryName
4723 | display_Options "Countries" "Select the country or region you wish to use: "
4724 | select Country in "${CountryNames[@]}" ; do
4725 | if [ -n "${Country}" ] ; then break ; fi
4726 | done
4727 | done
4728 | if [ -n "${Country}" ] ; then break ; fi
4729 | done
4730 | SACountry="${Country}"
4731 | set_SACountryCode "${SACountry}"
4732 | }
4733 |
4734 | function display_Keyboard {
4735 | printf "Keyboard Layout: "
4736 | if [ -n "${SAKeyboard}" ] ; then printf "${SAKeyboard}" ; else printf "-" ; fi
4737 | printf "\n"
4738 | if [ ${#TypingStyles[@]} -gt 0 ] ; then
4739 | printf "Preferred typing style: "
4740 | if [ -n "${SATypingStyle}" ] ; then printf "${SATypingStyle}" ; else printf "-" ; fi
4741 | printf "\n"
4742 | fi
4743 | printf "\n"
4744 | }
4745 |
4746 | function select_Keyboard {
4747 | set_AllKeyboards
4748 | set_CurrentKeyboards "${LanguageCode}" "${SACountryCode}"
4749 | Keyboards=( "Show All" "${CurrentKeyboards[@]}" )
4750 | display_Subtitle "Select Keyboard"
4751 | display_Keyboard
4752 | display_Options "Keyboard layouts" "Choose a keyboard layout: "
4753 | select Keyboard in "${Keyboards[@]}" ; do
4754 | while [ "${Keyboard}" == "Show All" ] ; do
4755 | set_OtherKeyboards
4756 | Keyboards=( "${CurrentKeyboards[@]}" "${OtherKeyboards[@]}" )
4757 | display_Subtitle "Select Keyboard"
4758 | display_Keyboard
4759 | display_Options "Keyboard layouts" "Choose a keyboard layout: "
4760 | select Keyboard in "${Keyboards[@]}" ; do
4761 | if [ -n "${Keyboard}" ] ; then break ; fi
4762 | done
4763 | done
4764 | if [ -n "${Keyboard}" ] ; then break ; fi
4765 | done
4766 | if [ "${Keyboard}" != "${SAKeyboard}" ] ; then unset SATypingStyle ; set_TypingStyles "${Keyboard}" ; fi
4767 | SAKeyboard="${Keyboard}"
4768 | if [ ${#TypingStyles[@]} -gt 0 ] ; then
4769 | display_Subtitle "Select Keyboard"
4770 | display_Keyboard
4771 | display_Options "Typing styles" "Which typing style do you prefer? "
4772 | select TypingStyle in "${TypingStyles[@]}" ; do
4773 | if [ -n "${TypingStyle}" ] ; then break ; fi
4774 | done
4775 | SATypingStyle="${TypingStyle}"
4776 | fi
4777 | set_InputSourceID "${SAKeyboard}" "${SATypingStyle}"
4778 | }
4779 |
4780 | function display_NTPSettings {
4781 | printf "Network Time Server: "
4782 | if [ -n "${NTPServerName}" ] ; then printf "${NTPServerName}" ; else printf "-" ; fi
4783 | printf "\n"
4784 | printf " ["
4785 | if [ ${NTPEnabled} -eq 1 ] ; then printf "*" ; else printf " " ; fi
4786 | printf "] Set date and time automatically\n\n"
4787 | }
4788 |
4789 | function select_NTPServer {
4790 | set_NTPServerNames
4791 | NTPServerNames=( "${NTPServerNames[@]}" "Other..." )
4792 | display_Subtitle "Date and Time"
4793 | display_NTPSettings
4794 | display_Options "NTP Servers" "Select your network time server: "
4795 | select ServerName in "${NTPServerNames[@]}" ; do
4796 | while [ "${ServerName}" == "Other..." ] ; do
4797 | display_Subtitle "Date and Time"
4798 | display_NTPSettings
4799 | echo
4800 | printf "\nNetwork time server (${NTPServer}): "
4801 | read ServerName
4802 | if [ -z "${ServerName}" ] ; then ServerName="${NTPServer}" ; fi
4803 | done
4804 | if [ -n "${ServerName}" ] ; then break ; fi
4805 | done
4806 | set_NTPServerName "${ServerName}"
4807 | set_NTPServer "${NTPServerName}"
4808 | while [ -z "${NTPAuto}" ] ; do
4809 | display_Subtitle "Date and Time"
4810 | display_NTPSettings
4811 | read -sn 1 -p "Set date and time automatically (Y/n)? " NTPAuto < /dev/tty
4812 | echo
4813 | if [ -z "${NTPAuto}" ] ; then NTPAuto="y" ; fi
4814 | case "${NTPAuto}" in
4815 | "Y" | "y" ) echo ; NTPEnabled=1 ;;
4816 | "N" | "n" ) echo ; NTPEnabled=0 ;;
4817 | * ) echo ; unset NTPAuto ;;
4818 | esac
4819 | done
4820 | unset NTPAuto
4821 | }
4822 |
4823 | function display_TimeZone {
4824 | printf "Time Zone: "
4825 | if [ -n "${TimeZone}" ] ; then printf "${TimeZone}" ; else printf "-" ; fi
4826 | printf "\n"
4827 | printf "Closest City: "
4828 | if [ -n "${ClosestCity}" ] ; then
4829 | printf "${ClosestCity}"
4830 | if [ -n "${TZCountry}" ] ; then printf " - ${TZCountry}" ; fi
4831 | else
4832 | printf "-"
4833 | fi
4834 | printf "\n"
4835 | printf " ["
4836 | if [ ${TZAuto} -eq 1 ] ; then
4837 | printf "*"
4838 | else
4839 | printf " "
4840 | fi
4841 | printf "] Set time zone automatically using current location\n"
4842 | printf "\n"
4843 | }
4844 |
4845 | function select_TZCountry {
4846 | unset TZCountry
4847 | unset ClosestCity
4848 | display_Subtitle "Select Time Zone"
4849 | display_TimeZone
4850 | display_Options "Countries" "Select the country or region: "
4851 | select TZCountry in "${TZCountries[@]}" ; do
4852 | if [ -n "${TZCountry}" ] ; then break ; fi
4853 | done
4854 | }
4855 |
4856 | function select_ClosestCity {
4857 | unset ClosestCity
4858 | display_Subtitle "Select Time Zone"
4859 | display_TimeZone
4860 | display_Options "Cities" "Select the closest city: "
4861 | select ClosestCity in "${ClosestCities[@]}" ; do
4862 | if [ -n "${ClosestCity}" ] ; then break ; fi
4863 | done
4864 | }
4865 |
4866 | function select_TimeZone {
4867 | set_CountryTimeZones "${SACountryCode}"
4868 | TimeZones=( "Show All" "${CountryTimeZones[@]}" )
4869 | display_Subtitle "Select Time Zone"
4870 | display_TimeZone
4871 | display_Options "Time zones" "Select your Time Zone: "
4872 | select Zone in "${TimeZones[@]}" ; do
4873 | while [ "${Zone}" == "Show All" ] ; do
4874 | set_OtherTimeZones
4875 | TimeZones=( "${CountryTimeZones[@]}" "${OtherTimeZones[@]}" )
4876 | display_Subtitle "Select Time Zone"
4877 | display_TimeZone
4878 | display_Options "Time zones" "Select your Time Zone: "
4879 | select Zone in "${TimeZones[@]}" ; do
4880 | if [ -n "${Zone}" ] ; then break ; fi
4881 | done
4882 | done
4883 | if [ -n "${Zone}" ] ; then break ; fi
4884 | done
4885 | TimeZone="${Zone}"
4886 | set_TZFiles "${TimeZone}"
4887 | set_TZCountries
4888 | if [ ${#TZCountries[@]} -gt 1 ] ; then
4889 | select_TZCountry
4890 | else
4891 | TZCountry="${TZCountries[0]}"
4892 | fi
4893 | i=0 ; for ZNAME in "${ZNAMES[@]}" ; do
4894 | if [ "${TZCountry}" == "${ZNAME}" ] ; then TZCountryCode="${ZCODES[i]}" ; break ; fi
4895 | let i++
4896 | done
4897 | set_ClosestCities "${TZCountryCode}"
4898 | if [ ${#ClosestCities[@]} -gt 1 ] ; then
4899 | select_ClosestCity
4900 | else
4901 | ClosestCity="${ClosestCities[0]}"
4902 | fi
4903 | i=0 ; for ZNAME in "${ZNAMES[@]}" ; do
4904 | if [ "${ClosestCity}" == "${ZNAME}" ] ; then GeonameID=${ZGEONAMEIDS[i]} ; break ; fi
4905 | let i++
4906 | done
4907 | while [ -z "${AutoTZ}" ] ; do
4908 | display_Subtitle "Select Time Zone"
4909 | display_TimeZone
4910 | read -sn 1 -p "Set time zone automatically using current location (Y/n)? " AutoTZ < /dev/tty
4911 | if [ -z "${AutoTZ}" ] ; then AutoTZ="y" ; fi
4912 | case "${AutoTZ}" in
4913 | "Y" | "y" ) echo ; TZAuto=1 ;;
4914 | "N" | "n" ) echo ; TZAuto=0 ;;
4915 | * ) echo ; unset AutoTZ ;;
4916 | esac
4917 | done
4918 | unset AutoTZ
4919 | }
4920 |
4921 | function display_RemoteLogin {
4922 | printf "Remote Login: ["
4923 | if [ ${RemoteLogin} -eq 1 ] ; then printf "*" ; else printf " " ; fi
4924 | printf "] Enable users to log in remotely using SSH\n\n"
4925 | }
4926 |
4927 | function select_RemoteLogin {
4928 | display_Subtitle "Remote Login"
4929 | display_RemoteLogin
4930 | while [ -z "${EnableSSH}" ] ; do
4931 | read -sn 1 -p "Enable users to log in remotely using SSH (y/N)? " EnableSSH < /dev/tty
4932 | if [ -z "${EnableSSH}" ] ; then EnableSSH="n" ; fi
4933 | case "${EnableSSH}" in
4934 | "Y" | "y" ) echo ; RemoteLogin=1 ;;
4935 | "N" | "n" ) echo ; RemoteLogin=0 ;;
4936 | * ) echo ; unset EnableSSH ;;
4937 | esac
4938 | done
4939 | unset EnableSSH
4940 | }
4941 |
4942 | function display_RemoteManagement {
4943 | printf "Remote Management: ["
4944 | if [ ${RemoteManagement} -eq 1 ] ; then printf "*" ; else printf " " ; fi
4945 | printf "] Enable users to manage this computer remotely\n\n"
4946 | }
4947 |
4948 | function select_RemoteManagement {
4949 | display_Subtitle "Remote Management"
4950 | display_RemoteManagement
4951 | while [ -z "${EnableARD}" ] ; do
4952 | read -sn 1 -p "Enable users to manage this computer remotely (y/N)? " EnableARD < /dev/tty
4953 | if [ -z "${EnableARD}" ] ; then EnableARD="n" ; fi
4954 | case "${EnableARD}" in
4955 | "Y" | "y" ) echo ; RemoteManagement=1 ;;
4956 | "N" | "n" ) echo ; RemoteManagement=0 ;;
4957 | * ) echo ; unset EnableARD ;;
4958 | esac
4959 | done
4960 | unset EnableARD
4961 | }
4962 |
4963 | function display_ComputerName {
4964 | printf "Computer Name: "
4965 | if [ -n "${ComputerName}" ] ; then printf "${ComputerName}" ; else printf "-" ; fi
4966 | printf "\n\n"
4967 | }
4968 |
4969 | function select_ComputerName {
4970 | ComputerNames=( "Do not set" "Model and MAC Address" "Generic using MAC Address" "Serial Number" )
4971 | display_Subtitle "Computer Name"
4972 | display_ComputerName
4973 | display_Options "Naming conventions" "Select the naming convention you wish to use: "
4974 | select newComputerName in "${ComputerNames[@]}" ; do
4975 | if [ -n "${newComputerName}" ] ; then break ; fi
4976 | done
4977 | if [ "${newComputerName}" == "Do not set" ] ; then
4978 | unset ComputerName
4979 | else
4980 | ComputerName="${newComputerName}"
4981 | fi
4982 | unset newComputerName
4983 | }
4984 |
4985 | function display_SystemSettings {
4986 | display_Language
4987 | display_CountryName
4988 | display_Keyboard
4989 | display_NTPSettings
4990 | display_TimeZone
4991 | display_RemoteLogin
4992 | display_RemoteManagement
4993 | display_ComputerName
4994 | }
4995 |
4996 | function menu_SystemPreferences {
4997 | SystemOptions=( "System Setup Menu" "Language" "Country" "Keyboard" "Network Time Server" "Time Zone" "Remote Login" "Remote Management" "Computer Name" )
4998 | while [ "${Option}" != "System Setup Menu" ] ; do
4999 | display_Subtitle "System Preferences"
5000 | display_SystemSettings
5001 | display_Options "Options" "Select an option: "
5002 | select Option in "${SystemOptions[@]}" ; do
5003 | case "${Option}" in
5004 | "System Setup Menu" ) break ;;
5005 | "Language" ) select_Language ; unset Option ; break ;;
5006 | "Country" ) select_Country ; unset Option ; break ;;
5007 | "Keyboard" ) select_Keyboard ; unset Option ; break ;;
5008 | "Network Time Server" ) select_NTPServer ; unset Option ; break ;;
5009 | "Time Zone" ) select_TimeZone ; unset Option ; break ;;
5010 | "Remote Login" ) select_RemoteLogin ; unset Option ; break ;;
5011 | "Remote Management" ) select_RemoteManagement ; unset Option ; break ;;
5012 | "Computer Name" ) select_ComputerName ; unset Option ; break ;;
5013 | esac
5014 | done
5015 | done
5016 | unset Option
5017 | }
5018 |
5019 | # Section: User Accounts
5020 |
5021 | function check_AttributeReserved {
5022 | # ${1}: Attribute
5023 | # ${2}: Value
5024 | searchResult=`dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -search /Local/Target/Users "${1}" "${2}"`
5025 | if [ -n "${searchResult}" ] ; then
5026 | case "${1}" in
5027 | "RecordName" ) for Element in "${LocalRecordNames[@]}" ; do if [ "${2}" == "${Element}" ] ; then return 1 ; fi ; done ;;
5028 | "RealName" ) for Element in "${LocalRealNames[@]}" ; do if [ "${2}" == "${Element}" ] ; then return 1 ; fi ; done ;;
5029 | "UniqueID" ) for Element in "${LocalUniqueIDs[@]}" ; do if [ ${2} -eq ${Element} ] ; then return 1 ; fi ; done ;;
5030 | esac
5031 | return 0
5032 | fi
5033 | return 1
5034 | }
5035 |
5036 | function check_AttributeInUse {
5037 | # ${1}: Attribute
5038 | # ${2}: Value
5039 | case "${1}" in
5040 | "RecordName" ) for Element in "${RecordNames[@]}" ; do if [ "${2}" == "${Element}" ] ; then return 0 ; fi ; done ;;
5041 | "RealName" ) for Element in "${RealNames[@]}" ; do if [ "${2}" == "${Element}" ] ; then return 0 ; fi ; done ;;
5042 | "UniqueID" ) for Element in "${UniqueIDs[@]}" ; do if [ ${2} -eq ${Element} ] ; then return 0 ; fi ; done ;;
5043 | esac
5044 | return 1
5045 | }
5046 |
5047 | function check_AccountTypes {
5048 | if [ ${#AccountTypes[@]} -eq 0 ] ; then return 0 ; fi
5049 | for Element in "${AccountTypes[@]}" ; do
5050 | if [ "${Element}" == "Administrator" ] ; then return 0 ; fi
5051 | done
5052 | if [ ${#AccountTypes[@]} -eq 1 ] ; then
5053 | AccountTypes[0]="Administrator"
5054 | else
5055 | display_Subtitle "Select Administrator"
5056 | display_Users
5057 | display_Options "Users" "Select a user: "
5058 | select RealName in "${RealNames[@]}" ; do
5059 | if [ -n "${RealName}" ] ; then break ; fi
5060 | done
5061 | i=0 ; for Element in "${RealNames[@]}" ; do
5062 | if [ "${Element}" == "${RealName}" ] ; then break ; fi
5063 | let i++
5064 | done
5065 | AccountTypes[i]="Administrator"
5066 | fi
5067 | }
5068 |
5069 | function update_RealName {
5070 | # ${1}: RealName
5071 | RealName="${1}"
5072 | j=0
5073 | if check_AttributeReserved "RealName" "${RealName}" ; then
5074 | while [ ${?} -ne 1 ] ; do
5075 | let j++
5076 | check_AttributeReserved "RealName" "${RealName}${j}"
5077 | done
5078 | fi
5079 | if check_AttributeInUse "RealName" "${RealName}" || check_AttributeInUse "RealName" "${RealName}${j}" ; then
5080 | while [ ${?} -ne 1 ] ; do
5081 | let j++
5082 | check_AttributeInUse "RealName" "${RealName}${j}"
5083 | done
5084 | fi
5085 | if check_AttributeReserved "RealName" "${RealName}" || check_AttributeInUse "RealName" "${RealName}" ; then
5086 | RealName="${RealName}${j}"
5087 | fi
5088 | }
5089 |
5090 | function check_RealName {
5091 | # ${1}: RealName
5092 | if check_AttributeReserved "RealName" "${1}" ; then
5093 | update_RealName "${1}"
5094 | printf "\n\033[1mThe name you entered is reserved.\033[m\nPlease enter a different name.\n"
5095 | return 0
5096 | fi
5097 | if check_AttributeInUse "RealName" "${1}" ; then
5098 | update_RealName "${1}"
5099 | printf "\n\033[1mThe name you entered can't be used.\033[m\nThis name is not available. Please enter a different name.\n"
5100 | return 0
5101 | fi
5102 | return 1
5103 | }
5104 |
5105 | function update_RecordName {
5106 | # ${1}: RealName or RecordName
5107 | RecordName=`echo "${1}" | tr "[:upper:]" "[:lower:]" | tr "[=à=]" "a" | tr "[=á=]" "a" | tr "[=å=]" "a" | tr "[=ä=]" "a" | tr "[=â=]" "a" | tr "[=ã=]" "a" | tr "[=ç=]" "c" | tr "[=è=]" "e" | tr "[=é=]" "e" | tr "[=ë=]" "e" | tr "[=ê=]" "e" | tr "[=ì=]" "i" | tr "[=í=]" "i" | tr "[=ï=]" "i" | tr "[=î=]" "i" | tr "[=ñ=]" "n" | tr "[=ò=]" "o" | tr "[=ó=]" "o" | tr "[=ö=]" "o" | tr "[=ô=]" "o" | tr "[=õ=]" "o" | tr "[=ù=]" "u" | tr "[=ú=]" "u" | tr "[=ü=]" "u" | tr "[=û=]" "u" | tr "[=ÿ=]" "y"`
5108 | RecordName="${RecordName//[^a-zA-Z0-9_.-]/}"
5109 | i=0
5110 | if check_AttributeReserved "RecordName" "${RecordName}" ; then
5111 | while [ ${?} -ne 1 ] ; do
5112 | let i++
5113 | check_AttributeReserved "RecordName" "${RecordName}${i}"
5114 | done
5115 | fi
5116 | if check_AttributeInUse "RecordName" "${RecordName}" || check_AttributeInUse "RecordName" "${RecordName}${i}" ; then
5117 | while [ ${?} -ne 1 ] ; do
5118 | let i++
5119 | check_AttributeInUse "RecordName" "${RecordName}${i}"
5120 | done
5121 | fi
5122 | if check_AttributeReserved "RecordName" "${RecordName}" || check_AttributeInUse "RecordName" "${RecordName}" ; then
5123 | RecordName="${RecordName}${i}"
5124 | fi
5125 | }
5126 |
5127 | function check_RecordName {
5128 | # ${1}: RecordName
5129 | badChars="${1//[-a-zA-Z0-9_.-]/}"
5130 | if [ -n "${badChars}" ] ; then
5131 | update_RecordName "${1}"
5132 | printf "\n\033[1mThe short name you entered can't be used.\033[m\nTry using a short name with fewer characters, or with no punctuation marks. Please enter a different name.\n"
5133 | return 0
5134 | fi
5135 | if check_AttributeReserved "RecordName" "${1}" ; then
5136 | update_RecordName "${1}"
5137 | printf "\n\033[1mThe short name you entered is reserved.\033[m\nPlease enter a different short name.\n"
5138 | return 0
5139 | fi
5140 | if check_AttributeInUse "RecordName" "${1}" ; then
5141 | update_RecordName "${1}"
5142 | printf "\n\033[1mThe short name you entered can't be used.\033[m\nThis short name is not available. Please enter a different name.\n"
5143 | return 0
5144 | fi
5145 | return 1
5146 | }
5147 |
5148 | function check_Password {
5149 | # ${1}: Password
5150 | # ${2}: Verification
5151 | if [ "${1}" != "${2}" ] ; then
5152 | printf "\n\033[1mThe passwords do not match.\033[m\nPlease re-enter your password."
5153 | return 0
5154 | fi
5155 | return 1
5156 | }
5157 |
5158 | function check_AuthenticationHint {
5159 | # ${1}: AuthenticationHint
5160 | # ${2}: Password
5161 | if [ "${1}" == "" ] ; then return 1 ; fi
5162 | if [ "${1}" == "${2}" ] ; then
5163 | printf "\n\033[1mThe hint and the password are the same.\033[m\nThis is a security risk. Please enter a different hint.\n"
5164 | return 0
5165 | fi
5166 | return 1
5167 | }
5168 |
5169 | function update_UniqueID {
5170 | # ${1}: UniqueID
5171 | UniqueID="${1//[^0-9]/}"
5172 | if check_AttributeReserved "UniqueID" ${UniqueID} ; then
5173 | while [ ${?} -ne 1 ] ; do
5174 | let UniqueID++
5175 | check_AttributeReserved "UniqueID" ${UniqueID}
5176 | done
5177 | fi
5178 | if check_AttributeInUse "UniqueID" ${UniqueID} ; then
5179 | while [ ${?} -ne 1 ] ; do
5180 | let UniqueID++
5181 | check_AttributeInUse "UniqueID" ${UniqueID}
5182 | done
5183 | fi
5184 | }
5185 |
5186 | function check_UniqueID {
5187 | # ${1}: UniqueID
5188 | badChars="${1//[-0-9]/}"
5189 | if [ -n "${badChars}" ] ; then
5190 | update_UniqueID ${1}
5191 | printf "\n\033[1mThe user id you entered can't be used.\033[m\nThe user id may only contain numeric characters. Please enter a different user id.\n"
5192 | return 0
5193 | fi
5194 | if check_AttributeReserved "UniqueID" "${1}" ; then
5195 | update_UniqueID ${1}
5196 | printf "\n\033[1mThe user id you entered is reserved.\033[m\nPlease enter a different user id.\n"
5197 | return 0
5198 | fi
5199 | if check_AttributeInUse "UniqueID" "${1}" ; then
5200 | update_UniqueID ${1}
5201 | printf "\n\033[1mThe user id you entered can't be used.\033[m\nThis user id is not available. Please enter a different user id.\n"
5202 | return 0
5203 | fi
5204 | return 1
5205 | }
5206 |
5207 | function update_UserShell {
5208 | if [ "${AccountType}" == "Sharing Only" ] ; then
5209 | UserShell="/usr/bin/false"
5210 | fi
5211 | if [ "${AccountType}" != "Sharing Only" ] && [ "${UserShell}" == "/usr/bin/false" ] ; then
5212 | UserShell="/bin/bash"
5213 | fi
5214 | }
5215 |
5216 | function update_NFSHomeDirectory {
5217 | if [ "${AccountType}" == "Sharing Only" ] ; then
5218 | NFSHomeDirectory="/dev/null"
5219 | return 0
5220 | fi
5221 | if [ -z "${UniqueID}" ] ; then
5222 | unset NFSHomeDirectory
5223 | return 0
5224 | fi
5225 | if [ -z "${UniqueID}" ] || [ ${UniqueID} -gt 500 ] ; then
5226 | NFSHomeDirectory="/Users/${RecordName}"
5227 | else
5228 | NFSHomeDirectory="/var/${RecordName}"
5229 | fi
5230 | }
5231 |
5232 | function check_NFSHomeDirectory {
5233 | # ${1}: NFSHomeDirectory
5234 | escapedPath="${1//[\$\(\)\[\]\`\~\?\*\#\\\!\|\'\"]/_}"
5235 | if [ "${1}" != "${escapedPath}" ] ; then
5236 | printf "\n\033[1mThe path \"${1}\" can't be used.\033[m\nTry using a path with no punctuation marks. Please enter a different path.\n"
5237 | return 0
5238 | fi
5239 | relativePath=`echo "${1}" | awk -F "/" '{print $1}'`
5240 | if [ -n "${relativePath}" ] ; then
5241 | printf "\n\033[1mThe path \"${1}\" can't be used.\033[m\nThe path must be absolute. Please enter an absolute path.\n"
5242 | return 0
5243 | fi
5244 | if [ -f "${Target}/${1}" ] ; then
5245 | printf "\n\033[1mThe path \"${1}\" can't be used.\033[m\nThe specified path is to a file. Please enter a different path.\n"
5246 | return 0
5247 | fi
5248 | for Element in "${LocalNFSHomeDirectories[@]}" ; do
5249 | if [ "${1}" == "${Element}" ] ; then return 1 ; fi
5250 | done
5251 | if [ -d "${Target}/${1}" ] ; then
5252 | printf "\n\033[1mThe path \"${1}\" already exists.\033[m\nThe folder will become the home folder for the new account.\n"
5253 | return 1
5254 | fi
5255 | return 1
5256 | }
5257 |
5258 | function display_UserAccount {
5259 | printf "Account Type: "
5260 | if [ -n "${AccountType}" ] ; then printf "${AccountType}" ; else printf "-" ; fi
5261 | printf "\nFull Name: "
5262 | if [ -n "${RealName}" ] ; then printf "${RealName}" ; else printf "-" ; fi
5263 | printf "\nAccount Name: "
5264 | if [ -n "${RecordName}" ] ; then printf "${RecordName}" ; else printf "-" ; fi
5265 | printf "\nPassword: "
5266 | if [ -n "${Password}" ] ; then
5267 | i=0 ; while [ ${i} -lt ${#Password} ] ; do printf "*" ; let i++ ; done
5268 | else
5269 | printf "-"
5270 | fi
5271 | printf "\nPassword Hint: "
5272 | if [ -n "${AuthenticationHint}" ] ; then printf "${AuthenticationHint}" ; else printf "-" ; fi
5273 | printf "\nUser ID: "
5274 | if [ -n "${UniqueID}" ] ; then printf "${UniqueID}" ; else printf "-" ; fi
5275 | printf "\nLogin Shell: "
5276 | if [ -n "${UserShell}" ] ; then printf "${UserShell}" ; else printf "-" ; fi
5277 | printf "\nHome Directory: "
5278 | if [ -n "${NFSHomeDirectory}" ] ; then printf "${NFSHomeDirectory}" ; else printf "-" ; fi
5279 | printf "\n"
5280 | printf "\n"
5281 | }
5282 |
5283 | function select_AccountType {
5284 | UserTypes=( "Administrator" "Standard" "Sharing Only" )
5285 | display_Subtitle "Account Type"
5286 | display_UserAccount
5287 | if [ -n "${AccountType}" ] ; then
5288 | i=0 ; for Element in "${AccountTypes[@]}" ; do
5289 | if [ "${Element}" == "Administrator" ] ; then let i++ ; fi
5290 | done
5291 | if [ ${i} -eq 0 ] && [ "${AccountType}" == "Administrator" ] ; then
5292 | press_anyKey "You must have at least one Administrator account."
5293 | return 0
5294 | fi
5295 | fi
5296 | display_Options "Account types" "Select an account type: "
5297 | select AccountType in "${UserTypes[@]}" ; do
5298 | if [ -n "${AccountType}" ] ; then break ; fi
5299 | done
5300 | update_UserShell
5301 | update_NFSHomeDirectory
5302 | }
5303 |
5304 | function set_RealName {
5305 | unset newRealName
5306 | while [ -z "${newRealName}" ] ; do
5307 | display_Subtitle "Full Name"
5308 | display_UserAccount
5309 | printf "Full name" ; if [ -n "${RealName}" ] ; then printf " (${RealName})" ; fi ; printf ": "
5310 | read newRealName
5311 | if [ -z "${newRealName}" ] && [ -n "${RealName}" ] ; then
5312 | if [ "${newRealName}" == "${RealName}" ] ; then
5313 | return 1
5314 | else
5315 | newRealName="${RealName}"
5316 | fi
5317 | fi
5318 | check_RealName "${newRealName}"
5319 | while [ ${?} -ne 1 ] ; do
5320 | printf "\nFull name" ; if [ -n "${RealName}" ] ; then printf " (${RealName})" ; fi ; printf ": "
5321 | read newRealName
5322 | if [ -z "${newRealName}" ] || [ "${newRealName}" == "${RealName}" ] ; then return 1 ; fi
5323 | check_RealName "${newRealName}"
5324 | done
5325 | done
5326 | RealName="${newRealName}"
5327 | }
5328 |
5329 | function set_RecordName {
5330 | unset newRecordName
5331 | while [ -z "${newRecordName}" ] ; do
5332 | display_Subtitle "Account Name"
5333 | display_UserAccount
5334 | printf "Account name" ; if [ -n "${RecordName}" ] ; then printf " (${RecordName})" ; fi ; printf ": "
5335 | read newRecordName
5336 | if [ -z "${newRecordName}" ] && [ -n "${RecordName}" ] ; then
5337 | if [ "${newRecordName}" == "${RecordName}" ] ; then
5338 | return 1
5339 | else
5340 | newRecordName="${RecordName}"
5341 | fi
5342 | fi
5343 | check_RecordName "${newRecordName}"
5344 | while [ ${?} -ne 1 ] ; do
5345 | printf "\nAccount name" ; if [ -n "${RecordName}" ] ; then printf " (${RecordName})" ; fi ; printf ": "
5346 | read newRecordName
5347 | if [ -z "${newRecordName}" ] || [ "${newRecordName}" == "${RecordName}" ] ; then return 1 ; fi
5348 | check_RecordName "${newRecordName}"
5349 | done
5350 | done
5351 | RecordName="${newRecordName}"
5352 | }
5353 |
5354 | function set_Password {
5355 | display_Subtitle "Password"
5356 | display_UserAccount
5357 | printf "Password: " ; stty -echo ; read Password ; stty echo
5358 | printf "\nVerify: " ; stty -echo ; read Verify ; stty echo
5359 | check_Password "${Password}" "${Verify}"
5360 | while [ ${?} -ne 1 ] ; do
5361 | printf "\nPassword: " ; stty -echo ; read Password ; stty echo
5362 | printf "\nVerify: " ; stty -echo ; read Verify ; stty echo
5363 | check_Password "${Password}" "${Verify}"
5364 | done
5365 | }
5366 |
5367 | function set_AuthenticationHint {
5368 | display_Subtitle "Password Hint"
5369 | display_UserAccount
5370 | printf "Password hint: " ; read AuthenticationHint
5371 | check_AuthenticationHint "${AuthenticationHint}" "${Password}"
5372 | while [ ${?} -ne 1 ] ; do
5373 | printf "\nPassword Hint: " ; read AuthenticationHint
5374 | check_AuthenticationHint "${AuthenticationHint}" "${Password}"
5375 | done
5376 | }
5377 |
5378 | function set_UniqueID {
5379 | display_Subtitle "User ID"
5380 | display_UserAccount
5381 | printf "User ID" ; if [ -n "${UniqueID}" ] ; then printf " (${UniqueID})" ; fi ; printf ": "
5382 | read newUniqueID
5383 | if [ -z "${newUniqueID}" ] || [ "${newUniqueID}" == "${UniqueID}" ] ; then return 1 ; fi
5384 | check_UniqueID "${newUniqueID}"
5385 | while [ ${?} -ne 1 ] ; do
5386 | printf "\nUser ID" ; if [ -n "${UniqueID}" ] ; then printf " (${UniqueID})" ; fi ; printf ": "
5387 | read newUniqueID
5388 | if [ -z "${newUniqueID}" ] || [ "${newUniqueID}" == "${UniqueID}" ] ; then return 1 ; fi
5389 | check_UniqueID "${newUniqueID}"
5390 | done
5391 | UniqueID="${newUniqueID}"
5392 | }
5393 |
5394 | function select_UserShell {
5395 | if [ "${AccountType}" != "Sharing Only" ] ; then
5396 | LoginShells=( "/bin/bash" "/bin/tcsh" "/bin/sh" "/bin/csh" "/bin/zsh" "/bin/ksh" )
5397 | display_Subtitle "Login Shell"
5398 | display_UserAccount
5399 | display_Options "Login shells" "Select a login shell: "
5400 | select UserShell in "${LoginShells[@]}" ; do
5401 | if [ -n "${UserShell}" ] ; then break ; fi
5402 | done
5403 | fi
5404 | }
5405 |
5406 | function set_NFSHomeDirectory {
5407 | if [ "${AccountType}" != "Sharing Only" ] ; then
5408 | display_Subtitle "Home Directory"
5409 | display_UserAccount
5410 | printf "Home directory" ; if [ -n "${NFSHomeDirectory}" ] ; then printf " (${NFSHomeDirectory})" ; fi ; printf ": "
5411 | read newNFSHomeDirectory
5412 | if [ -z "${newNFSHomeDirectory}" ] || [ "${newNFSHomeDirectory}" == "${NFSHomeDirectory}" ] ; then return 1 ; fi
5413 | check_NFSHomeDirectory "${newNFSHomeDirectory}"
5414 | while [ ${?} -ne 1 ] ; do
5415 | printf "\nHome directory" ; if [ -n "${NFSHomeDirectory}" ] ; then printf " (${NFSHomeDirectory})" ; fi ; printf ": "
5416 | read newNFSHomeDirectory
5417 | if [ -z "${newNFSHomeDirectory}" ] || [ "${newNFSHomeDirectory}" == "${NFSHomeDirectory}" ] ; then return 1 ; fi
5418 | check_NFSHomeDirectory "${newNFSHomeDirectory}"
5419 | done
5420 | NFSHomeDirectory="${newNFSHomeDirectory}"
5421 | fi
5422 | }
5423 |
5424 | function display_Users {
5425 | printf "User Accounts: "
5426 | if [ -n "${RealNames[0]}" ] ; then printf "${RealNames[0]}" ; else printf "-" ; fi
5427 | printf "\n"
5428 | i=1 ; while [ ${i} -lt ${#RealNames[@]} ] ; do
5429 | printf " ${RealNames[i]}\n"
5430 | let i++
5431 | done
5432 | printf "\n"
5433 | }
5434 |
5435 | function menu_AddUser {
5436 | unset AccountType
5437 | unset RealName
5438 | unset RecordName
5439 | unset Password
5440 | unset AuthenticationHint
5441 | unset UniqueID
5442 | unset UserShell
5443 | unset NFSHomeDirectory
5444 | display_Subtitle "Add User"
5445 | display_UserAccount
5446 | if [ ${#AccountTypes[@]} -eq 0 ] ; then
5447 | AccountType="Administrator"
5448 | else
5449 | select_AccountType
5450 | fi
5451 | set_RealName
5452 | update_RecordName "${RealName}"
5453 | update_UniqueID 501
5454 | update_UserShell
5455 | update_NFSHomeDirectory
5456 | set_RecordName
5457 | update_NFSHomeDirectory
5458 | set_Password
5459 | set_AuthenticationHint
5460 | set_UniqueID
5461 | update_NFSHomeDirectory
5462 | select_UserShell
5463 | set_NFSHomeDirectory
5464 | AccountTypes=( "${AccountTypes[@]}" "${AccountType}" )
5465 | RealNames=( "${RealNames[@]}" "${RealName}" )
5466 | RecordNames=( "${RecordNames[@]}" "${RecordName}" )
5467 | Passwords=( "${Passwords[@]}" "${Password}" )
5468 | AuthenticationHints=( "${AuthenticationHints[@]}" "${AuthenticationHint}" )
5469 | UniqueIDs=( ${UniqueIDs[@]} ${UniqueID} )
5470 | UserShells=( "${UserShells[@]}" "${UserShell}" )
5471 | NFSHomeDirectories=( "${NFSHomeDirectories[@]}" "${NFSHomeDirectory}" )
5472 | }
5473 |
5474 | function menu_EditUser {
5475 | display_Subtitle "Edit User"
5476 | if [ ${#RealNames[@]} -eq 0 ] ; then
5477 | press_anyKey "No users available, please create a user first."
5478 | return 0
5479 | fi
5480 | display_Users
5481 | display_Options "Users" "Select a user: "
5482 | select RealName in "${RealNames[@]}" ; do
5483 | if [ -n "${RealName}" ] ; then break ; fi
5484 | done
5485 | i=0 ; for Element in "${RealNames[@]}" ; do
5486 | if [ "${Element}" == "${RealName}" ] ; then break ; fi
5487 | let i++
5488 | done
5489 | unset RealNames[i]
5490 | AccountType="${AccountTypes[i]}" ; unset AccountTypes[i]
5491 | RecordName="${RecordNames[i]}" ; unset RecordNames[i]
5492 | Password="${Passwords[i]}" ; unset Passwords[i]
5493 | AuthenticationHints="${AuthenticationHints[i]}" ; unset AuthenticationHints[i]
5494 | UniqueID=${UniqueIDs[i]} ; unset UniqueIDs[i]
5495 | UserShell="${UserShells[i]}" ; unset UserShells[i]
5496 | NFSHomeDirectory="${NFSHomeDirectories[i]}" ; unset NFSHomeDirectories[i]
5497 | UserOptions=( "Users Menu" "Account Type" "Full Name" "Account Name" "Password" "Password Hint" "User ID" "Login shell" "Home Directory" )
5498 | while [ "${Option}" != "Users Menu" ] ; do
5499 | display_Subtitle "Edit User"
5500 | display_UserAccount
5501 | display_Options "Options" "Select an option: "
5502 | select Option in "${UserOptions[@]}" ; do
5503 | case "${Option}" in
5504 | "Users Menu" ) break ;;
5505 | "Account Type" ) select_AccountType ; unset Option ; break ;;
5506 | "Full Name" ) set_RealName ; unset Option ; break ;;
5507 | "Account Name" ) set_RecordName ; unset Option ; break ;;
5508 | "Password" ) set_Password ; unset Option ; break ;;
5509 | "Password Hint" ) set_AuthenticationHint ; unset Option ; break ;;
5510 | "User ID" ) set_UniqueID ; unset Option ; break ;;
5511 | "Login shell" ) select_UserShell ; unset Option ; break ;;
5512 | "Home Directory" ) set_NFSHomeDirectory ; unset Option ; break ;;
5513 | esac
5514 | done
5515 | done
5516 | unset Option
5517 | AccountTypes=( "${AccountTypes[@]}" "${AccountType}" )
5518 | RealNames=( "${RealNames[@]}" "${RealName}" )
5519 | RecordNames=( "${RecordNames[@]}" "${RecordName}" )
5520 | Passwords=( "${Passwords[@]}" "${Password}" )
5521 | AuthenticationHints=( "${AuthenticationHints[@]}" "${AuthenticationHint}" )
5522 | UniqueIDs=( ${UniqueIDs[@]} ${UniqueID} )
5523 | UserShells=( "${UserShells[@]}" "${UserShell}" )
5524 | NFSHomeDirectories=( "${NFSHomeDirectories[@]}" "${NFSHomeDirectory}" )
5525 | }
5526 |
5527 | function menu_DeleteUser {
5528 | display_Subtitle "Delete User"
5529 | if [ ${#RealNames[@]} -eq 0 ] ; then
5530 | press_anyKey "No users available, please create a user first."
5531 | return 0
5532 | fi
5533 | display_Users
5534 | display_Options "Users" "Select a user: "
5535 | select RealName in "${RealNames[@]}" ; do
5536 | if [ -n "${RealName}" ] ; then break ; fi
5537 | done
5538 | i=0 ; for Element in "${RealNames[@]}" ; do
5539 | if [ "${Element}" == "${RealName}" ] ; then break ; fi
5540 | let i++
5541 | done
5542 | unset ConfirmDelete
5543 | while [ -z "${ConfirmDelete}" ] ; do
5544 | echo
5545 | read -sn 1 -p "Are you sure you want to delete the user account \"${RealName}\" (Y/n)? " ConfirmDelete < /dev/tty
5546 | if [ -z "${ConfirmDelete}" ] ; then ConfirmDelete="y" ; fi
5547 | echo
5548 | case "${ConfirmDelete}" in
5549 | "Y" | "y" ) unset AccountTypes[i] ; unset RealNames[i] ; unset RecordNames[i] ; unset Passwords[i] ; unset AuthenticationHints[i] ; unset UniqueIDs[i] ; unset UserShells[i] ; unset NFSHomeDirectories[i] ; echo ;;
5550 | "N" | "n" ) echo ;;
5551 | * ) echo ; unset ConfirmDelete ;;
5552 | esac
5553 | done
5554 | unset ConfirmDelete
5555 | unset RealName
5556 | AccountTypes=( "${AccountTypes[@]}" )
5557 | RealNames=( "${RealNames[@]}" )
5558 | RecordNames=( "${RecordNames[@]}" )
5559 | Passwords=( "${Passwords[@]}" )
5560 | AuthenticationHints=( "${AuthenticationHints[@]}" )
5561 | UniqueIDs=( ${UniqueIDs[@]} )
5562 | UserShells=( "${UserShells[@]}" )
5563 | NFSHomeDirectories=( "${NFSHomeDirectories[@]}" )
5564 | check_AccountTypes
5565 | }
5566 |
5567 | function menu_Users {
5568 | AccountOptions=( "System Setup Menu" "Add User" "Edit User" "Delete User" )
5569 | while [ "${Option}" != "System Setup Menu" ] ; do
5570 | display_Subtitle "Users"
5571 | display_Users
5572 | display_Options "Options" "Select an option: "
5573 | select Option in "${AccountOptions[@]}" ; do
5574 | case "${Option}" in
5575 | "System Setup Menu" ) break ;;
5576 | "Add User" ) menu_AddUser ; unset Option ; break ;;
5577 | "Edit User" ) menu_EditUser ; unset Option ; break ;;
5578 | "Delete User" ) menu_DeleteUser ; unset Option ; break ;;
5579 | esac
5580 | done
5581 | done
5582 | unset Option
5583 | }
5584 |
5585 | # Section: Packages
5586 |
5587 | function detect_AvailablePackages {
5588 | unset AvailablePackages[@]
5589 | IFS=$'\n'
5590 | AvailablePackages=( `find "${PackageFolder}" -name "*pkg" -a \! -path "*pkg/*" -exec basename {} \;` )
5591 | unset IFS
5592 | }
5593 |
5594 | function display_Packages {
5595 | printf "Packages: "
5596 | if [ -n "${Packages[0]}" ] ; then printf "${Packages[0]}" ; else printf "-" ; fi
5597 | printf "\n"
5598 | i=1 ; while [ ${i} -lt ${#Packages[@]} ] ; do
5599 | printf " ${Packages[i]}\n"
5600 | let i++
5601 | done
5602 | printf "\n"
5603 | }
5604 |
5605 | function select_Package {
5606 | unset Package
5607 | display_Subtitle "Select Package"
5608 | display_Packages
5609 | detect_AvailablePackages
5610 | i=0 ; for AvailablePackage in "${AvailablePackages[@]}" ; do
5611 | for Element in "${Packages[@]}" ; do
5612 | if [ "${Element}" == "${AvailablePackage}" ] ; then unset AvailablePackages[i] ; break ; fi
5613 | done
5614 | let i++
5615 | done
5616 | if [ ${#AvailablePackages[@]} -eq 0 ] ; then
5617 | press_anyKey "No packages available."
5618 | unset Packages[@]
5619 | else
5620 | display_Options "Packages" "Select a package: "
5621 | select Package in "${AvailablePackages[@]}" ; do
5622 | if [ -n "${Package}" ] ; then break ; fi
5623 | done
5624 | Packages=( "${Packages[@]}" "${Package}" )
5625 | fi
5626 | }
5627 |
5628 | function remove_Package {
5629 | unset Package
5630 | display_Subtitle "Remove Package"
5631 | if [ ${#Packages[@]} -eq 0 ] ; then
5632 | press_anyKey "No packages available, please select a package first."
5633 | return 0
5634 | fi
5635 | select Package in "${Packages[@]}" ; do
5636 | if [ -n "${Package}" ] ; then break ; fi
5637 | done
5638 | i=0 ; for Element in "${Packages[@]}" ; do
5639 | if [ "${Element}" == "${Package}" ] ; then unset Packages[i] ; break ; fi
5640 | let i++
5641 | done
5642 | Packages=( "${Packages[@]}" )
5643 | }
5644 |
5645 | function menu_Packages {
5646 | PackageOptions=( "System Setup Menu" "Add Package" "Remove Package" )
5647 | while [ "${Option}" != "System Setup Menu" ] ; do
5648 | display_Subtitle "Packages"
5649 | display_Packages
5650 | display_Options "Options" "Select an option: "
5651 | select Option in "${PackageOptions[@]}" ; do
5652 | case "${Option}" in
5653 | "System Setup Menu" ) break ;;
5654 | "Add Package" ) select_Package ; unset Option ; break ;;
5655 | "Remove Package" ) remove_Package ; unset Option ; break ;;
5656 | esac
5657 | done
5658 | done
5659 | unset Option
5660 | }
5661 |
5662 | # Section: Remove Software
5663 |
5664 | function detect_RemovableItems {
5665 | unset AvailableRemovableItems[@]
5666 | if [ -e "${Target}/Applications/iPhoto.app" ] ; then AvailableRemovableItems=( "iPhoto" ) ; fi
5667 | if [ -e "${Target}/Applications/iMovie.app" ] ; then AvailableRemovableItems=( "${AvailableRemovableItems[@]}" "iMovie" ) ; fi
5668 | if [ -e "${Target}/Applications/iDVD.app" ] ; then AvailableRemovableItems=( "${AvailableRemovableItems[@]}" "iDVD" ) ; fi
5669 | if [ -e "${Target}/Applications/GarageBand.app" ] ; then AvailableRemovableItems=( "${AvailableRemovableItems[@]}" "GarageBand" ) ; fi
5670 | if [ -e "${Target}/Library/Receipts/iLifeSoundEffects_Loops.pkg" ] || [ -e "${Target}/var/db/receipts/com.apple.pkg.iLifeSoundEffects_Loops.bom" ] ; then AvailableRemovableItems=( "${AvailableRemovableItems[@]}" "Sounds & Jingles" ) ; fi
5671 | if [ -e "${Target}/Applications/iWeb.app" ] ; then AvailableRemovableItems=( "${AvailableRemovableItems[@]}" "iWeb" ) ; fi
5672 | i=0 ; for Item in "${AvailableRemovableItems[@]}" ; do
5673 | for Element in "${RemovableItems[@]}" ; do
5674 | if [ "${Item}" == "${Element}" ] ; then unset AvailableRemovableItems[i] ; break ; fi
5675 | done
5676 | let i++
5677 | done
5678 | AvailableRemovableItems=( "${AvailableRemovableItems[@]}" )
5679 | }
5680 |
5681 | function display_RemovableItems {
5682 | printf "Remove: "
5683 | if [ -n "${RemovableItems[0]}" ] ; then printf "${RemovableItems[0]}" ; else printf "-" ; fi
5684 | printf "\n"
5685 | i=1 ; while [ ${i} -lt ${#RemovableItems[@]} ] ; do
5686 | printf " ${RemovableItems[i]}\n"
5687 | let i++
5688 | done
5689 | printf "\n"
5690 | }
5691 |
5692 | function select_Removable {
5693 | unset Removable
5694 | display_Subtitle "Select Software to Remove"
5695 | display_RemovableItems
5696 | detect_RemovableItems
5697 | if [ ${#AvailableRemovableItems[@]} -eq 0 ] ; then
5698 | press_anyKey "No software available to remove."
5699 | else
5700 | if [ ${#AvailableRemovableItems[@]} -gt 1 ] ; then
5701 | AvailableRemovableItems=( "Select All" "${AvailableRemovableItems[@]}" )
5702 | fi
5703 | display_Options "Software" "Select software to remove: "
5704 | select Removable in "${AvailableRemovableItems[@]}" ; do
5705 | if [ -n "${Removable}" ] ; then break ; fi
5706 | done
5707 | if [ "${Removable}" == "Select All" ] ; then
5708 | unset AvailableRemovableItems[0]
5709 | RemovableItems=( "${RemovableItems[@]}" "${AvailableRemovableItems[@]}" )
5710 | else
5711 | RemovableItems=( "${RemovableItems[@]}" "${Removable}" )
5712 | fi
5713 | fi
5714 | }
5715 |
5716 | function deselect_Removable {
5717 | unset Removable
5718 | display_Subtitle "De-select Software to Remove"
5719 | if [ ${#RemovableItems[@]} -eq 0 ] ; then
5720 | press_anyKey "No software selected for removal."
5721 | return 0
5722 | fi
5723 | if [ ${#RemovableItems[@]} -gt 1 ] ; then
5724 | SelectedRemovableItems=( "Select All" "${RemovableItems[@]}" )
5725 | else
5726 | SelectedRemovableItems=( "${RemovableItems[@]}" )
5727 | fi
5728 | select Removable in "${SelectedRemovableItems[@]}" ; do
5729 | if [ -n "${Removable}" ] ; then break ; fi
5730 | done
5731 | if [ "${Removable}" == "Select All" ] ; then
5732 | unset RemovableItems[@]
5733 | else
5734 | i=0 ; for Element in "${RemovableItems[@]}" ; do
5735 | if [ "${Element}" == "${Removable}" ] ; then unset RemovableItems[i] ; break ; fi
5736 | let i++
5737 | done
5738 | RemovableItems=( "${RemovableItems[@]}" )
5739 | fi
5740 | }
5741 |
5742 | function menu_RemoveSoftware {
5743 | RemoveOptions=( "System Setup Menu" "Select Item" "De-select Item" )
5744 | while [ "${Option}" != "System Setup Menu" ] ; do
5745 | display_Subtitle "Remove Software"
5746 | display_RemovableItems
5747 | display_Options "Options" "Select an option: "
5748 | select Option in "${RemoveOptions[@]}" ; do
5749 | case "${Option}" in
5750 | "System Setup Menu" ) break ;;
5751 | "Select Item" ) select_Removable ; unset Option ; break ;;
5752 | "De-select Item" ) deselect_Removable ; unset Option ; break ;;
5753 | esac
5754 | done
5755 | done
5756 | unset Option
5757 | }
5758 |
5759 | # Section: Configurations
5760 |
5761 | function get_Configurations {
5762 | unset Configurations[@]
5763 | IFS=$'\n'
5764 | Configurations=( `find "${ConfigurationFolder}" -name "*.plist" -exec basename {} \; | awk -F ".plist" '{print $1}'` )
5765 | unset IFS
5766 | }
5767 |
5768 | function new_Configuration {
5769 | Language="English"
5770 | refresh_Language
5771 | SACountryCode="US"
5772 | refresh_Country
5773 | InputSourceID="US"
5774 | refresh_Keyboard
5775 | NTPServer="time.apple.com"
5776 | set_NTPServerName "${NTPServer}"
5777 | NTPEnabled=1
5778 | GeonameID=5341145
5779 | refresh_GeonameID
5780 | TZAuto=0
5781 | RemoteLogin=0
5782 | RemoteManagement=0
5783 | unset UserWarnings[@]
5784 | unset AccountTypes[@]
5785 | unset RealNames[@]
5786 | unset RecordNames[@]
5787 | unset Passwords[@]
5788 | unset AuthenticationHints[@]
5789 | unset UniqueIDs[@]
5790 | unset UserShells[@]
5791 | unset NFSHomeDirectories[@]
5792 | unset Packages[@]
5793 | }
5794 |
5795 | function load_Configuration {
5796 | display_Subtitle "Load Configuration"
5797 | get_Configurations
5798 | if [ ${#Configurations[@]} -eq 0 ] ; then
5799 | press_anyKey "No configurations available, please create a configuration first."
5800 | return 0
5801 | fi
5802 | display_Options "Configurations" "Select a configuration: "
5803 | select Configuration in "${Configurations[@]}" ; do
5804 | if [ -n "${Configuration}" ] ; then break ; fi
5805 | done
5806 | Language=`defaults read "${ConfigurationFolder}/${Configuration}" "Language" 2>/dev/null`
5807 | refresh_Language
5808 | SACountryCode=`defaults read "${ConfigurationFolder}/${Configuration}" "SACountryCode" 2>/dev/null`
5809 | refresh_Country
5810 | InputSourceID=`defaults read "${ConfigurationFolder}/${Configuration}" "InputSourceID" 2>/dev/null`
5811 | refresh_Keyboard
5812 | NTPEnabled=`defaults read "${ConfigurationFolder}/${Configuration}" "NTPEnabled" 2>/dev/null`
5813 | if [ -z "${NTPEnabled}" ] ; then NTPEnabled=1 ; fi
5814 | NTPServer=`defaults read "${ConfigurationFolder}/${Configuration}" "NTPServer" 2>/dev/null`
5815 | if [ -z "${NTPServer}" ] ; then NTPServer="time.apple.com" ; fi
5816 | set_NTPServerName "${NTPServer}"
5817 | GeonameID=`defaults read "${ConfigurationFolder}/${Configuration}" "GeonameID" 2>/dev/null`
5818 | TZAuto=`defaults read "${ConfigurationFolder}/${Configuration}" "TZAuto" 2>/dev/null`
5819 | if [ -z "${TZAuto}" ] ; then TZAuto=0 ; fi
5820 | refresh_GeonameID
5821 | RemoteLogin=`defaults read "${ConfigurationFolder}/${Configuration}" "RemoteLogin" 2>/dev/null`
5822 | if [ ${?} -ne 0 ] ; then RemoteLogin=0 ; fi
5823 | RemoteManagement=`defaults read "${ConfigurationFolder}/${Configuration}" "RemoteManagement" 2>/dev/null`
5824 | if [ ${?} -ne 0 ] ; then RemoteManagement=0 ; fi
5825 | ComputerName=`defaults read "${ConfigurationFolder}/${Configuration}" "ComputerName" 2>/dev/null`
5826 | if [ ${?} -ne 0 ] ; then unset ComputerName ; fi
5827 | unset UserWarnings[@]
5828 | unset AccountTypes[@]
5829 | unset RealNames[@]
5830 | unset RecordNames[@]
5831 | unset Passwords[@]
5832 | unset AuthenticationHints[@]
5833 | unset UniqueIDs[@]
5834 | unset UserShells[@]
5835 | unset NFSHomeDirectories[@]
5836 | i=0 ; while : ; do
5837 | AccountType=`/usr/libexec/PlistBuddy -c "Print :Users:${i}:type" "${ConfigurationFolder}/${Configuration}.plist" 2>/dev/null`
5838 | if [ ${?} -ne 0 ] ; then break ; fi
5839 | UserWarnings[i]=0
5840 | AccountTypes[i]="${AccountType}"
5841 | realname=`/usr/libexec/PlistBuddy -c "Print :Users:${i}:realname" "${ConfigurationFolder}/${Configuration}.plist" 2>/dev/null`
5842 | update_RealName "${realname}"
5843 | if [ "${realname}" != "${RealName}" ] ; then UserWarnings[i]=1 ; fi
5844 | RealNames[i]="${RealName}"
5845 | name=`/usr/libexec/PlistBuddy -c "Print :Users:${i}:name" "${ConfigurationFolder}/${Configuration}.plist" 2>/dev/null`
5846 | update_RecordName "${name}"
5847 | if [ "${name}" != "${RecordName}" ] ; then UserWarnings[i]=1 ; fi
5848 | RecordNames[i]="${RecordName}"
5849 | Passwords[i]=`/usr/libexec/PlistBuddy -c "Print :Users:${i}:passwd" "${ConfigurationFolder}/${Configuration}.plist" 2>/dev/null`
5850 | AuthenticationHints[i]=`/usr/libexec/PlistBuddy -c "Print :Users:${i}:hint" "${ConfigurationFolder}/${Configuration}.plist" 2>/dev/null`
5851 | uid=`/usr/libexec/PlistBuddy -c "Print :Users:${i}:uid" "${ConfigurationFolder}/${Configuration}.plist" 2>/dev/null`
5852 | update_UniqueID "${uid}"
5853 | if [ ${uid} -ne ${UniqueID} ] ; then UserWarnings[i]=1 ; fi
5854 | UniqueIDs[i]=${UniqueID}
5855 | UserShells[i]=`/usr/libexec/PlistBuddy -c "Print :Users:${i}:shell" "${ConfigurationFolder}/${Configuration}.plist" 2>/dev/null`
5856 | NFSHomeDirectories[i]=`/usr/libexec/PlistBuddy -c "Print :Users:${i}:home" "${ConfigurationFolder}/${Configuration}.plist" 2>/dev/null`
5857 | let i++
5858 | done
5859 | unset Packages[@]
5860 | i=0 ; while : ; do
5861 | Package=`/usr/libexec/PlistBuddy -c "Print :Packages:${i}" "${ConfigurationFolder}/${Configuration}.plist" 2>/dev/null`
5862 | if [ ${?} -ne 0 ] ; then break ; fi
5863 | Packages[i]="${Package}"
5864 | let i++
5865 | done
5866 | unset RemovableItems[@]
5867 | i=0 ; while : ; do
5868 | RemovableItem=`/usr/libexec/PlistBuddy -c "Print :RemovableItems:${i}" "${ConfigurationFolder}/${Configuration}.plist" 2>/dev/null`
5869 | if [ ${?} -ne 0 ] ; then break ; fi
5870 | RemovableItems[i]="${RemovableItem}"
5871 | let i++
5872 | done
5873 | }
5874 |
5875 | function save_Configuration {
5876 | unset ConfigurationName
5877 | unset Overwrite
5878 | display_Subtitle "Save Configuration"
5879 | while [ -z "${ConfigurationName}" ] ; do
5880 | printf "Configuration name" ; if [ -n "${Configuration}" ] ; then printf " (${Configuration})" ; fi ; printf ": "
5881 | read ConfigurationName
5882 | if [ -z "${ConfigurationName}" ] ; then ConfigurationName="${Configuration}" ; fi
5883 | done
5884 | if [ "${ConfigurationName}" != "${Configuration}" ] ; then
5885 | while [ -e "${ConfigurationFolder}/${ConfigurationName}.plist" ] ; do
5886 | printf "\nA configuration already exists named \033[1m${ConfigurationName}\033[m.\n"
5887 | read -sn 1 -p "Would you like to overwrite it (y/N)? " Overwrite < /dev/tty ; echo
5888 | if [ -z "${Overwrite}" ] ; then Overwrite="n" ; fi
5889 | case "${Overwrite}" in
5890 | "Y" | "y" ) echo ; break ;;
5891 | "N" | "n" ) echo ; return 0 ;;
5892 | esac
5893 | done
5894 | fi
5895 | Configuration="${ConfigurationName}"
5896 | if [ -e "${ConfigurationFolder}/${Configuration}.plist" ] ; then rm "${ConfigurationFolder}/${Configuration}.plist" ; fi
5897 | defaults write "${ConfigurationFolder}/${Configuration}" "Language" -string "${Language}"
5898 | defaults write "${ConfigurationFolder}/${Configuration}" "SACountryCode" -string "${SACountryCode}"
5899 | set_InputSourceID "${SAKeyboard}" "${SATypingStyle}"
5900 | defaults write "${ConfigurationFolder}/${Configuration}" "InputSourceID" -string "${InputSourceID}"
5901 | if [ ${NTPEnabled} -eq 1 ] ;then
5902 | defaults write "${ConfigurationFolder}/${Configuration}" "NTPEnabled" -bool TRUE
5903 | else
5904 | defaults write "${ConfigurationFolder}/${Configuration}" "NTPEnabled" -bool FALSE
5905 | fi
5906 | defaults write "${ConfigurationFolder}/${Configuration}" "NTPServer" -string "${NTPServer}"
5907 | defaults write "${ConfigurationFolder}/${Configuration}" "GeonameID" -int ${GeonameID}
5908 | if [ ${TZAuto} -eq 1 ] ;then
5909 | defaults write "${ConfigurationFolder}/${Configuration}" "TZAuto" -bool TRUE
5910 | else
5911 | defaults write "${ConfigurationFolder}/${Configuration}" "TZAuto" -bool FALSE
5912 | fi
5913 | if [ ${RemoteLogin} -eq 1 ] ;then
5914 | defaults write "${ConfigurationFolder}/${Configuration}" "RemoteLogin" -bool TRUE
5915 | else
5916 | defaults write "${ConfigurationFolder}/${Configuration}" "RemoteLogin" -bool FALSE
5917 | fi
5918 | if [ ${RemoteManagement} -eq 1 ] ;then
5919 | defaults write "${ConfigurationFolder}/${Configuration}" "RemoteManagement" -bool TRUE
5920 | else
5921 | defaults write "${ConfigurationFolder}/${Configuration}" "RemoteManagement" -bool FALSE
5922 | fi
5923 | defaults write "${ConfigurationFolder}/${Configuration}" "ComputerName" -string "${ComputerName}"
5924 | defaults write "${ConfigurationFolder}/${Configuration}" "Users" -array
5925 | i=0 ; for Account in "${AccountTypes[@]}" ; do
5926 | defaults write "${ConfigurationFolder}/${Configuration}" "Users" -array-add "{ \"type\" = \"${AccountTypes[i]}\"; \"realname\" = \"${RealNames[i]}\"; \"name\" = \"${RecordNames[i]}\"; \"passwd\" = \"${Passwords[i]}\"; \"hint\" = \"${AuthenticationHints[i]}\"; \"uid\" = \"${UniqueIDs[i]}\"; \"shell\" = \"${UserShells[i]}\"; \"home\" = \"${NFSHomeDirectories[i]}\"; }"
5927 | let i++
5928 | done
5929 | defaults write "${ConfigurationFolder}/${Configuration}" "Packages" -array "${Packages[@]}"
5930 | defaults write "${ConfigurationFolder}/${Configuration}" "RemovableItems" -array "${RemovableItems[@]}"
5931 | }
5932 |
5933 | function menu_Configurations {
5934 | ConfigurationOptions=( "System Setup Menu" "New Configuration" "Load Configuration" "Save Configuration" )
5935 | while [ "${Option}" != "System Setup Menu" ] ; do
5936 | display_Subtitle "Configurations"
5937 | display_Options "Options" "Select an option: "
5938 | select Option in "${ConfigurationOptions[@]}" ; do
5939 | case "${Option}" in
5940 | "System Setup Menu" ) break ;;
5941 | "New Configuration" ) new_Configuration ; unset Option ; return 0 ;;
5942 | "Load Configuration" ) load_Configuration ; unset Option ; return 0 ;;
5943 | "Save Configuration" ) save_Configuration ; unset Option ; return 0 ;;
5944 | esac
5945 | done
5946 | done
5947 | }
5948 |
5949 | function apply_Configuration {
5950 | display_Subtitle "Apply Configuration"
5951 | if [ ${TargetType} -eq 0 ] ; then
5952 | press_anyKey "No target selected, please select a target first."
5953 | return 0
5954 | fi
5955 | unset NoUser
5956 | if [ ${#RecordNames[@]} -eq 0 ] ; then
5957 | while [ -z "${NoUser}" ] ; do
5958 | printf "No user accounts have been created.\n"
5959 | read -sn 1 -p "Are you sure you want to proceed (y/N)? " NoUser < /dev/tty
5960 | echo
5961 | if [ -z "${NoUser}" ] ; then NoUser="n" ; fi
5962 | case "${NoUser}" in
5963 | "Y" | "y" ) echo ; break ;;
5964 | "N" | "n" ) return 0 ;;
5965 | * ) unset NoUser ;;
5966 | esac
5967 | done
5968 | fi
5969 | if [ ${TargetType} -eq 2 ] ; then
5970 | if [ -e "${LibraryFolder}/${TargetName}.shadow" ] ; then rm -f "${LibraryFolder}/${TargetName}.shadow" ; fi
5971 | ExportName="${TargetName//.dmg/}"
5972 | if [ -n "${Configuration}" ] ; then ExportName="${ExportName}-${Configuration}" ; fi
5973 | MasterName="${ExportName}.i386.hfs.dmg"
5974 | RecoveryName="${ExportName}.i386.recovery.dmg"
5975 | # Begin: Debug Output
5976 | # echo "TargetName: ${TargetName}"
5977 | # echo "MasterName: ${MasterName}"
5978 | # echo "RecoveryName: ${RecoveryName}"
5979 | # echo
5980 | # End: Debug Output
5981 | unset Overwrite
5982 | if [ -e "${MasterFolder}/${MasterName}" ] ; then
5983 | while [ -z "${Overwrite}" ] ; do
5984 | printf "An image named \033[1m${MasterName}\033[m already exists.\n"
5985 | read -sn 1 -p "Would you like to overwrite it (y/N)? " Overwrite < /dev/tty
5986 | echo
5987 | if [ -z "${Overwrite}" ] ; then Overwrite="n" ; fi
5988 | case "${Overwrite}" in
5989 | "Y" | "y" ) echo ; break ;;
5990 | "N" | "n" ) return 0 ;;
5991 | * ) unset Overwrite ;;
5992 | esac
5993 | done
5994 | fi
5995 | hdiutil eject "${Target}" -force &>/dev/null
5996 | while [ -e "${Target}" ] ; do
5997 | sleep 1
5998 | done
5999 | IFS=$'\n'
6000 | TargetVolumes=( `hdiutil attach -owners on -noverify "${LibraryFolder}/${TargetName}" -shadow | grep "/Volumes/" | awk -F "/Volumes/" '{print $NF}'` )
6001 | unset IFS
6002 | set_Target "${TargetVolumes[0]}"
6003 | fi
6004 | vsdbutil -a "${Target}"
6005 | set_Localization "${Language}"
6006 | set_AppleLanguages "${LanguageCode}"
6007 | printf "Creating: /Library/Preferences/.GlobalPreferences.plist\n"
6008 | if [ -e "${Target}/Library/Preferences/.GlobalPreferences.plist" ] ; then
6009 | rm -f "${Target}/Library/Preferences/.GlobalPreferences.plist"
6010 | fi
6011 | defaults write "${Target}/Library/Preferences/.GlobalPreferences" "AppleLanguages" -array "${AppleLanguages[@]}"
6012 | if [ ${TargetOSMinor} -gt 5 ] ; then
6013 | defaults write "${Target}/Library/Preferences/.GlobalPreferences" "AppleLocale" -string "${LanguageCode}_${SACountryCode}"
6014 | fi
6015 | defaults write "${Target}/Library/Preferences/.GlobalPreferences" "Country" -string "${SACountryCode}"
6016 | defaults write "${Target}/Library/Preferences/.GlobalPreferences" "com.apple.AppleModemSettingTool.LastCountryCode" -string "${TZCountryCode}"
6017 | if [ ${UseGeoKit} -eq 0 ] ; then
6018 | i=0 ; for Item in "${all_cities_adj_7[@]}" ; do
6019 | if [ "${Item}" == "${GeonameID}" ] ; then break ; fi
6020 | let i++
6021 | done
6022 | defaults write "${Target}/Library/Preferences/.GlobalPreferences" "com.apple.TimeZonePref.Last_Selected_City" -array "${all_cities_adj_0[i]}" "${all_cities_adj_1[i]}" "${all_cities_adj_2[i]}" "${all_cities_adj_3[i]}" "${all_cities_adj_4[i]}" "${all_cities_adj_5[i]}" "${all_cities_adj_6[i]}"
6023 | if [ -d "${TimeZonePrefPane}/Contents/Resources/${Localization}.lproj" ] ; then
6024 | IsPlist=`file "${TimeZonePrefPane}/Contents/Resources/${Localization}.lproj/Localizable_Cities.strings" | grep -vq "property list" ; echo ${?}`
6025 | if [ ${IsPlist} -eq 1 ] ; then
6026 | LocalizedCity=`/usr/libexec/PlistBuddy -c "Print ':${all_cities_adj_5[i]}'" "${TimeZonePrefPane}/Contents/Resources/${Localization}.lproj/Localizable_Cities.strings"`
6027 | LocalizedCountry=`/usr/libexec/PlistBuddy -c "Print ':${all_cities_adj_6[i]}'" "${TimeZonePrefPane}/Contents/Resources/${Localization}.lproj/Localizable_Countries.strings"`
6028 | else
6029 | LocalizedCity=`cat "${TimeZonePrefPane}/Contents/Resources/${Localization}.lproj/Localizable_Cities.strings" | iconv -f UTF-16 -t UTF-8 --unicode-subst="" | grep "\"${all_cities_adj_5[i]}\"" | awk -F "\"" '{print $4}'`
6030 | LocalizedCountry=`cat "${TimeZonePrefPane}/Contents/Resources/${Localization}.lproj/Localizable_Countries.strings" | iconv -f UTF-16 -t UTF-8 --unicode-subst="" | grep "\"${all_cities_adj_6[i]}\"" | awk -F "\"" '{print $4}'`
6031 | fi
6032 | else
6033 | LocalizedCity="${Localizable_Cities[i]}"
6034 | LocalizedCountry="${Localizable_Countries[i]}"
6035 | fi
6036 | defaults write "${Target}/Library/Preferences/.GlobalPreferences" "com.apple.TimeZonePref.Last_Selected_City" -array-add "${LocalizedCity}" "${LocalizedCountry}"
6037 | if [ ${TargetOSMinor} -gt 5 ] ; then
6038 | defaults write "${Target}/Library/Preferences/.GlobalPreferences" "com.apple.TimeZonePref.Last_Selected_City" -array-add "DEPRECATED IN 10.6"
6039 | fi
6040 | else
6041 | Query="select ZLATITUDE from ${PLACES} where ZGEONAMEID = ${GeonameID};"
6042 | ZLATITUDE=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6043 | Query="select ZREGIONALCODE from ${PLACES} where ZGEONAMEID = ${GeonameID};"
6044 | ZREGIONALCODE=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6045 | Query="select ZTIMEZONENAME from ${PLACES} where ZGEONAMEID = ${GeonameID};"
6046 | ZTIMEZONENAME=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6047 | Query="select ZPOPULATION from ${PLACES} where ZGEONAMEID = ${GeonameID};"
6048 | ZPOPULATION=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6049 | Query="select ZLONGITUDE from ${PLACES} where ZGEONAMEID = ${GeonameID};"
6050 | ZLONGITUDE=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6051 | Query="select ZCOUNTRY from ${PLACES} where ZGEONAMEID = ${GeonameID};"
6052 | ZCOUNTRY=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6053 | Query="select ZNAME from ${PLACES} where Z_PK = ${ZCOUNTRY};"
6054 | ZCOUNTRYNAME=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6055 | Query="select ZCODE from ${PLACES} where Z_PK = ${ZCOUNTRY};"
6056 | ZCODE=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6057 | Query="select ZNAME from ${PLACES} where ZGEONAMEID = ${GeonameID};"
6058 | ZNAME=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6059 | Query="select Z_PK from ${PLACES} where ZGEONAMEID = ${GeonameID};"
6060 | Z_PK=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6061 | Query="select ZNAME from ZGEOPLACENAME where ZAR <> 0 and ZPLACE = ${Z_PK};"
6062 | ZAR=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6063 | Query="select ZNAME from ZGEOPLACENAME where ZCA <> 0 and ZPLACE = ${Z_PK};"
6064 | ZCA=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6065 | Query="select ZNAME from ZGEOPLACENAME where ZCS <> 0 and ZPLACE = ${Z_PK};"
6066 | ZCS=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6067 | Query="select ZNAME from ZGEOPLACENAME where ZDA <> 0 and ZPLACE = ${Z_PK};"
6068 | ZDA=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6069 | Query="select ZNAME from ZGEOPLACENAME where ZDE <> 0 and ZPLACE = ${Z_PK};"
6070 | ZDE=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6071 | Query="select ZNAME from ZGEOPLACENAME where ZEL <> 0 and ZPLACE = ${Z_PK};"
6072 | ZEL=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6073 | Query="select ZNAME from ZGEOPLACENAME where ZEN <> 0 and ZPLACE = ${Z_PK};"
6074 | ZEN=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6075 | Query="select ZNAME from ZGEOPLACENAME where ZES <> 0 and ZPLACE = ${Z_PK};"
6076 | ZES=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6077 | Query="select ZNAME from ZGEOPLACENAME where ZFI <> 0 and ZPLACE = ${Z_PK};"
6078 | ZFI=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6079 | Query="select ZNAME from ZGEOPLACENAME where ZFR <> 0 and ZPLACE = ${Z_PK};"
6080 | ZFR=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6081 | Query="select ZNAME from ZGEOPLACENAME where ZHE <> 0 and ZPLACE = ${Z_PK};"
6082 | ZHE=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6083 | Query="select ZNAME from ZGEOPLACENAME where ZHR <> 0 and ZPLACE = ${Z_PK};"
6084 | ZHR=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6085 | Query="select ZNAME from ZGEOPLACENAME where ZHU <> 0 and ZPLACE = ${Z_PK};"
6086 | ZHU=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6087 | # Query="select ZNAME from ZGEOPLACENAME where ZID <> 0 and ZPLACE = ${Z_PK};"
6088 | # ZID=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6089 | Query="select ZNAME from ZGEOPLACENAME where ZIT <> 0 and ZPLACE = ${Z_PK};"
6090 | ZIT=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6091 | Query="select ZNAME from ZGEOPLACENAME where ZJA <> 0 and ZPLACE = ${Z_PK};"
6092 | ZJA=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6093 | Query="select ZNAME from ZGEOPLACENAME where ZKO <> 0 and ZPLACE = ${Z_PK};"
6094 | ZKO=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6095 | # Query="select ZNAME from ZGEOPLACENAME where ZMS <> 0 and ZPLACE = ${Z_PK};"
6096 | # ZMS=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6097 | Query="select ZNAME from ZGEOPLACENAME where ZNL <> 0 and ZPLACE = ${Z_PK};"
6098 | ZNL=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6099 | Query="select ZNAME from ZGEOPLACENAME where ZNO <> 0 and ZPLACE = ${Z_PK};"
6100 | ZNO=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6101 | Query="select ZNAME from ZGEOPLACENAME where ZPL <> 0 and ZPLACE = ${Z_PK};"
6102 | ZPL=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6103 | Query="select ZNAME from ZGEOPLACENAME where ZPT <> 0 and ZPLACE = ${Z_PK};"
6104 | ZPT=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6105 | Query="select ZNAME from ZGEOPLACENAME where ZPT_BR <> 0 and ZPLACE = ${Z_PK};"
6106 | ZPT_BR=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6107 | Query="select ZNAME from ZGEOPLACENAME where ZRO <> 0 and ZPLACE = ${Z_PK};"
6108 | ZRO=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6109 | Query="select ZNAME from ZGEOPLACENAME where ZRU <> 0 and ZPLACE = ${Z_PK};"
6110 | ZRU=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6111 | Query="select ZNAME from ZGEOPLACENAME where ZSK <> 0 and ZPLACE = ${Z_PK};"
6112 | ZSK=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6113 | Query="select ZNAME from ZGEOPLACENAME where ZSV <> 0 and ZPLACE = ${Z_PK};"
6114 | ZSV=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6115 | Query="select ZNAME from ZGEOPLACENAME where ZTH <> 0 and ZPLACE = ${Z_PK};"
6116 | ZTH=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6117 | Query="select ZNAME from ZGEOPLACENAME where ZTR <> 0 and ZPLACE = ${Z_PK};"
6118 | ZTR=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6119 | Query="select ZNAME from ZGEOPLACENAME where ZUK <> 0 and ZPLACE = ${Z_PK};"
6120 | ZUK=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6121 | # Query="select ZNAME from ZGEOPLACENAME where ZVI <> 0 and ZPLACE = ${Z_PK};"
6122 | # ZVI=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6123 | Query="select ZNAME from ZGEOPLACENAME where ZZH <> 0 and ZPLACE = ${Z_PK};"
6124 | ZZH=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6125 | Query="select ZNAME from ZGEOPLACENAME where ZZH_TW <> 0 and ZPLACE = ${Z_PK};"
6126 | ZZH_TW=`sqlite3 "${GeoKitFramework}" "${Query}" 2>/dev/null`
6127 | defaults write "${Target}/Library/Preferences/.GlobalPreferences" "com.apple.TimeZonePref.Last_Selected_City" -array "${ZLATITUDE}" "${ZLONGITUDE}" "0" "${ZTIMEZONENAME}" "${ZCODE}" "${ZNAME}" "${ZCOUNTRYNAME}" "${ZNAME}" "${ZCOUNTRYNAME}" "DEPRECATED IN 10.6"
6128 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city dict" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6129 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:CountryCode string ${ZCODE}" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6130 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:GeonameID integer ${GeonameID}" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6131 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:Latitude real ${ZLATITUDE}" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6132 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames dict" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6133 | case ${TargetOSMinor} in
6134 | 6 )
6135 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:da string ${ZDA}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6136 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:nl string ${ZNL}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6137 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ko string ${ZKO}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6138 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:zh-Hant string ${ZZH_TW}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6139 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ja string ${ZJA}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6140 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:pt-PT string ${ZPT}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6141 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:fr string ${ZFR}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6142 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:zh-Hans string ${ZZH}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6143 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:it string ${ZIT}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6144 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:fi string ${ZFI}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6145 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:sv string ${ZSV}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6146 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:pt string ${ZPT_BR}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6147 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:en string ${ZEN}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6148 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ru string ${ZRU}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6149 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:es string ${ZES}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6150 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:pl string ${ZPL}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6151 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:de string ${ZDE}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;;
6152 | 7 )
6153 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:da string ${ZDA}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6154 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:nl string ${ZNL}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6155 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ko string ${ZKO}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6156 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:zh-Hant string ${ZZH_TW}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6157 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ja string ${ZJA}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6158 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:pt-PT string ${ZPT}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6159 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:fr string ${ZFR}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6160 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:it string ${ZIT}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6161 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ru string ${ZRU}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6162 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:pt string ${ZPT_BR}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6163 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:fi string ${ZFI}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6164 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:zh-Hans string ${ZZH}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6165 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:sv string ${ZSV}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6166 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:en string ${ZEN}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6167 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:es string ${ZES}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6168 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:pl string ${ZPL}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6169 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:de string ${ZDE}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;;
6170 | 8 )
6171 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ro string ${ZRO}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6172 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:tr string ${ZTR}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6173 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:es string ${ZES}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6174 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:nb string ${ZNO}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6175 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ca string ${ZCA}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6176 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:el string ${ZEL}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6177 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:pt-PT string ${ZPT}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6178 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:fi string ${ZFI}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6179 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:nl string ${ZNL}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6180 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:fr string ${ZFR}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6181 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:sv string ${ZSV}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6182 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:hu string ${ZHU}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6183 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:cs string ${ZCS}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6184 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:he string ${ZHE}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6185 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:en string ${ZEN}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6186 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:da string ${ZDA}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6187 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:it string ${ZIT}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6188 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ja string ${ZJA}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6189 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:uk string ${ZUK}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6190 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:zh-Hans string ${ZZH}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6191 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ko string ${ZKO}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6192 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ar string ${ZAR}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6193 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:ru string ${ZRU}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6194 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:zh-Hant string ${ZZH_TW}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6195 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:th string ${ZTH}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6196 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:sk string ${ZSK}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6197 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:pt string ${ZPT_BR}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6198 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:hr string ${ZHR}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6199 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:pl string ${ZPL}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;
6200 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:LocalizedNames:de string ${ZDE}" "${Target}/Library/Preferences/.GlobalPreferences.plist" ;;
6201 | esac
6202 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:Longitude real ${ZLONGITUDE}" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6203 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:Name string ${ZNAME}" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6204 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:Population integer ${ZPOPULATION}" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6205 | if [ -n "${ZREGIONALCODE}" ] ; then
6206 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:RegionalCode string ${ZREGIONALCODE}" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6207 | fi
6208 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:TimeZoneName string ${ZTIMEZONENAME}" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6209 | /usr/libexec/PlistBuddy -c "Add :com.apple.preferences.timezone.selected_city:Version integer 1" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6210 | fi
6211 | chown 0:0 "${Target}/Library/Preferences/.GlobalPreferences.plist"
6212 | chmod 644 "${Target}/Library/Preferences/.GlobalPreferences.plist"
6213 | printf "Creating: /etc/localtime\n"
6214 | ln -fs "/usr/share/zoneinfo/${ZTIMEZONENAME}" "${Target}/etc/localtime"
6215 | # Begin: Debug Output
6216 | # /usr/libexec/PlistBuddy -c "Print" "${Target}/Library/Preferences/.GlobalPreferences.plist"
6217 | # printf "\n"
6218 | # End: Debug Output
6219 | printf "Creating: /Library/Preferences/com.apple.HIToolbox.plist\n"
6220 | if [ -e "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ] ; then
6221 | rm -f "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6222 | fi
6223 | if [ -n "${SATypingStyle}" ] ; then
6224 | set_Bundle_IDs "${SATypingStyle}"
6225 | set_Input_Modes "${SATypingStyle}"
6226 | set_InputSourceKinds "${SATypingStyle}"
6227 | set_KeyboardLayout_IDs "${SATypingStyle}"
6228 | set_KeyboardLayout_Names "${SATypingStyle}"
6229 | set_SelectedInputSource "${SATypingStyle}"
6230 | set_CurrentKeyboardLayoutInputSourceID "${SATypingStyle}"
6231 | else
6232 | unset Bundle_IDs[@]
6233 | unset Input_Modes[@]
6234 | set_InputSourceKinds "${SAKeyboard}"
6235 | set_KeyboardLayout_IDs "${SAKeyboard}"
6236 | set_KeyboardLayout_Names "${SAKeyboard}"
6237 | set_SelectedInputSource "${SAKeyboard}"
6238 | set_CurrentKeyboardLayoutInputSourceID "${SAKeyboard}"
6239 | fi
6240 | set_DefaultAsciiInputSource
6241 | if [ ${TargetOSMinor} -gt 5 ] ; then
6242 | defaults write "${Target}/Library/Preferences/com.apple.HIToolbox" "AppleCurrentKeyboardLayoutInputSourceID" -string "${CurrentKeyboardLayoutInputSourceID}"
6243 | fi
6244 | defaults write "${Target}/Library/Preferences/com.apple.HIToolbox" "AppleDefaultAsciiInputSource" -dict "InputSourceKind" -string "${InputSourceKind}" "KeyboardLayout ID" -int ${KeyboardLayout_ID} "KeyboardLayout Name" -string "${KeyboardLayout_Name}"
6245 | /usr/libexec/PlistBuddy -c "Add :AppleEnabledInputSources array" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6246 | i=0 ; while [ ${i} -lt ${#InputSourceKinds[@]} ] ; do
6247 | /usr/libexec/PlistBuddy -c "Add :AppleEnabledInputSources:${i} dict" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6248 | if [ -n "${Bundle_IDs[i]}" ] ; then /usr/libexec/PlistBuddy -c "Add :AppleEnabledInputSources:${i}:Bundle\ ID string ${Bundle_IDs[i]}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ; fi
6249 | if [ -n "${Input_Modes[i]}" ] ; then /usr/libexec/PlistBuddy -c "Add :AppleEnabledInputSources:${i}:Input\ Mode string ${Input_Modes[i]}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ; fi
6250 | if [ -n "${InputSourceKinds[i]}" ] ; then /usr/libexec/PlistBuddy -c "Add :AppleEnabledInputSources:${i}:InputSourceKind string ${InputSourceKinds[i]}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ; fi
6251 | if [ -n "${KeyboardLayout_IDs[i]}" ] ; then /usr/libexec/PlistBuddy -c "Add :AppleEnabledInputSources:${i}:KeyboardLayout\ ID integer ${KeyboardLayout_IDs[i]}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ; fi
6252 | if [ -n "${KeyboardLayout_Names[i]}" ] ; then /usr/libexec/PlistBuddy -c "Add :AppleEnabledInputSources:${i}:KeyboardLayout\ Name string ${KeyboardLayout_Names[i]}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ; fi
6253 | let i++
6254 | done
6255 | set_ScriptManager "${LanguageCode}"
6256 | if [ ${TargetOSMinor} -eq 5 ] ; then set_ITLB "${LanguageCode}" ; else unset ITLB ; fi
6257 | if [ -n "${ITLB}" ] ; then
6258 | /usr/libexec/PlistBuddy -c "Add :AppleItlbDate dict" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6259 | /usr/libexec/PlistBuddy -c "Add :AppleItlbDate:${ScriptManager} integer ${ITLB}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6260 | /usr/libexec/PlistBuddy -c "Add :AppleItlbNumber dict" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6261 | /usr/libexec/PlistBuddy -c "Add :AppleItlbNumber:${ScriptManager} integer ${ITLB}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6262 | fi
6263 | set_ResourceID "${LanguageCode}" "${SACountryCode}"
6264 | if [ -n "${ResourceID}" ] ; then
6265 | /usr/libexec/PlistBuddy -c "Add :AppleDateResID dict" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6266 | /usr/libexec/PlistBuddy -c "Add :AppleDateResID:${ScriptManager} integer ${ResourceID}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6267 | /usr/libexec/PlistBuddy -c "Add :AppleNumberResID dict" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6268 | /usr/libexec/PlistBuddy -c "Add :AppleNumberResID:${ScriptManager} integer ${ResourceID}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6269 | /usr/libexec/PlistBuddy -c "Add :AppleTimeResID dict" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6270 | /usr/libexec/PlistBuddy -c "Add :AppleTimeResID:${ScriptManager} integer ${ResourceID}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6271 | fi
6272 | /usr/libexec/PlistBuddy -c "Add :AppleSelectedInputSources array" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6273 | /usr/libexec/PlistBuddy -c "Add :AppleSelectedInputSources:0 dict" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6274 | if [ -n "${Bundle_IDs[SelectedInputSource]}" ] ; then /usr/libexec/PlistBuddy -c "Add :AppleSelectedInputSources:0:Bundle\ ID string ${Bundle_IDs[SelectedInputSource]}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ; fi
6275 | if [ -n "${Input_Modes[SelectedInputSource]}" ] ; then /usr/libexec/PlistBuddy -c "Add :AppleSelectedInputSources:0:Input\ Mode string ${Input_Modes[SelectedInputSource]}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ; fi
6276 | if [ -n "${InputSourceKinds[SelectedInputSource]}" ] ; then /usr/libexec/PlistBuddy -c "Add :AppleSelectedInputSources:0:InputSourceKind string ${InputSourceKinds[SelectedInputSource]}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ; fi
6277 | if [ -n "${KeyboardLayout_IDs[SelectedInputSource]}" ] ; then /usr/libexec/PlistBuddy -c "Add :AppleSelectedInputSources:0:KeyboardLayout\ ID integer ${KeyboardLayout_IDs[SelectedInputSource]}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ; fi
6278 | if [ -n "${KeyboardLayout_Names[SelectedInputSource]}" ] ; then /usr/libexec/PlistBuddy -c "Add :AppleSelectedInputSources:0:KeyboardLayout\ Name string ${KeyboardLayout_Names[SelectedInputSource]}" "${Target}/Library/Preferences/com.apple.HIToolbox.plist" ; fi
6279 | chown 0:0 "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6280 | chmod 644 "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6281 | # Begin: Debug Output
6282 | # /usr/libexec/PlistBuddy -c "Print" "${Target}/Library/Preferences/com.apple.HIToolbox.plist"
6283 | # printf "\n"
6284 | # End: Debug Output
6285 | if [ ${AllowGuestAccess} -eq 0 ] ; then
6286 | printf "Creating: /Library/Preferences/com.apple.AppleFileServer.plist\n"
6287 | defaults write "${Target}/Library/Preferences/com.apple.AppleFileServer" "guestAccess" -bool FALSE
6288 | chown 0:0 "${Target}/Library/Preferences/com.apple.AppleFileServer.plist"
6289 | chmod 644 "${Target}/Library/Preferences/com.apple.AppleFileServer.plist"
6290 | # Begin: Debug Output
6291 | # defaults read "${Target}/Library/Preferences/com.apple.AppleFileServer"
6292 | # printf "\n"
6293 | # End: Debug Output
6294 | printf "Creating: /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist\n"
6295 | defaults write "${Target}/Library/Preferences/SystemConfiguration/com.apple.smb.server" "AllowGuestAccess" -bool FALSE
6296 | chown 0:0 "${Target}/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist"
6297 | chmod 644 "${Target}/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist"
6298 | # Begin: Debug Output
6299 | # defaults read "${Target}/Library/Preferences/SystemConfiguration/com.apple.smb.server"
6300 | # printf "\n"
6301 | # End: Debug Output
6302 | fi
6303 | if [ ${ManagedUserPrinters} -eq 1 ] ; then
6304 | GeneratedUID=`dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly read /Local/Target/Groups/everyone GeneratedUID | awk '{print $NF}'`
6305 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Groups/_lpadmin NestedGroups "${GeneratedUID}"
6306 | fi
6307 | printf "Creating: /etc/ntp.conf\n"
6308 | printf "server ${NTPServer}\n" > "${Target}/etc/ntp.conf"
6309 | chown 0:0 "${Target}/etc/ntp.conf"
6310 | chmod 644 "${Target}/etc/ntp.conf"
6311 | # Begin: Debug Output
6312 | # cat "${Target}/etc/ntp.conf"
6313 | # printf "\n"
6314 | # End: Debug Output
6315 | printf "Creating: /var/db/.AppleSetupDone\n"
6316 | touch "${Target}/var/db/.AppleSetupDone"
6317 | chown 0:0 "${Target}/var/db/.AppleSetupDone"
6318 | chmod 600 "${Target}/var/db/.AppleSetupDone"
6319 | printf "Creating: /var/db/launchd.db/com.apple.launchd/overrides.plist\n"
6320 | if [ ! -e "${Target}/var/db/launchd.db/com.apple.launchd" ] ; then
6321 | mkdir -p "${Target}/var/db/launchd.db/com.apple.launchd"
6322 | fi
6323 | if [ ${NTPEnabled} -eq 1 ] ; then
6324 | defaults write "${Target}/var/db/launchd.db/com.apple.launchd/overrides" "org.ntp.ntpd" -dict "Disabled" -bool FALSE
6325 | else
6326 | defaults write "${Target}/var/db/launchd.db/com.apple.launchd/overrides" "org.ntp.ntpd" -dict "Disabled" -bool TRUE
6327 | fi
6328 | if [ ${RemoteLogin} -eq 1 ] ; then
6329 | defaults write "${Target}/var/db/launchd.db/com.apple.launchd/overrides" "com.openssh.sshd" -dict "Disabled" -bool FALSE
6330 | else
6331 | defaults write "${Target}/var/db/launchd.db/com.apple.launchd/overrides" "com.openssh.sshd" -dict "Disabled" -bool TRUE
6332 | fi
6333 | chown 0:0 "${Target}/var/db/launchd.db/com.apple.launchd/overrides.plist"
6334 | chmod 600 "${Target}/var/db/launchd.db/com.apple.launchd/overrides.plist"
6335 | # Begin: Debug Output
6336 | # /usr/libexec/PlistBuddy -c "Print" "${Target}/var/db/launchd.db/com.apple.launchd/overrides.plist"
6337 | # printf "\n"
6338 | # End: Debug Output
6339 | printf "Creating: /var/log/CDIS.custom\n"
6340 | printf "LANGUAGE=${Localization}\n" > "${Target}/var/log/CDIS.custom"
6341 | chown 0:0 "${Target}/var/log/CDIS.custom"
6342 | chmod 644 "${Target}/var/log/CDIS.custom"
6343 | # Begin: Debug Output
6344 | # cat "${Target}/var/log/CDIS.custom"
6345 | # printf "\n"
6346 | # End: Debug Output
6347 | printf "Creating: /Library/LaunchDaemons/FirstBoot.plist\n"
6348 | defaults write "${Target}/Library/LaunchDaemons/FirstBoot" "Label" -string "FirstBoot"
6349 | defaults write "${Target}/Library/LaunchDaemons/FirstBoot" "ProgramArguments" -array "${FirstBootPath}/FirstBoot.sh"
6350 | defaults write "${Target}/Library/LaunchDaemons/FirstBoot" "RunAtLoad" -bool TRUE
6351 | chown 0:0 "${Target}/Library/LaunchDaemons/FirstBoot.plist"
6352 | chmod 644 "${Target}/Library/LaunchDaemons/FirstBoot.plist"
6353 | # Begin: Debug Output
6354 | # /usr/libexec/PlistBuddy -c "Print" "${Target}/Library/LaunchDaemons/FirstBoot.plist"
6355 | # printf "\n"
6356 | # End: Debug Output
6357 | printf "Creating: ${FirstBootPath}/FirstBoot.sh\n"
6358 | mkdir -p "${Target}/${FirstBootPath}/Actions"
6359 | mkdir -p "${Target}/${FirstBootPath}/Packages"
6360 | printf \#\!"/bin/sh\n" > "${Target}/${FirstBootPath}/FirstBoot.sh"
6361 | echo "ScriptPath=\`dirname \"\${0}\"\`" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6362 | echo "IFS=\$'\\\n'" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6363 | echo "Actions=( \`ls \"\${ScriptPath}/Actions\" 2>/dev/null\` )" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6364 | echo "Packages=( \`ls \"\${ScriptPath}/Packages\" 2>/dev/null\` )" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6365 | echo "unset IFS" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6366 | echo "for Action in \"\${Actions[@]}\" ; do" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6367 | echo " \"\${ScriptPath}/Actions/\${Action}\"" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6368 | echo "done" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6369 | echo "Minor=\`sw_vers -productVersion | awk -F \".\" '{print \$2}'\`" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6370 | echo "Point=\`sw_vers -productVersion | awk -F \".\" '{print \$3}'\`" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6371 | echo "if [ \${Minor} -eq 7 -a \${Point} -gt 3 ] || [ \${Minor} -gt 7 ] ; then GateKeeper=\"-allowUntrusted\" ; fi" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6372 | echo "for Package in \"\${Packages[@]}\" ; do" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6373 | echo " installer -dumplog \"\${GateKeeper}\" -pkg \"\${ScriptPath}/Packages/\${Package}\" -target / 2>/dev/null" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6374 | echo "done" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6375 | echo "srm \"/Library/LaunchDaemons/FirstBoot.plist\"" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6376 | echo "srm -rf \"\${ScriptPath}\"" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6377 | echo "exit 0" >> "${Target}/${FirstBootPath}/FirstBoot.sh"
6378 | chown 0:0 "${Target}/${FirstBootPath}/FirstBoot.sh"
6379 | chmod 755 "${Target}/${FirstBootPath}/FirstBoot.sh"
6380 | # Begin: Debug Output
6381 | # cat "${Target}/${FirstBootPath}/FirstBoot.sh"
6382 | # printf "\n"
6383 | # End: Debug Output
6384 | if [ -n "${ComputerName}" ] ; then
6385 | printf "Creating: ${FirstBootPath}/Actions/ComputerName.sh\n"
6386 | printf \#\!"/bin/sh\n" > "${Target}/${FirstBootPath}/Actions/ComputerName.sh"
6387 | case "${ComputerName}" in
6388 | "Model and MAC Address" )
6389 | echo "ModelName=\`system_profiler | grep \"Model Name: \" | awk -F \": \" '{print \$NF}'\`" >> "${Target}/${FirstBootPath}/Actions/ComputerName.sh" ;
6390 | echo "MACAddress=\`ifconfig en0 | grep \"ether\" | awk '{print \$NF}' | sed \"s/://g\"\`" >> "${Target}/${FirstBootPath}/Actions/ComputerName.sh" ;
6391 | echo "ComputerName=\"\${ModelName} \${MACAddress}\"" >> "${Target}/${FirstBootPath}/Actions/ComputerName.sh" ;;
6392 | "Generic using MAC Address" )
6393 | echo "MACAddress=\`ifconfig en0 | grep \"ether\" | awk '{print \$NF}' | sed \"s/://g\"\`" >> "${Target}/${FirstBootPath}/Actions/ComputerName.sh" ;
6394 | echo "ComputerName=\"Mac \${MACAddress}\"" >> "${Target}/${FirstBootPath}/Actions/ComputerName.sh" ;;
6395 | "Serial Number" )
6396 | echo "ComputerName=\`system_profiler | grep \"Serial Number (system): \" | awk -F \": \" '{print \$NF}'\`" >> "${Target}/${FirstBootPath}/Actions/ComputerName.sh" ;;
6397 | esac
6398 | echo "LocalHostName=\"\${ComputerName// /-}\"" >> "${Target}/${FirstBootPath}/Actions/ComputerName.sh"
6399 | echo "scutil --set ComputerName \"\${ComputerName}\"" >> "${Target}/${FirstBootPath}/Actions/ComputerName.sh"
6400 | echo "scutil --set LocalHostName \"\${LocalHostName}\"" >> "${Target}/${FirstBootPath}/Actions/ComputerName.sh"
6401 | echo "exit 0" >> "${Target}/${FirstBootPath}/Actions/ComputerName.sh"
6402 | chown 0:0 "${Target}/${FirstBootPath}/Actions/ComputerName.sh"
6403 | chmod 755 "${Target}/${FirstBootPath}/Actions/ComputerName.sh"
6404 | fi
6405 | # Begin: Debug Output
6406 | # cat "${Target}/${FirstBootPath}/Actions/ComputerName.sh"
6407 | # printf "\n"
6408 | # End: Debug Output
6409 | if [ ${TargetOSMinor} -ge 6 ] ; then
6410 | if [ ${TZAuto} -eq 1 ] ;then
6411 | printf "Creating: /Library/Preferences/com.apple.timezone.auto.plist\n"
6412 | defaults write "${Target}/Library/Preferences/com.apple.timezone.auto" "Active" -bool TRUE
6413 | chown 0:0 "${Target}/Library/Preferences/com.apple.timezone.auto.plist"
6414 | chmod 644 "${Target}/Library/Preferences/com.apple.timezone.auto.plist"
6415 | if [ ${TargetOSMinor} -ge 8 ] ; then
6416 | printf "Creating: ${FirstBootPath}/Actions/LocationServices.sh\n"
6417 | printf \#\!"/bin/sh\n" > "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6418 | echo "if [ \`ioreg -rd1 -c IOPlatformExpertDevice | grep -i \"UUID\" | cut -c27-50\` == \"00000000-0000-1000-8000-\" ] ; then" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6419 | echo " UUID=\`ioreg -rd1 -c IOPlatformExpertDevice | grep -i \"UUID\" | cut -c51-62 | awk {'print tolower()'}\`" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6420 | echo "else" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6421 | echo " UUID=\`ioreg -rd1 -c IOPlatformExpertDevice | grep -i \"UUID\" | cut -c27-62\`" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6422 | echo "fi" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6423 | echo "mkdir -p \"/private/var/db/locationd/Library/Preferences/ByHost\"" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6424 | echo "defaults write \"/private/var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.\${UUID}\" \"ObsoleteDataDeleted\" -bool TRUE" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6425 | echo "defaults write \"/private/var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.\${UUID}\" \"LocationServicesEnabled\" -int 1" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6426 | echo "defaults write \"/private/var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.notbackedup.\${UUID}\" \"LocationServicesEnabled\" -int 1" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6427 | echo "chown -Rh 205:205 \"/private/var/db/locationd/Library/Preferences/ByHost\"" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6428 | echo "exit 0" >> "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6429 | chown 0:0 "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6430 | chmod 755 "${Target}/${FirstBootPath}/Actions/LocationServices.sh"
6431 | # Begin: Debug Output
6432 | # cat "${Target}/usr/libexec/FirstBoot/Actions/LocationServices.sh"
6433 | # printf "\n"
6434 | # End: Debug Output
6435 | fi
6436 | fi
6437 | fi
6438 | if [ ${RemoteManagement} -eq 1 ] ; then
6439 | printf "Creating: /Library/Preferences/com.apple.RemoteManagement.plist\n"
6440 | defaults write "${Target}/Library/Preferences/com.apple.RemoteManagement" "ARD_AllLocalUsersPrivs" -int 1073742079
6441 | defaults write "${Target}/Library/Preferences/com.apple.RemoteManagement" "ARD_AllLocalUsers" -bool TRUE
6442 | chown 0:0 "${Target}/Library/Preferences/com.apple.RemoteManagement.plist"
6443 | chmod 644 "${Target}/Library/Preferences/com.apple.RemoteManagement.plist"
6444 | # Begin: Debug Output
6445 | # /usr/libexec/PlistBuddy -c "Print" "${Target}/Library/Preferences/com.apple.RemoteManagement.plist"
6446 | # printf "\n"
6447 | # End: Debug Output
6448 | printf "Creating: /etc/RemoteManagement.launchd\n"
6449 | printf "enabled" > "${Target}/etc/RemoteManagement.launchd"
6450 | chown 0:0 "${Target}/etc/RemoteManagement.launchd"
6451 | chmod 644 "${Target}/etc/RemoteManagement.launchd"
6452 | # Begin: Debug Output
6453 | # cat "${Target}/etc/RemoteManagement.launchd" ; printf "\n"
6454 | # printf "\n"
6455 | # End: Debug Output
6456 | printf "Creating: ${FirstBootPath}/Actions/RemoteManagement.sh\n"
6457 | printf \#\!"/bin/sh\n" > "${Target}/${FirstBootPath}/Actions/RemoteManagement.sh"
6458 | echo "/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all" >> "${Target}/${FirstBootPath}/Actions/RemoteManagement.sh"
6459 | echo "exit 0" >> "${Target}/${FirstBootPath}/Actions/RemoteManagement.sh"
6460 | chown 0:0 "${Target}/${FirstBootPath}/Actions/RemoteManagement.sh"
6461 | chmod 755 "${Target}/${FirstBootPath}/Actions/RemoteManagement.sh"
6462 | # Begin: Debug Output
6463 | # cat "${Target}/usr/libexec/FirstBoot/Actions/RemoteManagement.sh"
6464 | # printf "\n"
6465 | # End: Debug Output
6466 | fi
6467 | # Advanced System Settings, to be implemented
6468 | if [ ${AdminHostInfo} -eq 1 ] ; then
6469 | defaults write "${Target}/Library/Preferences/com.apple.loginwindow" "AdminHostInfo" -string "HostName"
6470 | fi
6471 | if [ ${ShowFullName} -eq 1 ] ; then
6472 | defaults write "${Target}/Library/Preferences/com.apple.loginwindow" "SHOWFULLNAME" -bool TRUE
6473 | fi
6474 | if [ -e "${Target}/Library/Preferences/com.apple.loginwindow.plist" ] ; then
6475 | chown 0:0 "${Target}/Library/Preferences/com.apple.loginwindow.plist"
6476 | chmod 644 "${Target}/Library/Preferences/com.apple.loginwindow.plist"
6477 | fi
6478 | # Begin: Debug Output
6479 | # defaults read "${Target}/Library/Preferences/com.apple.loginwindow"
6480 | # printf "\n"
6481 | # End: Debug Output
6482 | if [ ${SoftwareUpdateCheck} -eq 0 ] ; then
6483 | printf "Creating: ${FirstBootPath}/Actions/SoftwareUpdateCheck.sh\n"
6484 | printf \#\!"/bin/sh\n" > "${Target}/${FirstBootPath}/Actions/SoftwareUpdateCheck.sh"
6485 | echo "softwareupdate --schedule off" >> "${Target}/${FirstBootPath}/Actions/SoftwareUpdateCheck.sh"
6486 | echo "exit 0" >> "${Target}/${FirstBootPath}/Actions/SoftwareUpdateCheck.sh"
6487 | chown 0:0 "${Target}/${FirstBootPath}/Actions/SoftwareUpdateCheck.sh"
6488 | chmod 755 "${Target}/${FirstBootPath}/Actions/SoftwareUpdateCheck.sh"
6489 | # Begin: Debug Output
6490 | # cat "${Target}/usr/libexec/FirstBoot/Actions/SoftwareUpdateCheck.sh"
6491 | # printf "\n"
6492 | # End: Debug Output
6493 | fi
6494 | printf "\n"
6495 | i=0 ; for RecordName in "${RecordNames[@]}" ; do
6496 | printf "Creating User: ${RecordName}\n"
6497 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -create /Local/Target/Users/"${RecordName}"
6498 | printf " Setting Full Name"
6499 | # Begin: Debug Output
6500 | printf ": ${RealNames[i]}"
6501 | # End: Debug Output
6502 | printf "\n"
6503 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" RealName "${RealNames[i]}"
6504 | printf " Setting Password"
6505 | if [ ${TargetOSMinor} -le 6 ] ; then
6506 | GeneratedUID=`dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Users/"${RecordName}" GeneratedUID | awk '{print $2}'`
6507 | if [ ! -e "${Target}/var/db/shadow/hash" ] ; then
6508 | mkdir -p "${Target}/var/db/shadow/hash"
6509 | chmod -R 0700 "${Target}/var/db/shadow"
6510 | fi
6511 | if [ -n "${GeneratedUID}" ] && [ -e "/var/db/shadow/hash/${GeneratedUID}" ] ; then
6512 | mv "/var/db/shadow/hash/${GeneratedUID}" "${Target}/var/db/shadow/hash/" &>/dev/null
6513 | fi
6514 | fi
6515 | # Begin: Debug Output
6516 | printf ": "
6517 | if [ -n "${Passwords[i]}" ] ; then
6518 | j=0 ; while [ ${j} -lt ${#Passwords[i]} ] ; do printf "*" ; let j++ ; done
6519 | else
6520 | printf "-"
6521 | fi
6522 | # End: Debug Output
6523 | printf "\n"
6524 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -passwd /Local/Target/Users/"${RecordName}" "${Passwords[i]}"
6525 | printf " Setting Password Hint"
6526 | # Begin: Debug Output
6527 | printf ": " ; if [ -n "${AuthenticationHints[i]}" ] ; then printf "${AuthenticationHints[i]}" ; else printf "-" ; fi
6528 | # End: Debug Output
6529 | printf "\n"
6530 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" AuthenticationHint "${AuthenticationHints[i]}"
6531 | printf " Setting User ID"
6532 | # Begin: Debug Output
6533 | printf ": ${UniqueIDs[i]}"
6534 | # End: Debug Output
6535 | printf "\n"
6536 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" UniqueID ${UniqueIDs[i]}
6537 | if [ ${UniqueIDs[i]} -lt 501 ] ; then
6538 | defaults write "${Target}/Library/Preferences/com.apple.loginwindow" Hide500Users -bool TRUE
6539 | defaults write "${Target}/Library/Preferences/com.apple.loginwindow" HiddenUsersList -array-add "${RecordName}"
6540 | chmod 0644 "${Target}/Library/Preferences/com.apple.loginwindow.plist"
6541 | fi
6542 | printf " Setting Group ID"
6543 | # Begin: Debug Output
6544 | printf ": 20"
6545 | # End: Debug Output
6546 | printf "\n"
6547 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" PrimaryGroupID 20
6548 | printf " Setting Login Shell"
6549 | # Begin: Debug Output
6550 | printf ": ${UserShells[i]}"
6551 | # End: Debug Output
6552 | printf "\n"
6553 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" UserShell "${UserShells[i]}"
6554 | printf " Setting Home Directory"
6555 | # Begin: Debug Output
6556 | printf ": ${NFSHomeDirectories[i]}"
6557 | # End: Debug Output
6558 | printf "\n"
6559 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Users/"${RecordName}" NFSHomeDirectory "${NFSHomeDirectories[i]}"
6560 | ditto "${Target}/System/Library/User Template/Non_localized" "${Target}/${NFSHomeDirectories[i]}"
6561 | ditto "${Target}/System/Library/User Template/${Localization}.lproj" "${Target}/${NFSHomeDirectories[i]}"
6562 | defaults write "${Target}/${NFSHomeDirectories[i]}/Library/Preferences/.GlobalPreferences" AppleMiniaturizeOnDoubleClick -bool FALSE
6563 | defaults write "${Target}/${NFSHomeDirectories[i]}/Library/Preferences/.GlobalPreferences" AppleScrollAnimationEnabled -bool TRUE
6564 | # Begin: User Preferences
6565 | if [ ${UserSettings} -eq 1 ] ; then
6566 | if [ ${TargetOSMinor} -ge 7 ] ; then
6567 | defaults write "${Target}/${NFSHomeDirectories[i]}/Library/Preferences/.GlobalPreferences" "AppleShowScrollBars" -string "${AppleShowScrollBars}"
6568 | defaults write "${Target}/${NFSHomeDirectories[i]}/Library/Preferences/com.apple.finder" "WindowState" -dict "ShowStatusBar" -bool ${ShowStatusBar}
6569 | defaults write "${Target}/${NFSHomeDirectories[i]}/Library/Preferences/com.apple.finder" "NewWindowTarget" -string "${NewWindowTarget}"
6570 | defaults write "${Target}/${NFSHomeDirectories[i]}/Library/Preferences/com.apple.SetupAssistant" "GestureMovieSeen" -string "${GestureMovieSeen}"
6571 | if [ ${SuppressCloudSetup} -eq 1 ] ; then
6572 | defaults write "${Target}/${NFSHomeDirectories[i]}/Library/Preferences/com.apple.SetupAssistant" "DidSeeCloudSetup" -bool TRUE
6573 | defaults write "${Target}/${NFSHomeDirectories[i]}/Library/Preferences/com.apple.SetupAssistant" "LastSeenCloudProductVersion" -string "10.${TargetOSMinor}"
6574 | fi
6575 | fi
6576 | fi
6577 | # End: User Preferences
6578 | chown -Rh ${UniqueID}:staff "${Target}/${NFSHomeDirectories[i]}"
6579 | if [ ${TargetOSMinor} -eq 5 ] || [ "${AccountTypes[i]}" == "Administrator" ] ; then
6580 | printf " Adding to Group(s)"
6581 | # Begin: Debug Output
6582 | printf ": "
6583 | # End: Debug Output
6584 | fi
6585 | if [ ${TargetOSMinor} -eq 5 ] ; then
6586 | # Begin: Debug Output
6587 | printf "staff\n"
6588 | printf " "
6589 | # End: Debug Output
6590 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Groups/staff GroupMembership "${RecordName}"
6591 | fi
6592 | if [ "${AccountTypes[i]}" == "Administrator" ] ; then
6593 | # Begin: Debug Output
6594 | printf "admin\n"
6595 | # End: Debug Output
6596 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Groups/admin GroupMembership "${RecordName}"
6597 | # Begin: Debug Output
6598 | printf " _lpadmin\n"
6599 | # End: Debug Output
6600 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Groups/_lpadmin GroupMembership "${RecordName}"
6601 | # Begin: Debug Output
6602 | printf " _appserverusr\n"
6603 | # End: Debug Output
6604 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Groups/_appserverusr GroupMembership "${RecordName}"
6605 | # Begin: Debug Output
6606 | printf " _appserveradm\n"
6607 | # End: Debug Output
6608 | dscl -f "${Target}/var/db/dslocal/nodes/Default" localonly -append /Local/Target/Groups/_appserveradm GroupMembership "${RecordName}"
6609 | fi
6610 | printf "\n"
6611 | let i++
6612 | done
6613 | if [ ${#Packages[@]} -gt 0 ] ; then
6614 | printf "Installing Packages\n"
6615 | for Package in "${Packages[@]}" ; do
6616 | find "${PackageFolder}" -name "${Package}" -a \! -path "*pkg/*" | while read PackagePath ; do
6617 | IFS=$'\n'
6618 | AvailableTargets=( `installer -volinfo -pkg "${PackagePath}" | grep "/Volumes/"` )
6619 | unset IFS
6620 | PostponedInstall=1
6621 | for AvailableTarget in "${AvailableTargets[@]}" ; do
6622 | if [ "${AvailableTarget}" == "${Target}" ] ; then PostponedInstall=0 ; break ; fi
6623 | done
6624 | if [ ${PostponedInstall} -eq 0 ] ; then
6625 | install_Package "${PackagePath}" "${Target}" 0
6626 | else
6627 | IFS=$'\n'
6628 | PackageTitles=( `installer -pkginfo -pkg "${PackagePath}"` )
6629 | unset IFS
6630 | printf "installer: Package name is ${PackageTitles[0]}\n"
6631 | printf "installer: Target volume unavailable, will attempt postponed install.\n"
6632 | if [ ! -e "${Target}/${FirstBootPath}/Packages/${Package}" ] ; then
6633 | ditto "${PackagePath}" "${Target}/${FirstBootPath}/Packages/${Package}"
6634 | else
6635 | printf "installer: Duplicate package, skipping.\n"
6636 | fi
6637 | fi
6638 | done
6639 | done
6640 | printf "\n"
6641 | fi
6642 | if [ ${#RemovableItems[@]} -gt 0 ] ; then
6643 | for Item in "${RemovableItems[@]}" ; do
6644 | unset bundleID
6645 | case "${Item}" in
6646 | "iPhoto" )
6647 | Removables=(
6648 | "Applications/iPhoto.app"
6649 | "Library/Application Support/iLife"
6650 | "Library/Application Support/iPhoto"
6651 | "Library/Application Support/NetServices"
6652 | "Library/Frameworks/iLifeKit.framework"
6653 | "Library/Frameworks/iLifePageLayout.framework"
6654 | "Library/Frameworks/iLifeSQLAccess.framework"
6655 | "Library/Internet Plug-Ins/iPhotoPhotocast.plugin"
6656 | "Library/Receipts/iPhoto.pkg"
6657 | "Library/Receipts/iPhotoContent.pkg"
6658 | "var/db/receipts/com.apple.pkg.iPhoto_AppStore.bom"
6659 | "var/db/receipts/com.apple.pkg.iPhoto_AppStore.plist"
6660 | "var/db/receipts/com.apple.pkg.iPhoto.bom"
6661 | "var/db/receipts/com.apple.pkg.iPhoto.plist"
6662 | "var/db/receipts/com.apple.pkg.iPhotoContent.bom"
6663 | "var/db/receipts/com.apple.pkg.iPhotoContent.plist"
6664 | "var/db/receipts/com.apple.pkg.iPhotoLibraryUpgradeTool.bom"
6665 | "var/db/receipts/com.apple.pkg.iPhotoLibraryUpgradeTool.plist"
6666 | ) ;
6667 | bundleID="com.apple.iPhoto" ;
6668 | if [ -e "${Target}/Applications/iPhoto.app" ] ; then echo "Removing: iPhoto" ; else break ; fi ;;
6669 | "iMovie" )
6670 | Removables=(
6671 | "Applications/iMovie.app"
6672 | "Library/Receipts/iMovie.pkg"
6673 | "var/db/receipts/com.apple.pkg.iMovie_AppStore.bom"
6674 | "var/db/receipts/com.apple.pkg.iMovie_AppStore.plist"
6675 | "var/db/receipts/com.apple.pkg.iMovie.bom"
6676 | "var/db/receipts/com.apple.pkg.iMovie.plist"
6677 | ) ;
6678 | bundleID="com.apple.iMovieApp" ;
6679 | if [ -e "${Target}/Applications/iMovie.app" ] ; then echo "Removing: iMovie" ; else break ; fi ;;
6680 | "iDVD" )
6681 | Removables=(
6682 | "Applications/iDVD.app"
6683 | "Library/Application Support/iDVD"
6684 | "Library/Application Support/iDVD/Themes"
6685 | "Library/Documentation/Applications/iDVD"
6686 | "Library/Receipts/iDVD.pkg"
6687 | "Library/Receipts/iDVDExtraContent.pkg"
6688 | "Library/Receipts/iDVDThemes.pkg"
6689 | "var/db/receipts/com.apple.pkg.iDVD.bom"
6690 | "var/db/receipts/com.apple.pkg.iDVD.plist"
6691 | "var/db/receipts/com.apple.pkg.iDVDExtraContent.bom"
6692 | "var/db/receipts/com.apple.pkg.iDVDExtraContent.plist"
6693 | "var/db/receipts/com.apple.pkg.iDVDThemes.bom"
6694 | "var/db/receipts/com.apple.pkg.iDVDThemes.plist"
6695 | ) ;
6696 | if [ -e "${Target}/Applications/iDVD.app" ] ; then echo "Removing: iDVD" ; else break ; fi ;;
6697 | "GarageBand" )
6698 | Removables=(
6699 | "Applications/GarageBand.app"
6700 | "Library/Application Support/GarageBand"
6701 | "Library/Application Support/GarageBand/Instrument Library"
6702 | "Library/Application Support/GarageBand/Learn to Play"
6703 | "Library/Application Support/GarageBand/Magic GarageBand"
6704 | "Library/Application Support/GarageBand/Templates"
6705 | "Library/Audio/Apple Loops"
6706 | "Library/Audio/Apple Loops Index"
6707 | "Library/Audio/Apple Loops/Apple/Apple Loops for GarageBand"
6708 | "Library/Audio/MIDI Drivers/EmagicUSBMIDIDriver.plugin"
6709 | "Library/QuickLook/GBQLGenerator.qlgenerator"
6710 | "Library/Receipts/GarageBand_Instruments.pkg"
6711 | "Library/Receipts/GarageBand_Loops.pkg"
6712 | "Library/Receipts/GarageBand_LTPContent.pkg"
6713 | "Library/Receipts/GarageBand_MagicContent.pkg"
6714 | "Library/Receipts/GarageBand.pkg"
6715 | "Library/Receipts/GarageBandExtraContent.pkg"
6716 | "Library/Receipts/GarageBandFactoryContent.pkg"
6717 | "Library/Spotlight/GBSpotlightImporter.mdimporter"
6718 | "Library/Spotlight/LogicPro.mdimporter"
6719 | "var/db/receipts/com.apple.pkg.GarageBand_AppStore.bom"
6720 | "var/db/receipts/com.apple.pkg.GarageBand_AppStore.plist"
6721 | "var/db/receipts/com.apple.pkg.GarageBand_Instruments.bom"
6722 | "var/db/receipts/com.apple.pkg.GarageBand_Instruments.plist"
6723 | "var/db/receipts/com.apple.pkg.GarageBand_Loops.bom"
6724 | "var/db/receipts/com.apple.pkg.GarageBand_Loops.plist"
6725 | "var/db/receipts/com.apple.pkg.GarageBand_LTPContent.bom"
6726 | "var/db/receipts/com.apple.pkg.GarageBand_LTPContent.plist"
6727 | "var/db/receipts/com.apple.pkg.GarageBand_MagicContent.bom"
6728 | "var/db/receipts/com.apple.pkg.GarageBand_MagicContent.plist"
6729 | "var/db/receipts/com.apple.pkg.GarageBand.bom"
6730 | "var/db/receipts/com.apple.pkg.GarageBand.plist"
6731 | "var/db/receipts/com.apple.pkg.GarageBandBasicContent.bom"
6732 | "var/db/receipts/com.apple.pkg.GarageBandBasicContent.plist"
6733 | "var/db/receipts/com.apple.pkg.GarageBandExtraContent.bom"
6734 | "var/db/receipts/com.apple.pkg.GarageBandExtraContent.plist"
6735 | "var/db/receipts/com.apple.pkg.GarageBandFactoryContent.bom"
6736 | "var/db/receipts/com.apple.pkg.GarageBandFactoryContent.plist"
6737 | ) ;
6738 | bundleID="com.apple.garageband" ;
6739 | if [ -e "${Target}/Applications/GarageBand.app" ] ; then echo "Removing: GarageBand" ; else break ; fi ;;
6740 | "Sounds & Jingles" )
6741 | Removables=(
6742 | "Library/Audio/Apple Loops/Apple/iLife Sound Effects"
6743 | "Library/Receipts/iLifeSoundEffects_Loops.pkg"
6744 | "var/db/receipts/com.apple.pkg.iLifeSoundEffects_Loops.bom"
6745 | "var/db/receipts/com.apple.pkg.iLifeSoundEffects_Loops.plist"
6746 | ) ;
6747 | if [ -e "${Target}/Library/Receipts/iLifeSoundEffects_Loops.pkg" ] || [ -e "${Target}/var/db/receipts/com.apple.pkg.iLifeSoundEffects_Loops.bom" ] ; then echo "Removing: Sounds & Jingles" ; else break ; fi ;;
6748 | "iWeb" )
6749 | Removables=(
6750 | "Applications/iWeb.app"
6751 | "Library/Fonts/AppleCasual.dfont"
6752 | "Library/Fonts/BlairMdITC TT-Medium"
6753 | "Library/Fonts/Bordeaux Roman Bold LET Fonts"
6754 | "Library/Fonts/Cracked"
6755 | "Library/Fonts/Handwriting - Dakota"
6756 | "Library/Fonts/Palatino"
6757 | "Library/Fonts/PortagoITC TT"
6758 | "Library/Receipts/iWeb.pkg"
6759 | "var/db/receipts/com.apple.pkg.iWeb.bom"
6760 | "var/db/receipts/com.apple.pkg.iWeb.plist"
6761 | ) ;
6762 | if [ -e "${Target}/Applications/iWeb.app" ] ; then echo "Removing: iWeb" ; else break ; fi ;;
6763 | esac
6764 | for Removable in "${Removables[@]}" ; do
6765 | if [ -e "${Target}/${Removable}" ] ; then
6766 | echo " /${Removable}"
6767 | rm -rf "${Target}/${Removable}"
6768 | fi
6769 | done
6770 | if [ -n "${bundleID}" ] ; then
6771 | i=0 ; while : ; do
6772 | MASbundleID=`/usr/libexec/PlistBuddy -c "Print :${i}:bundleID" "${Target}/var/db/.MASManifest" 2>/dev/null`
6773 | if [ ${?} -ne 0 ] ; then break ; fi
6774 | if echo "${MASbundleID}" | grep -q "${bundleID}" ; then
6775 | /usr/libexec/PlistBuddy -c "Delete :${i}" "${Target}/var/db/.MASManifest"
6776 | break
6777 | fi
6778 | let i++
6779 | done
6780 | fi
6781 | done
6782 | if [ -e "${Target}/Library/Receipts/iLifeCookie.pkg" ] || [ -e "${Target}/var/db/receipts/com.apple.pkg.iLifeCookie.bom" ] ; then
6783 | if [ ! -e "${Target}/Applications/iPhoto.app" ] && [ ! -e "${Target}/Applications/iMovie.app" ] && [ ! -e "${Target}/Applications/iDVD.app" ] && [ ! -e "${Target}/Applications/GarageBand.app" ] && [ ! -e "${Target}/Library/Receipts/iLifeSoundEffects_Loops.pkg" ] && [ ! -e "${Target}/var/db/receipts/com.apple.pkg.iLifeSoundEffects_Loops.bom" ] && [ ! -e "${Target}/Applications/iWeb.app" ] ; then
6784 | Removables=(
6785 | "Library/Application Support/iLifeSlideshow"
6786 | "Library/Documentation/Applications/iMovie"
6787 | "Library/Documentation/Applications/iPhoto"
6788 | "Library/Documentation/Applications/iWeb"
6789 | "Library/Frameworks/iLifeFaceRecognition.framework"
6790 | "Library/Frameworks/iLifeSlideshow.framework"
6791 | "Library/Receipts/iLifeCookie.pkg"
6792 | "Library/Receipts/iLifeSlideshow.pkg"
6793 | "System/Library/CoreServices/CoreTypes.bundle/Contents/Library/iLifeSlideshowTypes.bundle"
6794 | "System/Library/PrivateFrameworks/iLifeSlideshow.framework"
6795 | "var/db/receipts/com.apple.pkg.iLifeCookie.bom"
6796 | "var/db/receipts/com.apple.pkg.iLifeCookie.plist"
6797 | "var/db/receipts/com.apple.pkg.iLifeFaceRecognition.bom"
6798 | "var/db/receipts/com.apple.pkg.iLifeFaceRecognition.plist"
6799 | "var/db/receipts/com.apple.pkg.iLifeRegistration.bom"
6800 | "var/db/receipts/com.apple.pkg.iLifeRegistration.plist"
6801 | "var/db/receipts/com.apple.pkg.iLifeRegistrationPost.bom"
6802 | "var/db/receipts/com.apple.pkg.iLifeRegistrationPost.plist"
6803 | "var/db/receipts/com.apple.pkg.iLifeSlideshow_v2.bom"
6804 | "var/db/receipts/com.apple.pkg.iLifeSlideshow_v2.plist"
6805 | "var/db/receipts/com.apple.pkg.iLifeSlideshow.bom"
6806 | "var/db/receipts/com.apple.pkg.iLifeSlideshow.plist"
6807 | "var/tmp/.BlankFile"
6808 | )
6809 | echo "Removing: iLife Support"
6810 | for Removable in "${Removables[@]}" ; do
6811 | if [ -e "${Target}/${Removable}" ] ; then
6812 | echo " /${Removable}"
6813 | rm -rf "${Target}/${Removable}"
6814 | fi
6815 | done
6816 | fi
6817 | fi
6818 | /usr/libexec/PlistBuddy -c "Print :0" "${Target}/var/db/.MASManifest" &>/dev/null
6819 | if [ ${?} -ne 0 ] ; then rm -f "${Target}/var/db/.MASManifest" ; fi
6820 | echo
6821 | fi
6822 | # Pause prior to exporting to make any additional changes
6823 | # press_anyKey
6824 | if [ ${TargetType} -eq 1 ] ; then
6825 | set_TargetProperties
6826 | fi
6827 | if [ ${TargetType} -eq 2 ] ; then
6828 | printf "Exporting Image(s)\n"
6829 | if [ ! -d "${MasterFolder}" ] ; then mkdir -p "${MasterFolder}" ; fi
6830 | if [ -e "${MasterFolder}/${MasterName}" ] ; then rm -f "${MasterFolder}/${MasterName}" ; fi
6831 | if [ -e "${MasterFolder}/${RecoveryName}" ] ; then rm -f "${MasterFolder}/${RecoveryName}" ; fi
6832 | for TargetVolume in "${TargetVolumes[@]}" ; do
6833 | rm -rf "/Volumes/${TargetVolume}/.Spotlight-V100"
6834 | rm -rf "/Volumes/${TargetVolume}/.Trashes"
6835 | rm -rf "/Volumes/${TargetVolume}/.fseventsd"
6836 | done
6837 | case ${ExportType} in
6838 | 1 )
6839 | hdiutil eject "${Target}" -force &>/dev/null ;
6840 | while [ -e "${Target}" ] ; do sleep 1 ; done ;
6841 | hdiutil convert -format UDZO "${LibraryFolder}/${TargetName}" -shadow "${LibraryFolder}/${TargetName}.shadow" -o "${MasterFolder}/${MasterName}" ;;
6842 | 2 )
6843 | hdiutil create -srcfolder "${Target}" -layout SPUD "${MasterFolder}/${MasterName}" ;
6844 | hdiutil eject "${Target}" -force &>/dev/null ;
6845 | while [ -e "${Target}" ] ; do sleep 1 ; done ;;
6846 | 3 )
6847 | printf "Initializing…\n"
6848 | printf "Creating…\n"
6849 | printf "copying \"${Target}\"."
6850 | hdiutil create -srcfolder "${Target}" -layout SPUD "${MasterFolder}/${MasterName}" ;
6851 | if [ ${#TargetVolumes[@]} -gt 1 ] ; then
6852 | TargetDevice=`diskutil info "${Target}" | grep -m 1 "Part of Whole:" | awk '{print $NF}'` ;
6853 | hdiutil unmount "/dev/${TargetDevice}s3" &>/dev/null
6854 | hdiutil create -srcdevice "/dev/${TargetDevice}s3" "${MasterFolder}/${RecoveryName}" ;
6855 | fi
6856 | hdiutil eject "${Target}" -force &>/dev/null ;
6857 | while [ -e "${Target}" ] ; do sleep 1 ; done ;;
6858 | esac
6859 | printf "\n"
6860 | printf "Scanning Image(s) for Restore\n"
6861 | asr imagescan --source "${MasterFolder}/${MasterName}"
6862 | if [ -e "${MasterFolder}/${RecoveryName}" ] ; then asr imagescan --source "${MasterFolder}/${RecoveryName}" ; fi
6863 | rm -f "${LibraryFolder}/${TargetName}.shadow"
6864 | Volume=`hdiutil attach -owners on -noverify "${LibraryFolder}/${TargetName}" | grep "Apple_HFS" | awk -F "/Volumes/" '{print $NF}'`
6865 | set_Target "${Volume}"
6866 | printf "\n"
6867 | fi
6868 | press_anyKey
6869 | }
6870 |
6871 | function menu_SystemSetup {
6872 | SystemSetupOptions=( "Main Menu" "Select Target" "Configurations" "System Preferences" "Users" "Packages" "Remove Software" "Apply Configuration" )
6873 | while [ "${Option}" != "Main Menu" ] ; do
6874 | display_Subtitle "Configure System"
6875 | display_Target
6876 | display_Options "Options" "Select an option: "
6877 | select Option in "${SystemSetupOptions[@]}" ; do
6878 | case "${Option}" in
6879 | "Main Menu" ) break ;;
6880 | "Select Target" ) select_Target ; unset Option ; break ;;
6881 | "Configurations" ) menu_Configurations ; unset Option ; break ;;
6882 | "System Preferences" ) menu_SystemPreferences ; unset Option ; break ;;
6883 | "Users" ) menu_Users ; unset Option ; break ;;
6884 | "Packages" ) menu_Packages ; unset Option ; break ;;
6885 | "Remove Software" ) menu_RemoveSoftware ; unset Option ; break ;;
6886 | "Apply Configuration" ) apply_Configuration ; unset Option ; break ;;
6887 | esac
6888 | done
6889 | done
6890 | if [ ${TargetType} -eq 2 ] ; then hdiutil eject "${Target}" &>/dev/null ; fi
6891 | unset TargetName
6892 | unset TargetType
6893 | set_TargetProperties
6894 | }
6895 |
6896 | function main_Menu {
6897 | while [ "${Option}" != "Exit" ] ; do
6898 | display_Subtitle "Main Menu"
6899 | Options=( "Exit" "Help" "Preferences" "Create Image" "System Setup" )
6900 | display_Options "Options" "Select an option: "
6901 | select Option in "${Options[@]}" ; do
6902 | case "${Option}" in
6903 | "Exit" ) echo ; exit 0 ;;
6904 | "Help" ) menu_Help ; unset Option ; break ;;
6905 | "Preferences" ) menu_Preferences ; unset Option ; break ;;
6906 | "Create Image" ) menu_CreateImage ; unset Option ; break ;;
6907 | "System Setup" ) menu_SystemSetup ; unset Option ; break ;;
6908 | esac
6909 | done
6910 | done
6911 | }
6912 |
6913 | privelege_Check
6914 | get_LicenseStatus
6915 | menu_License
6916 | get_SystemOSVersion
6917 | get_LocalUsers
6918 | get_Preferences
6919 | set_TargetProperties
6920 | set_LanguageCountryCodes "${LanguageCode}"
6921 | set_OtherCountryCodes
6922 | main_Menu
6923 |
6924 | exit 0
--------------------------------------------------------------------------------