Hi Joe,

On 03/19/09 16:22, Joseph J VLcek wrote:
> Setting the default "keyboard layout" and "desktop language" are part 
> of the fix for bug6431.
>
> http://defect.opensolaris.org/bz/show_bug.cgi?id=6431
>
> Setting the default "keyboard layout" is trivial since "kbd -s" 
> accepts  an argument. Setting the keyboard laytout to the default of 
> English can be accomplished with the following command:
>
>     /usr/bin/kbd -s US-English
>
> Setting the default "desktop language" is not as trivial since the 
> set_lang command does not accept an argument and requires user input. 
> I have 2 possible solutions, both work. I wanted to know what folks 
> feel is the best solution.
>
> Solution 1:
>     Use the set_lang command and echo the selection number associated 
> with English.
>     e.g.:
>     echo 3 | set_lang
>
>     The downside to this approach is if the menu presented by the 
> set_lang command changes and "3" is no longer associated with English.
>
> Solution 2:
>     Do what the set_lang command does:
> create the directory /etc/sysconfig then echo the value for English 
> into file: /etc/sysconfig/language
>
>     e.g.:
>     mkdir -p "/etc/sysconfig"
>     echo "RC_LANG=en_US.UTF.8" > /etc/sysconfig/language"
>
> This seems to me to be the safer of the 2 solutions.
>
> Thoughts?

Looking at the set_lang script, it seems that it already contains
necessary stuff to correctly determine value for default choice (English).
Based on this, I am thinking about one more possibility - set_lang script
might be enhanced to accept one parameter - if set to 'default',
interactive section would be just skipped and default determined by
set_lang would be set. It might look like (full script is attached,
but not polished :-):

$ diff -u cmd/slim-install/config/set_lang /tmp/set_lang
--- cmd/slim-install/config/set_lang    Tue Mar 17 15:38:33 2009
+++ /tmp/set_lang    Thu Mar 19 18:48:58 2009
@@ -40,6 +40,8 @@
 # external file contains fixedlist
 typeset -r fixedlistfile='/usr/share/gui-install/langs_localized'
 
+[ ${#*} -eq 1 -a $1="default" ] && pickup_default_choice=true
+
 # Read integer value. Don't alter the choice for invalid input.
 # Added for "compatibilty" to "/usr/bin/kbd -s".
 # Note: This is different from other curses/ncurses/GTK+/Motif behaviour.
@@ -166,6 +168,8 @@
 
 # Prompt user to select language and check for valid entry
 integer choice=${languages.default}
+
+if [ "$pickup_default_choice" == "" ] ; then
 while true ; do
     readintval choice $"To select desktop language, enter a number 
[default is ${languages.default}]: " || continue
 
@@ -174,6 +178,7 @@
 done
 
 printf "User selected: %s\n" "${languages.list[choice-1].name}"
+fi
 
 mkdir -p "/etc/sysconfig"


The call in live-fs-root would be for this case:

...
/usr/sbin/set_lang default
...

Cheers,
Jan

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: set_lang
URL: 
<http://mail.opensolaris.org/pipermail/caiman-discuss/attachments/20090319/c75c1a4c/attachment.ksh>

Reply via email to