File: module-init-tools.preinst

package info (click to toggle)
module-init-tools 3.4-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,208 kB
  • ctags: 900
  • sloc: sh: 7,980; ansic: 5,036; makefile: 204
file content (58 lines) | stat: -rw-r--r-- 1,339 bytes parent folder | download
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
#!/bin/sh -e

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
}

rm_conffile() {
  local file=$1
  local md5=$2
  if [ -f $file ] && echo "$md5  $file" | md5sum -c 2> /dev/null; then
    rm $file
  fi
}

upgrade_quirks() {
  [ "$2" ] || return 0

  dpkg --compare-versions $2 lt 3.1-pre11-1 || return 0
  # remove an obsolete conffile, which was replaced by .../x86_64
  if [ "$(dpkg --print-architecture)" = amd64 ]; then
    rm_conffile /etc/modprobe.d/arch/i386 688ef8c36b20113c46ec631e6c9effd4
  fi

  dpkg --compare-versions $2 lt 3.2-pre9-4 || return 0
  rm -f /usr/share/man/man8/kallsyms.8.gz /usr/share/man/man8/ksyms.8.gz
  for cmd in kallsyms ksyms; do
    undivert_man $cmd
  done

  dpkg --compare-versions $2 lt 3.1-pre2-1 || return 0
  echo 'Upgrading from packages older than 3.1-pre2-1 is not supported.'
  echo 'Please purge module-init-tools before installing this package.'
  exit 1
}

case "$1" in
    install|upgrade)

    upgrade_quirks "$@"
    ;;

    abort-upgrade)
    ;;

    *)
    echo "$0 called with unknown argument '$1'" >&2
    exit 1
    ;;
esac

#DEBHELPER#

exit 0