File: libopenmpi-dev.preinst.in

package info (click to toggle)
openmpi 3.1.3-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 118,572 kB
  • sloc: ansic: 628,972; f90: 17,993; makefile: 13,761; sh: 7,051; java: 6,360; perl: 3,215; cpp: 2,225; python: 1,350; lex: 988; fortran: 52; tcl: 12
file content (62 lines) | stat: -rw-r--r-- 1,609 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
59
60
61
62
#!/bin/sh

set -e

remove_corrupt_alternative()
{
	local alt=$1

	if [ -f /var/lib/dpkg/alternatives/$alt ] && \
		! update-alternatives --query $alt >/dev/null 2>&1
	then
		# file exists, but query failed? likely corrupt!
		echo "Removing corrupt alternative(s) '$alt'"
		update-alternatives --remove-all $alt >/dev/null 2>&1 || \
			rm -fv /var/lib/dpkg/alternatives/$alt
	fi
}

remove_obsolete_alternative()
{
	local alt=$1

	remove_corrupt_alternative $alt

	if update-alternatives --query $alt >/dev/null 2>&1
	then
		echo "Removing obsolete alternative(s) '$alt'"
		update-alternatives --remove-all $alt
	fi
}

if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then

	if dpkg --compare-versions "$2" lt "3.1.3-10~" ; then

		# Recover from historically grown corruption (#912437)
		remove_corrupt_alternative mpi
		remove_corrupt_alternative mpi-@TRIPLET@

		# mpicc seemed to be used as a master alternative by some MPI package. But
		# currently, all MPI packages have the mpicc alternative installed as a slave
		# link. We remove the link here in order to resolve bugs #531184 and #532910.
		remove_obsolete_alternative mpicc

		# Similarly, see #886644
		remove_obsolete_alternative mpiCC

		# Splitting mpi and mpi-$MULTIARCH requires this
		if update-alternatives --query mpi 2>/dev/null | grep -q mpi-fort.pc ; then
			echo "Removing pre-multiarch 'mpi' alternative(s)"
			update-alternatives --remove-all mpi
			update-alternatives --remove-all mpi-@TRIPLET@ 2>/dev/null || true
		fi

		# This may be left hanging on the upgrade to multi-arch.
		rm -fv /usr/lib/libpmix.so

	fi

fi

#DEBHELPER#