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