This file is indexed.

preinst is in gnumeric 1.12.28-1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 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
#! /bin/sh
set -e

confirm_upgrade=true
case "$1" in
	install|upgrade)
		if [ -z "$2" ]; then
			# if not upgrading then it is all good
			confirm_upgrade=false
		else
			old_upstream=${2%-*}
			if [ "$old_upstream" = "1.12.28" ]; then
				confirm_upgrade=false
			fi
		fi
	;;
	*)
		:
	;;
esac

confirm_upgrade_if_running() {
	local pid gnumeric_running=false

	if ! test -e /usr/share/debconf/confmodule ; then
		# Nothing we can do
		return 0
	fi

	# Check: if there's a gnumeric process running
	for pid in $(pidof gnumeric); do
		local running_exe target_exe

		# Check: if it is not some other random process (e.g.
		# debug gnumeric builtby the user)
		# N.b. when run from a chroot, this can't tell an
		# instance running in the chroot and outside apart
		if ! [ -L "/proc/$pid/exe" ]; then
		    continue
		fi

		# This won't play very well with dpkg diversions
		running_exe="$(readlink -f "/proc/$pid/exe" 2>&1)"
		target_exe="$(readlink -f /usr/bin/gnumeric 2>&1)"
		if [ "$running_exe" = "$target_exe" ]; then
			gnumeric_running=true
		fi
	done

	if ! $gnumeric_running; then
		return 0
	fi

	. /usr/share/debconf/confmodule

	db_version 2.0
	db_settitle gnumeric/existing-process-title

	# Ignore the fact that this question may have been answered on another
	# occasion already
	db_fset gnumeric/existing-process seen false

	# Try hard to get it answered
	db_input high gnumeric/existing-process || true
	db_go
	db_get gnumeric/existing-process
	if [ "$RET" = "false" ] ; then
		# Abort installation of the package
		db_stop
		exit 1
	fi

	db_stop
}

if $confirm_upgrade; then
	confirm_upgrade_if_running
fi



exit 0