[Pkg-kbd-commit] r249 - kbd/trunk/debian

Anton Zinoviev zinoviev at alioth.debian.org
Thu May 10 14:35:48 UTC 2007


Author: zinoviev
Date: 2007-05-10 14:35:48 +0000 (Thu, 10 May 2007)
New Revision: 249

Modified:
   kbd/trunk/debian/changelog
   kbd/trunk/debian/console-screen.kbd.sh
Log:
kbd(console-screen.kbd.sh): support also console-tools style config variables, do not run unicode_start/stop if we do not load a font


Modified: kbd/trunk/debian/changelog
===================================================================
--- kbd/trunk/debian/changelog	2007-05-10 12:48:34 UTC (rev 248)
+++ kbd/trunk/debian/changelog	2007-05-10 14:35:48 UTC (rev 249)
@@ -14,7 +14,10 @@
     - (re)enable the per-VC ACM load;
     - for consistency use CONSOLE_MAP_vcN instead of APP_CHARSET_MAP_vcN
       and FONT_MAP_vcN instead of CONSOLE_MAP_vcN;
-    - do not run unicode_start for consoles with defined CONSOLE_MAP_vcN;
+    - support also the config variables in console-tools style
+      (APP_CHARSET_MAP, SCREEN_FONT, SCREEN_FONT_MAP);
+    - do not run unicode_start if CONSOLE_MAP (or CONSOLE_MAP_vcN) is defined;
+    - run unicode_start/unicode_stop only on consoles where we load a font;
     - do not use static paths such as /usr/bin/setfont.
   
  -- Anton Zinoviev <zinoviev at debian.org>  Thu, 10 May 2007 11:21:53 +0300

Modified: kbd/trunk/debian/console-screen.kbd.sh
===================================================================
--- kbd/trunk/debian/console-screen.kbd.sh	2007-05-10 12:48:34 UTC (rev 248)
+++ kbd/trunk/debian/console-screen.kbd.sh	2007-05-10 14:35:48 UTC (rev 249)
@@ -23,6 +23,15 @@
     done
 fi
 
+# do some magic with the variables for compatibility with the config
+# file of console-tools
+for vc in '' `set | grep "^.*vc[0-9][0-9]*="  | sed 's/^.*vc\([0-9][0-9]*\)=.*/_vc\1/'`
+do
+    eval CONSOLE_FONT$vc=\${CONSOLE_FONT$vc:-\${SCREN_FONT$vc}}
+    eval FONT_MAP$vc=\${FONT_MAP$vc:-\${SCREN_FONT_MAP$vc}}
+    eval CONSOLE_MAP$vc=\${CONSOLE_MAP$vc:-\${APP_CHARSET_MAP$vc}}
+done
+
 . /lib/lsb/init-functions
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -45,6 +54,30 @@
     fi
 }
 
