summaryrefslogtreecommitdiff
path: root/debian/preinst
blob: ec44b9c2aafdbd3579877bd6d05944a72c1bc9de (plain)
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
#
# $Id: preinst,v 1.15 2002/04/11 02:01:21 laz Exp $
#

set -e
[ -n "$DEBUG" ] && set -vx

action=$1
version=$2

# gimme da debconf
set +vx
. /usr/share/debconf/confmodule
[ -n "$DEBUG" ] && set -vx

if [ "$action" = "upgrade" ] ; then
    # use procps' pgrep if possible
    if which pgrep > /dev/null ; then
        PGREP="pgrep -x "
    else
        # if not, manufacture our own pgrep using awk and ps... sucko
        PGREP=screenmaint_pgrep

        screenmaint_pgrep() {
            ps auxww | awk "{
                if (match(\$11,\"screen\")!=0 || match(\$11,\"SCREEN\")!=0) {
                    print \$2;
                }
            }"
        }

    fi

    if dpkg --compare-versions "$version" lt "3.9.5-5" ; then
        if [ ! -z "$($PGREP screen)" ] ; then
            # if they're running an old version and there are screen processes
            # running, then prompt

            # reset these no matter what
            db_reset screen/old_upgrade_prompt || true
            db_fset screen/old_upgrade_prompt seen false || true

            # then prompt
            db_input high screen/old_upgrade_prompt || true
            db_go || true

            # and find out what they said
            db_get screen/old_upgrade_prompt || true
            if [ "$RET" = "false" ]; then
                exit 1
            fi
        fi
    fi
fi

#DEBHELPER#