/bin/autopartition-crypto is in ubiquity 2.21.63.
This file is owned by root:root, with mode 0o755.
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 | #!/bin/sh
. /lib/partman/lib/auto-lvm.sh
. /lib/partman/lib/crypto-base.sh
dev="$1"
method=crypto
# Ensure we have no (pre-existing) partitions marked as swap as they'd
# trigger the unsafe_swap test.
clean_method
auto_lvm_prepare $dev $method || exit $?
found=no
for dev in $DEVICES/*; do
[ -d "$dev" ] || continue
cd $dev
partitions=
open_dialog PARTITIONS
while { read_line num id size type fs path name; [ "$id" ]; }; do
if [ "$fs" != free ]; then
partitions="$partitions $id"
fi
done
close_dialog
for id in $partitions; do
[ -f $id/method ] || continue
method=$(cat $id/method)
[ $method = crypto ] || continue
echo dm-crypt > $id/crypto_type
crypto_prepare_method "$dev/$id" dm-crypt || exit 1
found=yes
break
done
[ $found = yes ] && break
done
crypto_check_setup || exit 1
crypto_setup no || exit 1
# Fix method on PVs now that the crypto devices have been created
# ($pv_devices has been properly set by auto_lvm_prepare)
for pv in $pv_devices; do
dev="$(dev_to_partman $pv)"
[ -d "$dev" ] || continue
[ -f "$dev/crypt_realdev" ] || continue
[ -f "$dev/device" ] || continue
# We should have only one partition, but lets be thorough
cd $dev
partitions=
open_dialog PARTITIONS
while { read_line num id size type fs path name; [ "$id" ]; }; do
[ "$fs" != free ] || continue
partitions="$partitions $id"
done
close_dialog
for id in $partitions; do
for file in acting_filesystem filesystem format formatable use_filesystem; do
rm -f $id/$file
done
echo lvm > $id/method
done
done
auto_lvm_perform || exit 1
# partman likes to believe that the virtual devices have a changed
# partition table
for dev in $DEVICES/*; do
cd $dev
open_dialog DISK_UNCHANGED
close_dialog
done
|