home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / var / lib / dpkg / info / module-init-tools.postinst < prev    next >
Encoding:
Text File  |  2006-07-04  |  2.4 KB  |  109 lines

  1. #!/bin/sh -e
  2.  
  3. upgrade_quirks() {
  4.   if dpkg --compare-versions "$2" eq "3.1-pre4-1"; then
  5.     depmod -a || true
  6.   fi
  7. }
  8.  
  9. create_etc_modules() {
  10.     if [ ! -e /etc/modules ]; then
  11.     cat <<EOT > /etc/modules
  12. # /etc/modules: kernel modules to load at boot time.
  13. #
  14. # This file contains the names of kernel modules that should be loaded
  15. # at boot time, one per line. Lines beginning with "#" are ignored.
  16.  
  17. EOT
  18.     chmod 644 /etc/modules
  19.     fi
  20. }
  21.  
  22. archmodel() { 
  23.   local arch=$(uname -m)
  24.   case $arch in
  25.   i[0-9]86)    arch=i386 ;;
  26.   x86_64|amd64)    arch=i386 ;;
  27.   arm*)        arch=arm ;;
  28.   mips*)    arch=mips ;;
  29.   # 64 bit variants of some architectures are treated like the 32 bit
  30.   s390x)    arch=s390 ;;
  31.   parisc64)    arch=parisc ;;
  32.   sparc64)    arch=sparc ;;
  33.   # these architectures have variants with wildly different hardware
  34.   ppc64)    arch=powerpc.generic ;;
  35.   ppc|powerpc)
  36.     if [ -f /proc/cpuinfo ]; then
  37.       model=$(sed -ne 's/^machine[[:space:]]*:[[:space:]]*//p' /proc/cpuinfo)
  38.     else
  39.       echo "/proc/cpuinfo does not exist, assuming generic powerpc system"
  40.     fi
  41.     case "$model" in
  42.       Amiga*) arch="powerpc.apus" ;;
  43.       Power*) arch="powerpc.pmac" ;; 
  44.       *)      arch="powerpc.generic" ;;
  45.     esac
  46.     ;;
  47.   m68k)
  48.     if [ -f /proc/hardware ]; then
  49.       model=$(sed -ne 's/^Model:[[:space:]]*//p' /proc/hardware)
  50.     else
  51.       echo "/proc/hardware does not exist, assuming generic m68k system"
  52.     fi
  53.     case "$model" in
  54.       Atari*)        arch="m68k.atari" ;;
  55.       Amiga*)        arch="m68k.amiga" ;;
  56.       *)        arch="m68k.generic" ;;
  57.     esac
  58.     ;;
  59.   esac
  60.  
  61.   echo $arch
  62. }
  63.  
  64. create_arch_symlink() {
  65.   cd /etc/modprobe.d/
  66.  
  67.   model=$(archmodel)
  68.   oldmodel=$model
  69.  
  70.   while [ ! -f arch/$model ]; do
  71.     oldmodel=$model
  72.     model=${oldmodel%.*}.generic
  73.     [ "$model" = "$oldmodel" ] && break
  74.     echo "Configuration for $oldmodel not found, trying $model"
  75.   done
  76.  
  77.   ARCHCONFFILE=arch/$model
  78.   if [ -f $ARCHCONFFILE ]; then
  79.     ln -sf $ARCHCONFFILE arch-aliases
  80.   else
  81.     echo "Architecture-specific config file not found"
  82.   fi
  83. }
  84.  
  85. case "$1" in
  86.     configure)
  87.     upgrade_quirks "$@"
  88.     create_etc_modules
  89.     create_arch_symlink
  90.     ;;
  91.  
  92.     abort-upgrade|abort-remove|abort-deconfigure)
  93.     ;;
  94.  
  95.     *)
  96.     echo "$0 called with unknown argument '$1'" >&2
  97.     exit 1
  98.     ;;
  99. esac
  100.  
  101. # Automatically added by dh_installinit
  102. if [ -x "/etc/init.d/module-init-tools" ]; then
  103.     update-rc.d module-init-tools start 15 S . >/dev/null || exit $?
  104. fi
  105. # End automatically added section
  106.  
  107.  
  108. exit 0
  109.