summaryrefslogtreecommitdiffstats
path: root/debian/cryptsetup.preinst
blob: 2e5a7fc1ef135275a01c3ff6a5085283cb76f666 (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
#!/bin/sh

set -e

if [ "$1" = install ] && [ ! -f "/etc/crypttab" ]; then
	cat <<-EOC >/etc/crypttab
	# <target name>	<source device>		<key file>	<options>
	EOC
fi

# begin-remove-after: released:forky
if [ "$1" = "upgrade" ] || [ "$1" = install ]; then
	if [ "$(dpkg-divert --truename /lib/cryptsetup/askpass)" = /lib/cryptsetup/askpass.cryptsetup ] &&
		[ "$(dpkg-divert --listpackage /lib/cryptsetup/askpass)" = cryptsetup-nuke-password ] &&
		[ "$(dpkg-divert --truename /usr/lib/cryptsetup/askpass)" = /usr/lib/cryptsetup/askpass ]; then
		# A pre-/usr-merge cryptsetup-nuke-password is installed.
		echo "Mitigating diversion of /lib/cryptsetup/askpass on behalf of cryptsetup-nuke-password"
		dpkg-divert --no-rename --package cryptsetup-nuke-password \
			    --divert /usr/lib/cryptsetup/askpass.usr-is-merged \
			    --add /usr/lib/cryptsetup/askpass
	fi
fi
# end-remove-after

#DEBHELPER#

exit 0