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
|
#!/bin/sh -e
TO_DIVERT="depmod insmod update-modules modinfo kallsyms ksyms"
TO_DIVERT_L="lsmod modprobe rmmod"
divert_gen() {
DEXT=${3:-modutils}
dpkg-divert --add --rename --package module-init-tools \
--divert $2/$1.$DEXT $2/$1 > /dev/null
}
divert_man() {
DSECTION=${2:-8}
for locale in '' fr/; do
dpkg-divert --add --rename --package module-init-tools --divert \
/usr/share/man/${locale}man$DSECTION/$1.modutils.$DSECTION.gz \
/usr/share/man/${locale}man$DSECTION/$1.$DSECTION.gz > /dev/null
done
}
create_compat_symlinks() {
# The links must be created even if modutils has not been installed,
# because it could be installed after m-i-t.
# -f should not be needed, but some people break their own systems
# and then complain about module-init-tools. See #225236 for an example.
[ -L /bin/lsmod.modutils ] || \
ln -sf /sbin/lsmod.modutils /bin/lsmod.modutils
[ -L /sbin/ksyms ] || ln -sf insmod.modutils /sbin/ksyms
[ -L /sbin/kallsyms ] || ln -sf insmod.modutils /sbin/kallsyms
return 0
}
upgrade_etc_files() {
if [ "$2" ] && dpkg --compare-versions $2 ge 3.1-pre2-1; then
return 0 # nothing to do
fi
# just delete /etc/modprobe.conf if it's the one installed by old packages
CONF_MD5='bf228fe320e2932bc34ba424d3ed2a5e /etc/modprobe.conf'
if [ -f /etc/modprobe.conf ] \
&& echo "$CONF_MD5" | md5sum -c 2> /dev/null; then
rm /etc/modprobe.conf
fi
# or if it is empty
if [ -s /etc/modprobe.conf ]; then
rm /etc/modprobe.conf
fi
if [ -f /etc/modprobe.conf ]; then
[ -d /etc/modprobe.d/ ] || mkdir /etc/modprobe.d/
grep -Ev '^include +/lib/modules/modprobe.conf *$' /etc/modprobe.conf \
> /etc/modprobe.d/old_etc_modprobe.conf || true
rm /etc/modprobe.conf
fi
rm -f /lib/modules/modprobe.conf*
return 0
}
case "$1" in
install|upgrade)
for cmd in $TO_DIVERT; do
divert_gen $cmd /sbin
divert_man $cmd
done
for cmd in $TO_DIVERT_L; do
if [ ! -L /sbin/$cmd.modutils ]; then
ln -s insmod.modutils /sbin/$cmd.modutils
fi
divert_gen $cmd /sbin Lmodutils
divert_man $cmd
done
divert_man modules 5
create_compat_symlinks
upgrade_etc_files "$@"
;;
abort-upgrade)
;;
*)
echo "$0 called with unknown argument '$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
|