This file is indexed.

postinst is in libzypp-config 15.3.0-1build1.

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

set -e

is_old() {
	RES=1
	# if no such file, exit with false (1 in bash)
	if [ -f ${LOCKSFILE} ]; then
		TEMP_FILE=`mktemp`
		cat ${LOCKSFILE} | sed '/^\#.*/ d;/.*:.*/d;/^[^[a-zA-Z\*?.0-9]*$/d' > ${TEMP_FILE}
		if [ -s ${TEMP_FILE} ]; then
			RES=0
		else
			RES=1
		fi
	fi
	rm -f ${TEMP_FILE}
	return ${RES}
}

append_new_lock(){
	case "$#" in
		1 )
			echo "
solvable_name: $1
match_type: glob
" >> ${LOCKSFILE}
		;;
		2 ) #TODO version
			echo "
solvable_name: $1
match_type: glob
version: $2
" >> ${LOCKSFILE}
		;;
		3 ) #TODO version
			echo "
solvable_name: $1
match_type: glob
version: $2 $3
" >> ${LOCKSFILE}
		;;
	esac
}

die() {
	echo $1
	exit 1
}

# We exit unless the package is being configured
case "$1" in
	abort*upgrade)
		exit 0
		;;
	abort*remove)
		exit 0
		;;
	abort*deconfigure)
		exit 0
		;;
	configure)
		if [ -f /var/cache/zypp/zypp.db ]; then rm /var/cache/zypp/zypp.db; fi
			# convert old lock file to new
			# TODO make this a separate file?
			# TODO run the sript only when updating form pre-11.0 libzypp versions
			LOCKSFILE=/etc/zypp/locks
			OLDLOCKSFILE=/etc/zypp/locks.old

			if is_old ${LOCKSFILE}; then
				mv -f ${LOCKSFILE} ${OLDLOCKSFILE} || die "cannot backup old locks"
				cat ${OLDLOCKSFILE} | sed "/^\#.*/d"| while read line; do
					append_new_lock $line
				done
			fi
		;;
	*)
		exit 0;
		;;
esac