home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / console-common.preinst < prev    next >
Encoding:
Text File  |  2009-11-08  |  2.6 KB  |  93 lines

  1. #! /bin/sh
  2.  
  3. set -e
  4.  
  5. . /usr/share/debconf/confmodule
  6.  
  7. # Ensure we don't step on a hand-edited /etc/console/boottime.kmap.gz
  8. BOOT_MAP=/etc/console/boottime.kmap.gz
  9. MD="none"
  10. [ -r $BOOT_MAP ] && MD=`md5sum $BOOT_MAP |  cut -d' ' -f1 `
  11. if  db_get console-data/bootmap-md5sum && [ "$RET" != "$MD" ] ; then
  12.    db_set console-data/keymap/policy "Don't touch keymap"
  13. fi
  14.  
  15. db_get console-data/keymap/family
  16. CFAMILY=`echo $RET | perl -pe '$_ = lc; s/[^a-z0-9+\-\.\/\n]/_/g';`
  17. LAYOUT=console-data/keymap/$CFAMILY/layout
  18.  
  19. # Is there a chance that a user-provided keymap has to imported ?
  20. # Let's cross our fingers... it should never break, but...
  21. if db_get $LAYOUT && [ -x /usr/share/console/getkmapchoice.pl ];
  22. then
  23.    # Protect against failure of getkmapchoice.pl by locally turning
  24.    # off set -e.
  25.    set +e
  26.    choice="$(PERL_BADLANG=0 /usr/share/console/getkmapchoice.pl 2>&1)"
  27.    if [ $? != 0 ]; then
  28.       # See comment below
  29.       choice="useless"
  30.    fi
  31.    set -e
  32. else
  33.     # if getkmapchoice is not there, assume the user never had the
  34.     # oportunity to select no keymap to be installed using the
  35.     # console-common framework
  36.     choice="useless"
  37. fi
  38.  
  39.  
  40. # Maybe import boottime keymap
  41.  
  42. if [ "$choice" != KERNEL -a "$choice" != NONE -a ! -r /etc/console/boottime.kmap.gz ]
  43. then
  44.     # if we have to move a file, we need this dir
  45.     mkdir -p /etc/console
  46.  
  47.     if dpkg --status console-tools 2>/dev/null | grep -q '^Status: .* installed$'; then
  48.     # take it from console-tools
  49.  
  50.     if [ -r /etc/console-tools/default.kmap.gz ]
  51.     then
  52.         mv /etc/console-tools/default.kmap.gz /etc/console/boottime.kmap.gz
  53.     elif [ -r /etc/console-tools/default.kmap ]
  54.     then
  55.         gzip -9f /etc/console-tools/default.kmap
  56.         mv /etc/console-tools/default.kmap.gz /etc/console/boottime.kmap.gz
  57.     fi
  58.  
  59.     if [ -r /etc/console/boottime.kmap.gz ]
  60.     then
  61.         echo >&2 "Imported boot-time keymap from old console-tools settings"
  62.     fi
  63.  
  64.     elif dpkg --status kbd 2>/dev/null | grep -q '^Status: .* installed$'; then
  65.     # take it from kbd
  66.  
  67.     if [ -r /etc/kbd/default.kmap.gz ]
  68.     then
  69.         mv /etc/kbd/default.kmap.gz /etc/console/boottime.kmap.gz
  70.     elif [ -r /etc/kbd/default.kmap ]
  71.     then
  72.         gzip -9f /etc/kbd/default.kmap
  73.         mv /etc/kbd/default.kmap.gz /etc/console/boottime.kmap.gz
  74.     elif [ -r /etc/kbd/default.map.gz ]
  75.     then
  76.         mv /etc/kbd/default.map.gz /etc/console/boottime.kmap.gz
  77.     elif [ -r /etc/kbd/default.map ]
  78.     then
  79.         gzip -9f /etc/kbd/default.map
  80.         mv /etc/kbd/default.map.gz /etc/console/boottime.kmap.gz
  81.     fi
  82.  
  83.     if [ -r /etc/console/boottime.kmap.gz ]
  84.     then
  85.         echo >&2 "Imported boot-time keymap from old kbd settings"
  86.     fi
  87.  
  88.     fi
  89. fi
  90.  
  91.  
  92.  
  93.