home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / initramfs-tools / hooks / keymap < prev    next >
Encoding:
Text File  |  2012-10-05  |  1.3 KB  |  67 lines

  1. #!/bin/sh
  2.  
  3. PREREQ=""
  4.  
  5. prereqs()
  6. {
  7.     echo "$PREREQ"
  8. }
  9.  
  10. case $1 in
  11. # get pre-requisites
  12. prereqs)
  13.     prereqs
  14.     exit 0
  15.     ;;
  16. esac
  17.  
  18. # Hook to load keymaps into the initramfs if requested by KEYMAP="y"
  19. if [ "$KEYMAP" != "y" ] && [ "$KEYMAP" != "Y" ]; then
  20.     exit 0
  21. fi
  22.  
  23. # Step 1 - Basic tools
  24. if [ ! -x /bin/loadkeys ]; then
  25.     echo "loadkeys is missing. Please install the 'kbd' package."
  26.     exit 0
  27. fi
  28.  
  29. if [ ! -x /bin/setupcon ]; then
  30.     echo "setupcon is missing. Please install the 'console-setup' package."
  31.     exit 0
  32. fi
  33.  
  34. . /usr/share/initramfs-tools/hook-functions
  35. copy_exec /bin/loadkeys /bin
  36.  
  37. if ! setupcon --save-keyboard ${DESTDIR}/etc/boottime.kmap.gz ; then
  38.     echo "Warning: error while trying to store keymap file - ignoring request to install /etc/boottime.kmap.gz"
  39.     rm -f ${DESTDIR}/etc/boottime.kmap.gz
  40.     exit 0
  41. fi
  42.  
  43. # Step 2 - Check for UTF8 console
  44. if [ ! -x /usr/bin/kbd_mode ]; then
  45.     exit 0
  46. fi
  47.  
  48. if [ -r /etc/environment ]; then
  49.     env="/etc/environment"
  50. elif [ -r /etc/default/locale ]; then
  51.     env="/etc/default/locale"
  52. else
  53.     exit 0
  54. fi
  55.  
  56. for var in LANG LC_ALL LC_CTYPE; do
  57.     value=$(egrep "^[^#]*${var}=" $env | tail -n1 | cut -d= -f2)
  58.     eval $var=$value
  59. done
  60.  
  61. charmap=$(LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap)
  62. if [ "$charmap" = "UTF-8" ]; then
  63.     copy_exec /usr/bin/kbd_mode /bin
  64. fi
  65. exit 0
  66.  
  67.