generate-keymap 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #! /bin/sh -
  2. #
  3. # Script to create a list of menu items for the keyboard selection.
  4. # This is specific for SYSLINUX/ISOLINUX.
  5. #
  6. set -e
  7. # Default values
  8. location=/usr/share/keymaps/i386
  9. output=keys_i386.cfg
  10. echo ""
  11. echo "Looking for keymaps at $location ..."
  12. echo ""
  13. # Compose header for 'output' file
  14. cat << EOF > $output
  15. MENU BEGIN keymap
  16. MENU TITLE Keyboard map
  17. EOF
  18. # Search of keymaps
  19. find $location \( ! -path '*fgGIod*' -a ! -path '*include*' \) | sort | \
  20. while read -r line
  21. do
  22. test -f "$line" || continue;
  23. category="${line%/*}"
  24. category="${category##*/}" # Extract up the last level.
  25. file="${line##*/}" # Full file name.
  26. file="${file%.map*}" # Get the rid of file extension.
  27. # Add body content to 'output' file
  28. # Make default entry, help text
  29. if test "${category}/$file" = qwerty/us
  30. then
  31. cat << EOF >> $output
  32. LABEL ${category}/$file
  33. MENU LABEL ^${category}/$file
  34. MENU DEFAULT
  35. COM32 cmd.c32
  36. APPEND dragora RC_KEYMAP=${category}/$file
  37. TEXT HELP
  38. This menu is organized as keyboard "Layout/Language".
  39. Select a keyboard map for the console before booting:
  40. ${category}/$file [default]
  41. ENDTEXT
  42. EOF
  43. continue;
  44. fi
  45. cat << EOF >> $output
  46. LABEL ${category}/$file
  47. MENU LABEL ${category}/$file
  48. COM32 cmd.c32
  49. APPEND dragora RC_KEYMAP=${category}/$file
  50. TEXT HELP
  51. This menu is organized as keyboard "Layout/Language".
  52. Select a keyboard map for the console before booting:
  53. ${category}/$file
  54. ENDTEXT
  55. EOF
  56. done
  57. # Compose footer for 'output' file
  58. cat << EOF >> $output
  59. MENU SEPARATOR
  60. LABEL return
  61. MENU LABEL ^Return to main menu
  62. MENU EXIT
  63. MENU END
  64. EOF
  65. echo "Output file: $output"
  66. echo ""