From 7a7492830119e022148c2b8ce4220dc1f26f7de7 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 4 Nov 2008 11:55:15 +0100 Subject: more failsafe disk editing in dieters script --- unofficial/modules/dieter/procedures/automatic | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'unofficial') diff --git a/unofficial/modules/dieter/procedures/automatic b/unofficial/modules/dieter/procedures/automatic index de07432..09269b5 100644 --- a/unofficial/modules/dieter/procedures/automatic +++ b/unofficial/modules/dieter/procedures/automatic @@ -35,13 +35,18 @@ phase_finish () worker_prepare_disks () { + modprobe dm-crypt || die_error "Cannot modprobe dm-crypt" + modprobe -q aes-x86-64 || modprobe aes-i586 || die_error "Cannot modprobe aes-x86-64 or aes-i586" + + # Cleanup whatever state the disk is in (that includes previous, failed runs of this script) + cryptsetup luksClose sda2_crypt 2>/dev/null + dd if=/dev/urandom of=/dev/sda bs=512 count=1 + #TODO: integrate this stuff into the functions in the libs + do error checking and handling sfdisk /dev/sda 2>&1 | grep -v 'not have an msdos signature' << EOF ,10,L,* ,,L EOF - modprobe dm-crypt || die_error "Cannot modprobe dm-crypt" - modprobe -q aes-x86-64 || modprobe aes-i586 || die_error "Cannot modprobe aes-x86-64 or aes-i586" cryptsetup --batch-mode -c aes-xts-plain -y -s 512 luksFormat /dev/sda2 cryptsetup luksOpen /dev/sda2 sda2_crypt pvcreate /dev/mapper/sda2_crypt -- cgit v1.2.3-54-g00ecf