From bfa93035dd1ca93131b2b0dd86303cf0f8cc9ea1 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 29 Jul 2004 05:42:03 +0000 Subject: handle formatkey which clean_partition_table_and_format_key --- move/move.pm | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'move') diff --git a/move/move.pm b/move/move.pm index f59c22a60..9c4749ec2 100644 --- a/move/move.pm +++ b/move/move.pm @@ -206,8 +206,14 @@ sub init { install_steps::setupSCSI($o); run_program::run('sysctl', '-w', 'kernel.hotplug=/sbin/hotplug'); - key_mount($o); - cat_('/proc/cmdline') =~ /\bcleankey\b/ and eval { rm_rf $key_sysconf, glob_('/home/.mdkmove*') }; + if (cat_('/proc/cmdline') =~ /\bformatkey\b/) { + #- waiting until X is launched + } else { + key_mount($o); + } + if (cat_('/proc/cmdline') =~ /\bcleankey\b/) { + eval { rm_rf $key_sysconf, glob_('/home/.mdkmove*') }; + } key_installfiles('simple'); setup_userconf($o); if (-f '/etc/X11/X') { @@ -280,6 +286,22 @@ sub handleI18NClp { lomount_clp("always_$clp_name", '/usr'); } +sub clean_partition_table_and_format_key { + my ($in) = @_; + my @keys = grep { detect_devices::isKeyUsb($_) } detect_devices::getSCSI(); + my $key = $in->ask_from_listf('', "Which key?", + sub { "$_->{usb_description} ($_->{device})" }, + \@keys); + $key->{prefix} ||= $key->{device}; + add2hash_($key, partition_table::raw::get_geometry($key->{file} = devices::make($key->{device}))); + partition_table::raw::zero_MBR($key); + my ($part) = partition_table::get_normal_parts_and_holes($key); + $part->{type} = 0xb; + partition_table::add($key, $part); + partition_table::write($key); + fs::real_format_part($part); +} + sub key_parts { my ($o) = @_; @@ -479,6 +501,11 @@ sub install2::verifyKey { log::l("automatic transparent key support is disabled"), return if $key_disabled; + if (cat_('/proc/cmdline') =~ /\bformatkey\b/) { + clean_partition_table_and_format_key($o); + key_mount($o, 'reread'); + } + check_key($o) or return; my $_wait = $using_existing_host_config -- cgit v1.2.1