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
|
#!/bin/sh -e
TO_DIVERT="depmod insmod update-modules modinfo kallsyms ksyms"
TO_DIVERT_L="lsmod modprobe rmmod"
undivert_gen() {
DEXT=${3:-modutils}
dpkg-divert --remove --rename --package module-init-tools \
--divert $2/$1.$DEXT $2/$1 > /dev/null
}
undivert_man() {
DSECTION=${2:-8}
for locale in '' fr/; do
dpkg-divert --remove --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
}
remove_compat_symlinks() {
SYMLINKS_TO_REMOVE="/bin/lsmod.modutils /sbin/ksyms /sbin/kallsyms"
for file in $SYMLINKS_TO_REMOVE; do
[ -L $file ] && rm $file
done
return 0
}
remove_etc_files() {
# created by postinst
# do not remove it if the modutils package is installed
[ ! -f /etc/init.d/modutils ] && rm -f /etc/modules
# created by update-modutils
rm -f /etc/modutils.conf
}
case "$1" in
remove)
remove_compat_symlinks
undivert_man modules 5
for cmd in $TO_DIVERT; do
undivert_gen $cmd /sbin
undivert_man $cmd
done
for cmd in $TO_DIVERT_L; do
rm -f /sbin/$cmd.modutils
undivert_gen $cmd /sbin Lmodutils
undivert_man $cmd
done
;;
purge)
remove_etc_files
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "$0 called with unknown argument '$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
|