File: preinst

package info (click to toggle)
doc-base 0.7.1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 68 kB
  • ctags: 32
  • sloc: perl: 407; sh: 117; makefile: 68
file content (53 lines) | stat: -rw-r--r-- 1,380 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# preinst for doc-base

# the sole purpose of this file is to clean up a boo boo I introduced
# in doc-base 0.4

# Abort if any command returns an error value
set -e

cleanup_old_bug ( ) {
  if command -v install-docs >/dev/null 2>&1; then
    install-docs -r install-doc-man || true
  else
    echo "cannot find install-docs on path" 1>&2
  fi
}

# This script is called before this version of this package is installed.
# When this script is called, the package's files have not been unpacked
# yet.

case "$1" in
  install)
    # About to install this package.  There are two sub-cases.
    :
    if test "${2+set}" = set; then
      # The configuration files from version $2 of this package are
      # still on the system.
      if test "$2" = "0.4"; then
	cleanup_old_bug
      fi
    else
      # There is no existing configuration; install from scratch.
      :
    fi ;;
  upgrade)
    # About to upgrade this package from version $2 TO THIS VERSION.
    # "prerm upgrade" has already been called for the old version of
    # this package.
    if test "$2" = "0.4"; then
      cleanup_old_bug
    fi
    ;;
  abort-upgrade)
    # Back out of an attempt to upgrade this package FROM THIS VERSION to
    # version $2.  Undo the effects of "postrm upgrade $2".
    :
    ;;
  *) echo "$0: didn't understand being called with \`$1'" 1>&2
     exit 1;;
esac

exit 0