summaryrefslogtreecommitdiffstats
path: root/perl-install/diskdrake/interactive.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/diskdrake/interactive.pm')
-rw-r--r--perl-install/diskdrake/interactive.pm103
1 files changed, 51 insertions, 52 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index 8a4d9bb9c..9356a1930 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -1,4 +1,4 @@
-package diskdrake::interactive; # $Id: interactive.pm 269771 2010-06-03 11:50:24Z pterjan $
+package diskdrake::interactive;
use diagnostics;
use strict;
@@ -21,18 +21,16 @@ use any;
use log;
-=begin
-
=head1 SYNOPSYS
-struct part {
+ struct part {
int active # one of { 0 | 0x80 } x86 only, primary only
int start # in sectors
int size # in sectors
int pt_type # 0x82, 0x83, 0x6 ...
string fs_type # 'ext2', 'nfs', ...
string type_name # 'Linux RAID', 'Linux Logical Volume Manager', ...
-
+
int part_number # 1 for hda1...
string device # 'hda5', 'sdc1' ...
string device_LABEL # volume label. LABEL=xxx or /dev/disk/by-label/xxx can be used in fstab instead of the device
@@ -42,7 +40,7 @@ struct part {
bool prefer_device # should the {device} be used in fstab
bool faked_device # false if {device} is a real device, true for nfs/smb/dav/none devices. If the field does not exist, we do not know
bool device_LABEL_changed # true if device_LABEL is different from the one on the disk
-
+
string rootDevice # 'sda', 'hdc' ... (can also be a VG_name)
string real_mntpoint # directly on real /, '/tmp/hdimage' ...
string mntpoint # '/', '/usr' ...
@@ -51,32 +49,32 @@ struct part {
string encrypt_key # [0-9A-Za-z./]{20,}
string comment # comment to have in fstab
string volume_label #
-
+
bool is_removable # is the partition on a removable drive
bool isMounted
-
+
bool isFormatted
bool notFormatted
# isFormatted means the device is formatted
# !isFormatted && notFormatted means the device is not formatted
# !isFormatted && !notFormatted means we do not know which state we're in
-
+
string raid # for partitions of type isRawRAID and which isPartOfRAID, the raid device
string lvm # partition used as a PV for the VG with {lvm} as VG_name #-#
loopback loopback[] # loopback living on this partition
-
+
string dmcrypt_key
string dm_name
bool dm_active
-
+
# internal
string real_device # '/dev/loop0', '/dev/loop1' ... (used for encrypted loopback)
-
+
# internal CHS (Cylinder/Head/Sector)
int start_cyl, start_head, start_sec, end_cyl, end_head, end_sec,
}
-struct part_allocate inherits part {
+ struct part_allocate inherits part {
int maxsize # in sectors (alike "size")
int min_hd_size # in sectors (do not allocate if the drive is smaller than the given size)
int ratio #
@@ -84,44 +82,44 @@ struct part_allocate inherits part {
string parts # for creating raid partitions. eg: 'foo bar' where 'foo' and 'bar' are mntpoint
}
-struct part_raid inherits part {
+ struct part_raid inherits part {
string chunk-size # in KiB, usually '64'
string level # one of { 0, 1, 4, 5, 'linear' }
string UUID
-
+
part disks[]
-
+
# invalid: active, start, rootDevice, device_windobe?, CHS
}
-struct part_dmcrypt inherits part {
+ struct part_dmcrypt inherits part {
string dmcrypt_name
-
+
# rootDevice is special here: it is the device hosting the dm
}
-struct part_loopback inherits part {
+ struct part_loopback inherits part {
string loopback_file # absolute file name which is relative to the partition
part loopback_device # where the loopback file live
-
+
# device is special here: it is the absolute filename of the loopback file.
-
+
# invalid: active, start, rootDevice, device_windobe, CHS
}
-struct part_lvm inherits part {
+ struct part_lvm inherits part {
# invalid: active, start, device_windobe, CHS
string lv_name
}
-struct partition_table_elem {
+ struct partition_table_elem {
part normal[] #
part extended # the main/next extended
part raw[4] # primary partitions
}
-struct geom {
+ struct geom {
int heads
int sectors
int cylinders
@@ -129,14 +127,14 @@ struct geom {
int start # always 0, forget it
}
-struct hd {
+ struct hd {
int totalsectors # size in sectors
string device # 'hda', 'sdc' ...
string device_alias # 'cdrom', 'floppy' ...
string media_type # one of { 'hd', 'cdrom', 'fd', 'tape' }
string capacity # contain of the strings of { 'burner', 'DVD' }
string info # name of the hd, eg: 'QUANTUM ATLAS IV 9 WLS'
-
+
bool readonly # is it allowed to modify the partition table
bool getting_rid_of_readonly_allowed # is it forbidden to write because the partition table is badly handled, or is it because we MUST not change the partition table
bool isDirty # does it need to be written to the disk
@@ -147,37 +145,37 @@ struct hd {
# - add an extended partition which is the first extended partition
list allPartitionsRenumbered # used to update bootloader configuration
int bus, id
-
+
bool is_removable # is it a removable drive
-
+
partition_table_elem primary
partition_table_elem extended[]
-
+
geom geom
-
+
# internal
string prefix # for some RAID arrays device=>c0d0 and prefix=>c0d0p
string file # '/dev/hda' ...
}
-struct hd_lvm inherits hd {
+ struct hd_lvm inherits hd {
int PE_size # block size (granularity, similar to cylinder size on x86)
string VG_name # VG name
-
+
part_lvm disks[]
-
+
# invalid: bus, id, extended, geom
}
-struct raw_hd inherits hd {
+ struct raw_hd inherits hd {
string fs_type # 'ext2', 'nfs', ...
string mntpoint # '/', '/usr' ...
string options # 'defaults', 'noauto'
-
+
# invalid: isDirty, will_tell_kernel, rebootNeeded, primary, extended
}
-struct all_hds {
+ struct all_hds {
hd hds[]
hd_lvm lvms[]
part_raid raids[]
@@ -188,7 +186,7 @@ struct all_hds {
raw_hd smbs[]
raw_hd davs[]
raw_hd special[]
-
+
# internal: if fstab_to_string($all_hds) eq current_fstab then no need to save
string current_fstab
}
@@ -602,9 +600,6 @@ sub Delete {
delete $part->{loopback_device}{loopback} if @$l == 0;
fsedit::recompute_loopbacks($all_hds);
} else {
- if (arch() =~ /ppc/) {
- undef $partition_table::mac::bootstrap_part if isAppleBootstrap($part) && ($part->{device} = $partition_table::mac::bootstrap_part);
- }
partition_table::remove($hd, $part);
warn_if_renumbered($in, $hd);
}
@@ -893,7 +888,7 @@ filesystem checks will be run on your next boot into Microsoft Windows®"));
mkdir_p($dir);
fs::mount::mount(devices::make($part->{device}), $dir, $part->{fs_type});
}
- if (!run_program::run("btrfsctl", "-r", $part->{size}*512, $dir)) {
+ if (!run_program::run(qw(btrfs filesystem resize), $part->{size}*512, $dir)) {
$nice_resize{btrfs} = undef;
if (!$part->{isMounted}) {
fs::mount::umount($dir);
@@ -954,8 +949,21 @@ sub dmcrypt_open {
delete $part->{dmcrypt_key};
die(($? >> 8) == 255 ? N("Invalid key") : $@);
}
- # Detect LVMs on top of dmcrypt
+ detect_lvms_on_dmcrypt($all_hds);
+}
+
+# Detect LVMs on top of dmcrypt
+sub detect_lvms_on_dmcrypt {
+ my ($all_hds) = @_,
+ require File::Temp;
+ require fs::dmcrypt;
+ my (undef, $tmp_file) = File::Temp::mkstemp('/tmp/crypttab.XXXXXXX');
+ fs::dmcrypt::save_crypttab_($all_hds, $tmp_file);
$all_hds->{lvms} = [ fsedit::lvms($all_hds) ];
+ fs::dmcrypt::read_crypttab_($all_hds, $tmp_file);
+ rm_rf($tmp_file);
+ require lvm;
+ lvm::detect_during_install() if $::isInstall;
}
sub Add2RAID {
@@ -1373,16 +1381,7 @@ sub format_part_info {
$info .= N("Volume label: ") . "$part->{device_LABEL}\n" if $part->{device_LABEL};
$info .= N("UUID: ") . "$part->{device_UUID}\n" if $::expert && $part->{device_UUID};
$info .= N("DOS drive letter: %s (just a guess)\n", $part->{device_windobe}) if $part->{device_windobe};
- if (arch() eq "ppc") {
- my $pType = $part->{pType};
- $pType =~ s/[^A-Za-z0-9_]//g;
- $info .= N("Type: ") . $pType . ($::expert ? sprintf " (0x%x)", $part->{pt_type} : '') . "\n";
- if (defined $part->{pName}) {
- my $pName = $part->{pName};
- $pName =~ s/[^A-Za-z0-9_]//g;
- $info .= N("Name: ") . $pName . "\n";
- }
- } elsif (isEmpty($part)) {
+ if (isEmpty($part)) {
$info .= N("Empty") . "\n";
} else {
$info .= N("Type: ") . (fs::type::part2type_name($part) || $part->{fs_type}) . ($::expert ? sprintf " (0x%x)", $part->{pt_type} : '') . "\n";