summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2008-11-04 11:55:15 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2008-11-04 11:55:15 +0100
commit7a7492830119e022148c2b8ce4220dc1f26f7de7 (patch)
treedfd701d9eb3df4959577a210c45e9911adf19b55
parent24f41a0111b553a5a70f36f5bb30a2f3084d1585 (diff)
more failsafe disk editing in dieters script
-rw-r--r--unofficial/modules/dieter/procedures/automatic9
1 files changed, 7 insertions, 2 deletions
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