[PC-BSD Commits] r5980 - pcbsd/trunk/pc-sysinstall/backend

svn at pcbsd.org svn at pcbsd.org
Tue Jan 12 13:45:21 PST 2010


Author: kris
Date: 2010-01-12 13:45:21 -0800 (Tue, 12 Jan 2010)
New Revision: 5980

Modified:
   pcbsd/trunk/pc-sysinstall/backend/functions-localize.sh
Log:

Setup localization on pc-syinstall to also use setxkbmap, since not in all cases will kxkbrc be loaded,
such as during kdm login, etc



Modified: pcbsd/trunk/pc-sysinstall/backend/functions-localize.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend/functions-localize.sh	2010-01-12 17:28:59 UTC (rev 5979)
+++ pcbsd/trunk/pc-sysinstall/backend/functions-localize.sh	2010-01-12 21:45:21 UTC (rev 5980)
@@ -28,6 +28,48 @@
 
 };
 
+localize_x_keyboard()
+{
+   KEYMOD="$1"
+   KEYLAY="$2"
+   KEYVAR="$3"
+   SETXKBMAP=""
+
+   if [ "${KEYMOD}" != "NONE" ]
+   then
+      localize_key_model "$KEYMOD"
+      SETXKBMAP="-model ${KEYMOD}"
+   fi
+
+   if [ "${KEYLAY}" != "NONE" ]
+   then
+     localize_key_layout "$KEYLAY"
+      SETXKBMAP="${SETXKBMAP} -layout ${KEYLAY}"
+   else
+      # Remove the kxkbrc if not used
+      rm ${FSMNT}/usr/share/skel/.kde4/share/config/kxkbrc >/dev/null 2>/dev/null
+   fi
+
+   if [ "${KEYVAR}" != "NONE" ]
+   then
+      localize_key_variant "$KEYVAR"
+      SETXKBMAP="${SETXKBMAP} -variant ${KEYVAR}"
+   fi
+
+   # Setup .xprofile with our setxkbmap call now
+   if [ ! -z "${SETXKBMAP}" ]
+   then
+     if [ ! -e "${FSMNT}/usr/share/skel/.xprofile" ]
+     then
+       echo "#!/bin/sh" >${FSMNT}/usr/share/skel/.xprofile
+     fi
+     echo "setxkbmap ${SETXKBMAP}" >>${FSMNT}/usr/share/skel/.xprofile
+     chmod 755 ${FSMNT}/usr/share/skel/.xprofile
+     cp ${FSMNT}/usr/share/skel/.xprofile ${FSMNT}/root/.xprofile
+   fi
+
+};
+
 # Function which sets the keyboard model in kxkbrc
 localize_key_model()
 {
@@ -64,6 +106,7 @@
     sk) KEYLAYOUT_CONSOLE="sk.iso2" ;;
     se) KEYLAYOUT_CONSOLE="swedish.iso" ;;
     tr) KEYLAYOUT_CONSOLE="tr.iso9.q" ;;
+    gb) KEYLAYOUT_CONSOLE="uk.iso" ;;
      *)  if [ ! -z "${KEYLAYOUT}" ]
          then
            KEYLAYOUT_CONSOLE="${KEYLAYOUT}.iso"
@@ -77,8 +120,6 @@
   fi
 
   # Now localize any xorg layouts
-
-  
   KXKBRC="${FSMNT}/usr/share/skel/.kde4/share/config/kxkbrc"
   if [ -e "${KXKBRC}" ]
   then
@@ -299,10 +340,9 @@
     if [ "$?" = "0" ]
     then
       get_value_from_string "$line"
-      localize_key_layout "$VAL"
+      KEYLAYOUT="$VAL"
     else
-      # Remove the kxkbrc if not used
-      rm ${FSMNT}/usr/share/skel/.kde4/share/config/kxkbrc >/dev/null 2>/dev/null
+      KEYLAYOUT="NONE"
     fi
 
     # Check if we need to do any key models
@@ -310,7 +350,9 @@
     if [ "$?" = "0" ]
     then
       get_value_from_string "$line"
-      localize_key_model "$VAL"
+      KEYMOD="$VAL"
+    else
+      KEYMOD="NONE"
     fi
 
     # Check if we need to do any key variant
@@ -318,9 +360,17 @@
     if [ "$?" = "0" ]
     then
       get_value_from_string "$line"
-      localize_key_variant "$VAL"
+      KEYVAR="$VAL"
+    else
+      KEYVAR="NONE"
     fi
 
+    # Do our localization if need be
+    if [ ! -z "${KEYLAYOUT}" -o ! -z "${KEYMOD}" -o ! -z "${KEYVAR}" ]
+    then
+      localize_x_keyboard "${KEYMOD}" "${KEYLAYOUT}" "${KEYVAR}"
+    fi
+
     # Check if we need to set a timezone
     echo $line | grep "^timeZone=" >/dev/null 2>/dev/null
     if [ "$?" = "0" ]



More information about the Commits mailing list