+unicode_start_stop ()
+{
+    vc=$1
+    if [ -f /etc/environment ] || [ -f /etc/default/locale ]
+    then
+        for var in LANG LC_CTYPE LC_ALL
+        do
+            value=$(egrep "^[^#]*${var}=" /etc/environment /etc/default/locale 2>/dev/null | tail -n1 | cut -d= -f2)
+            eval $var=$value
+        done
+    fi
+    CHARMAP=`LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap 2>/dev/null`
+    if [ "$CHARMAP" = "UTF-8" -a -z "$(eval echo \$CONSOLE_MAP\$CONSOLE_MAP_vc$vc)" ]; then
+	action=unicode_start
+    else
+	action=unicode_stop
+    fi
+    if [ "${CONSOLE_FONT}" ]; then
+	$action "${CONSOLE_FONT}" < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
+    else
+	$action < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
+    fi
+}
+
 setup ()
 {
     # be sure the main program is installed
@@ -85,41 +118,17 @@
         LIST_CONSOLES=`sed -e '/^ *#/d' /etc/inittab | grep 'tty[0-9]*$' | awk -F: '{printf "%s ", $1}'`
     fi
 
-    # Go to UTF-8 mode as necessary
-    # 
-    if [ -f /etc/environment ] || [ -f /etc/default/locale ]
-    then
-        for var in LANG LC_CTYPE LC_ALL
-        do
-            value=$(egrep "^[^#]*${var}=" /etc/environment /etc/default/locale 2>/dev/null | tail -n1 | cut -d= -f2)
-            eval $var=$value
-        done
-    fi
-    CHARMAP=`LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap 2>/dev/null`
-    for vc in $LIST_CONSOLES
-    do
-        if [ "$CHARMAP" = "UTF-8" -a -z "$(eval echo \$CONSOLE_MAP_vc$vc)" ]; then
-	    action=unicode_start
-	else
-	    action=unicode_stop
-	fi
-	if [ "${CONSOLE_FONT}" ]; then
-	    $action "${CONSOLE_FONT}" < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
-	else
-	    $action < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
-	fi
-    done
 
-
     # Global default font+map
     if [ "${CONSOLE_FONT}" ]; then
         [ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up general console font"
-        [ "${CONSOLE_MAP}" ] && SETFONT_OPT="$SETFONT_OPT -m ${CONSOLE_MAP}"
-
+	sfm="${FONT_MAP}" && [ "$sfm" ] && sfm="-u $sfm"
+	acm="${CONSOLE_MAP}" && [ "$acm" ] && acm="-m $acm"
+    
         # Set for the first 6 VCs (as they are allocated in /etc/inittab)
         for vc in $LIST_CONSOLES
         do
-            if ! setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} ${CONSOLE_FONT}; then
+            if ! unicode_start_stop $vc && setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm ${CONSOLE_FONT} $acm; then
                 [ "$VERBOSE" != "no" ] && log_action_end_msg 1
                 break
             fi
@@ -135,12 +144,12 @@
         for font in ${PERVC_FONTS}
         do
             # extract VC and FONTNAME info from variable setting
-            vc=`echo $font | cut -b16- | cut -d= -f1`
+
             eval font=\$CONSOLE_FONT_vc$vc
             # eventually find an associated SFM
             eval sfm=\${FONT_MAP_vc${vc}}
             [ "$sfm" ] && sfm="-u $sfm"
-            if ! setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm $font; then
+            if ! unicode_start_stop $vc && setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm $font; then
                 [ "$VERBOSE" != "no" ] && log_action_end_msg 1
                 break
             fi
@@ -149,24 +158,24 @@
     fi
 
 
-     # Per-VC ACMs
-     PERVC_ACMS="`set | grep "^CONSOLE_MAP_vc[0-9]*="  | tr -d \' `"
-     if [ "${PERVC_ACMS}" ]; then
-         [ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC ACM's"
-         for acm in ${PERVC_ACMS}
-         do
+    # Per-VC ACMs
+    PERVC_ACMS="`set | grep "^CONSOLE_MAP_vc[0-9]*="  | tr -d \' `"
+    if [ "${PERVC_ACMS}" ]; then
+	[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC ACM's"
+	for acm in ${PERVC_ACMS}
+	  do
              # extract VC and ACM_FONTNAME info from variable setting
-             vc=`echo $acm | cut -b19- | cut -d= -f1`
-             eval acm=\$CONSOLE_MAP_vc$vc
-             if ! setfont -C "${DEVICE_PREFIX}$vc" -m "$acm"; then
-                 [ "$VERBOSE" != "no" ] && log_action_end_msg 1
-                 break
-             fi
-         done
-         [ "$VERBOSE" != "no" ] && log_action_end_msg 0
-     fi
+	  vc=`echo $acm | cut -b19- | cut -d= -f1`
+	  eval acm=\$CONSOLE_MAP_vc$vc
+	  if ! setfont -C "${DEVICE_PREFIX}$vc" ${SETFONT_OPT} -m "$acm"; then
+	      [ "$VERBOSE" != "no" ] && log_action_end_msg 1
+	      break
+	  fi
+	done
+	[ "$VERBOSE" != "no" ] && log_action_end_msg 0
+    fi
+    
 
-
     # screensaver stuff
     setterm_args=""
     if [ "$BLANK_TIME" ]; then




More information about the Pkg-kbd-commit mailing list