File: crypto_aptinstall

package info (click to toggle)
partman-crypto 88
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,740 kB
  • ctags: 58
  • sloc: sh: 1,689; ansic: 132; makefile: 20
file content (39 lines) | stat: -rwxr-xr-x 870 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

# Installs userspace tools and helper packages in the target system.
#

. /lib/partman/lib/base.sh

dm_crypt=no

for dev in $DEVICES/*; do
	[ -d "$dev" ] || continue
	cd $dev
	open_dialog PARTITIONS
	while { read_line num id size type fs path name; [ "$id" ]; }; do
		[ "$fs" != free ] || continue
		[ -f $id/method ] || continue
		[ -f $id/crypto_type ] || continue

		method=$(cat $id/method)
		[ $method = crypto ] || continue

		type=$(cat $id/crypto_type)
		case $type in
			dm-crypt)
				dm_crypt=yes
				;;
		esac
	done
	close_dialog
done

if grep -q " device-mapper$" /proc/misc; then
    # We can't check the root node directly because root could be
    # on an LVM LV on top of an encrypted device
    if type dmsetup >/dev/null 2>&1 && \
	   dmsetup table | cut -d' ' -f4 | grep -q "crypt" 2>/dev/null; then
		apt-install cryptsetup || true
	fi
fi