[slack-ru] Потестируйте патч для xorgsetup

  • From: Daniil Bratashov <dn2010@xxxxxxxxx>
  • To: slack-ru@xxxxxxxxxxxxx
  • Date: Sun, 13 Aug 2006 13:41:28 +0400

subj. Нужны добровольцы для тестирования, а также предложения по
улучшению.

WBR, Даниил Браташов.
--- ./xorgsetup.orig    2006-08-10 09:13:53.000000000 +0400
+++ ./xorgsetup 2006-08-13 12:20:26.000000000 +0400
@@ -22,7 +22,8 @@
 #
 
 
-# These functions will spit out code to ask for Keyboard Model/Layout/Variant
+# These functions will spit out code to ask for Keyboard Model/Layout/Variant/
+# Options
 # They are pretty much identical, but the text message changes and they parse
 # different parts of the same file.
 dump_keyboard_model()
@@ -47,9 +48,12 @@
  
 dump_keyboard_layout()
 {
-    echo -n "dialog --title \"SELECT YOUR KEYBOARD LAYOUT\" --menu \"The 
keyboard layout support the language \
+    echo -n "dialog --title \"SELECT YOUR $1 KEYBOARD LAYOUT\" --menu \"The 
keyboard layout support the language \
 that is normally used on this keyboard.  You would usually select a similar 
keyboard layout \
-to what you choose for the console. (Defaults to \\\"us\\\")\" 21 60 11 "
+to what you choose for the console. (Defaults to \\\"us\\\") You can select up 
to 4 different layouts.\" 21 60 11 "
+    if [ ! $1 = "MAIN" ]; then
+        echo -n \"none\" \"Do not select an additional layout\"" "
+    fi
     CAN_START_PARSING=0
     while read LINE ; do 
         if [[ $LINE == "! layout" ]]; then
@@ -93,6 +97,29 @@
     echo "return \$?"
 }
 
+dump_keyboard_option()
+{
+    echo -n "dialog --title \"SELECT YOUR KEYBOARD OPTIONS\" --menu \"Select 
additional keyboard options\" 21 60 11 "
+    echo -n \"none\" \"Do not select any additional options\"" "
+    CAN_START_PARSING=0
+    while read LINE ; do 
+        if [[ $LINE == "! option" ]]; then
+            CAN_START_PARSING=1
+        elif [[ $CAN_START_PARSING == 1 ]]; then
+            if [[ $LINE =~ "^!.*" ]]; then
+                break
+            fi
+            if ! echo $LINE | grep '^//' 1> /dev/null ; then
+               if  echo $LINE | grep ':' 1> /dev/null ; then
+                   echo -n $LINE | sed 
-e's/\s*\([A-Za-z0-9_]\+\)\s\+\(.\+\)$/"\1" "\2" /g'
+               fi    
+            fi
+        fi
+    done < /etc/X11/xkb/rules/xorg.lst
+    echo " 2> \$TMP/keyboption "
+    echo "return \$?"
+}
+
 # If we aren't root, bail:
 if [ "$USER" = "root" ]; then
   TMP=/var/log/setup/tmp
@@ -175,19 +202,54 @@
     if [ $? = 0 ]; then
         KBMODEL=`cat $TMP/keybmodel`
     fi
-    dump_keyboard_layout > $TMP/asklayout
-    . $TMP/asklayout
-    if [ $? = 0 ]; then
-        KBLAYOUT=`cat $TMP/keyblayout`  
-        dump_keyboard_variant $KBLAYOUT > $TMP/askvariant
-        . $TMP/askvariant
-        if [ ! $? = 0 ]; then
-            KBVARIANT="none"
-        else
-            KBVARIANT=`cat $TMP/keybvariant`
-        fi
-    fi
-    rm -f $TMP/{ask,keyb}{model,layout,variant}
+    for i in "MAIN" "SECOND" "THIRD" "FORTH"; do
+        dump_keyboard_layout $i > $TMP/asklayout
+       . $TMP/asklayout
+       if [ ! $? = 0 ]; then
+           break
+       else
+           KBLAYOUT=`cat $TMP/keyblayout`  
+           if [ $KBLAYOUT = "none" ]; then
+               break
+           fi  
+           if [ ! $KBLAYOUTS = "" ]; then
+               KBLAYOUTS=$KBLAYOUTS,$KBLAYOUT
+           else
+               KBLAYOUTS=$KBLAYOUT
+           fi    
+           dump_keyboard_variant $KBLAYOUT > $TMP/askvariant
+           . $TMP/askvariant
+           if [ ! $? = 0 ]; then
+               KBVARIANT="none"
+           else
+               KBVARIANT=`cat $TMP/keybvariant`
+               if [ ! $KBVARIANT = "none" ]; then
+                   KBLAYOUTS="$KBLAYOUTS($KBVARIANT)"
+               fi    
+           fi
+       fi
+    done 
+    KBLAYOUT=$KBLAYOUTS
+#    if [ ! $KBLAYOUT = "us" ]; then
+       dump_keyboard_option > $TMP/askoption
+       while [ 1 ]; do
+           . $TMP/askoption
+           if [ ! $? = 0 ]; then
+               break
+           else
+               KBOPTION=`cat $TMP/keyboption`
+               if [ $KBOPTION = "none" ]; then
+                   break
+               fi      
+               if [ ! $KBOPTIONS = "" ]; then
+                   KBOPTIONS=$KBOPTIONS,$KBOPTION
+               else
+                   KBOPTIONS=$KBOPTION
+               fi    
+           fi
+       done
+#    fi
+    rm -f $TMP/{ask,keyb}{model,layout,variant,option}
 fi
 
 # /* I know this completely hoses the indentation of the xorg.conf file, but
@@ -224,9 +286,13 @@
       fi
       if [ ! "$KBLAYOUT" = "" ]; then
           echo "Option       \"XkbLayout\"  \"$KBLAYOUT\"" >> 
/etc/X11/xorg.conf
-          if [ ! "$KBVARIANT" = "none" ]; then
-              echo "Option       \"XkbVariant\"  \"$KBVARIANT\"" >> 
/etc/X11/xorg.conf
-          fi
+# KBVARIANT in KBLAYOUT          
+#          if [ ! "$KBVARIANT" = "none" ]; then
+#              echo "Option       \"XkbVariant\"  \"$KBVARIANT\"" >> 
/etc/X11/xorg.conf
+#          fi
+      fi
+      if [ ! "$KBOPTIONS" = "" ]; then
+          echo "Option       \"XkbOptions\"  \"$KBOPTIONS\"" >> 
/etc/X11/xorg.conf
       fi
   elif echo $LINE | grep Driver | grep \"mouse\" 1> /dev/null ; then
       # This is a mouse, lets take a look and check if X was able to configure

Other related posts: