[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#243034: languagechooser: console-cyrillic support



Package: languagechooser
Version: svn
Severity: wishlist
Tags: patch l10n d-i

Attached patch adds console-cyrillic support for languagechooser
prebaseconfig (similar to console-tools). Prebaseconfig expects
information about cyrillic keyboard in form:

cyr=style,size,encoding,layout(options)

Example for Ukrainian:

cyr=uni,16,koi8-u,ua_ms(ctrl_shift_toggle)

I tested this script with console-cyrillic installed with highest debconf
priority on working system.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.25
Locale: LANG=uk_UA, LC_CTYPE=uk_UA
Index: prebaseconfig
===================================================================
--- prebaseconfig	(revision 13104)
+++ prebaseconfig	(working copy)
@@ -2,9 +2,19 @@
 
 . /usr/share/debconf/confmodule
 
+modify_cyrconfig() {
+	if [ "$2" ]; then
+	   sed -e "s/^$1 .*\$/$1 $2/" \
+	          $cyrconfig > $cyrconfig.tmp && \
+           mv $cyrconfig.tmp $cyrconfig
+	fi
+}
+
 db_get debian-installer/consoledisplay || true
-consolefont=`echo $RET | sed -e 's/^kbd=//'`
-if [ "$consolefont" != "$RET" ]; then
+consoletype=`echo $RET | sed -e 's/=.*$//'`
+case "$consoletype" in
+kbd)
+    consolefont=`echo $RET | sed -e 's/^kbd=//'`
     if apt-install console-tools; then
         ctconfig=/target/etc/console-tools/config
         acm=`echo $consolefont | sed -e 's/.*(//' -e 's/).*//'`
@@ -21,7 +31,31 @@
             mv $ctconfig.tmp $ctconfig
         fi
     fi
-fi
+    ;;
+cyr)
+    consolefont=`echo $RET | sed -e 's/^cyr=//'`
+    if apt-install console-cyrillic; then
+        cyrconfig=/target/etc/console-cyrillic
+	# format of the consolefont is:
+	# style,size,encoding,layout(option1 option2)
+	style=`echo $consolefont | sed -e 's/,.*$//'`
+	size=`echo $consolefont | sed -e 's/^[^,]*,\([^,]*\),.*$/\1/'`
+	encoding=`echo $consolefont | sed -e 's/^[^,]*,[^,]*,\([^,]*\),.*$/\1/'`
+	layoutopts=`echo $consolefont | sed -e 's/^[^,]*,[^,]*,[^,]*,\([^)]*)\).*$/\1/'`
+	layout=`echo $layoutopts | sed -e 's/(.*)$//'`
+	options=`echo $layoutopts | sed -e 's/.*(//' -e 's/).*//'`
+	modify_cyrconfig style "$style"
+	modify_cyrconfig size "$size"
+	modify_cyrconfig encoding "$encoding"
+	modify_cyrconfig layout "$layout"
+	modify_cyrconfig options "$options"
+	sed -e 's/^.*Bootsetup: .*$/# Bootsetup: YES/' $cyrconfig > $cyrconfig.tmp && \
+	   mv $cyrconfig.tmp $cyrconfig
+	sed -e 's/^.*Debconf: .*$/# Debconf: NO/' $cyrconfig > $cyrconfig.tmp && \
+	   mv $cyrconfig.tmp $cyrconfig
+    fi
+    ;;
+esac
  
 # Pass the language/locale information needed by base-config into
 # /target/root/dbootstrap_settings.

Reply to: