summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-08-31 16:33:16 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-08-31 16:33:16 +0000
commita6ba2f19bd2dd6d99185cb0f5ba0dd97baaf130d (patch)
treecd7cedd073f1494500f4f69a63f0f63e9af673a7 /perl-install
parentb18b20791cfce5c52a8fb20f2579449b6500da24 (diff)
downloaddrakx-backup-do-not-use-a6ba2f19bd2dd6d99185cb0f5ba0dd97baaf130d.tar
drakx-backup-do-not-use-a6ba2f19bd2dd6d99185cb0f5ba0dd97baaf130d.tar.gz
drakx-backup-do-not-use-a6ba2f19bd2dd6d99185cb0f5ba0dd97baaf130d.tar.bz2
drakx-backup-do-not-use-a6ba2f19bd2dd6d99185cb0f5ba0dd97baaf130d.tar.xz
drakx-backup-do-not-use-a6ba2f19bd2dd6d99185cb0f5ba0dd97baaf130d.zip
- support for UUID (including UUID=xxx in fstab)
(not by default for now)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/NEWS3
-rw-r--r--perl-install/diskdrake/interactive.pm4
-rw-r--r--perl-install/fs.pm6
-rw-r--r--perl-install/fs/format.pm4
-rw-r--r--perl-install/fs/get.pm1
-rw-r--r--perl-install/fs/mount.pm2
-rw-r--r--perl-install/fs/type.pm1
-rw-r--r--perl-install/fs/wild_device.pm7
-rw-r--r--perl-install/fsedit.pm4
-rw-r--r--perl-install/install/NEWS1
10 files changed, 30 insertions, 3 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index ff8f6a396..c51679a49 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,3 +1,6 @@
+- diskdrake
+ o support for UUID in filesystems (and UUID=... in fstab)
+
Version 10.4.183 - 31 August 2007, by Pascal "Pixel" Rigaux
- bootloader-config
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index 9f3413dae..6bc390f0f 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -35,7 +35,10 @@ struct part {
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
+ string device_UUID # volume UUID. UUID=xxx or /dev/disk/by-uuid/xxx can be used in fstab instead of the device
bool prefer_device_LABEL # should the {device_LABEL} or the {device} be used in fstab
+ bool prefer_device_UUID # should the {device_UUID} or the {device} be used in fstab
+ 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
string rootDevice # 'sda', 'hdc' ... (can also be a VG_name)
@@ -1235,6 +1238,7 @@ sub format_part_info {
$info .= N("Mount point: ") . "$part->{mntpoint}\n" if $part->{mntpoint};
$info .= N("Device: ") . "$part->{device}\n" if $part->{device} && !isLoopback($part);
$info .= N("Volume label: ") . "$part->{device_LABEL}\n" if $part->{device_LABEL} && $::expert;
+ $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};
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 15de5228d..bdb364896 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -22,7 +22,7 @@ sub read_fstab {
my ($prefix, $file, @reading_options) = @_;
if (member('keep_default', @reading_options)) {
- push @reading_options, 'freq_passno', 'keep_device_LABEL';
+ push @reading_options, 'freq_passno', 'keep_device_LABEL', 'keep_device_UUID';
}
my %comments;
@@ -85,6 +85,10 @@ sub read_fstab {
if ($h->{device_LABEL} && !$h->{device_alias} && member('keep_device_LABEL', @reading_options)) {
$h->{prefer_device_LABEL} = 1;
+ } elsif ($h->{device_UUID} && !$h->{device_alias} && member('keep_device_UUID', @reading_options)) {
+ $h->{prefer_device_UUID} = 1;
+ } else {
+ $h->{prefer_device} = 1;
}
if ($h->{options} =~ /credentials=/ && !member('verbatim_credentials', @reading_options)) {
diff --git a/perl-install/fs/format.pm b/perl-install/fs/format.pm
index 136581583..42a92335b 100644
--- a/perl-install/fs/format.pm
+++ b/perl-install/fs/format.pm
@@ -128,6 +128,10 @@ sub part_raw {
disable_forced_fsck($dev);
}
+ delete $part->{UUID_from_magic};
+ fs::type::type_subpart_from_magic($part);
+ $part->{device_UUID} = $part->{UUID_from_magic};
+
set_isFormatted($part, 1);
}
diff --git a/perl-install/fs/get.pm b/perl-install/fs/get.pm
index 0cdb55969..aa23d1c61 100644
--- a/perl-install/fs/get.pm
+++ b/perl-install/fs/get.pm
@@ -143,6 +143,7 @@ sub is_same_hd {
$s1 eq $s2;
} else {
$hd1->{device_LABEL} && $hd2->{device_LABEL} && $hd1->{device_LABEL} eq $hd2->{device_LABEL}
+ || $hd1->{device_UUID} && $hd2->{device_UUID} && $hd1->{device_UUID} eq $hd2->{device_UUID}
|| $hd1->{device} && $hd2->{device} && $hd1->{device} eq $hd2->{device};
}
}
diff --git a/perl-install/fs/mount.pm b/perl-install/fs/mount.pm
index f22283573..950eb1715 100644
--- a/perl-install/fs/mount.pm
+++ b/perl-install/fs/mount.pm
@@ -125,7 +125,7 @@ sub umount {
sub part {
my ($part, $b_rdonly, $o_wait_message) = @_;
- log::l("mount_part: " . join(' ', map { "$_=$part->{$_}" } 'device', 'mntpoint', 'isMounted', 'real_mntpoint'));
+ log::l("mount_part: " . join(' ', map { "$_=$part->{$_}" } 'device', 'mntpoint', 'isMounted', 'real_mntpoint', 'device_UUID'));
return if $part->{isMounted} && !($part->{real_mntpoint} && $part->{mntpoint});
diff --git a/perl-install/fs/type.pm b/perl-install/fs/type.pm
index 79a89e819..40e3db41e 100644
--- a/perl-install/fs/type.pm
+++ b/perl-install/fs/type.pm
@@ -280,6 +280,7 @@ sub type_subpart_from_magic {
my $ids = call_vol_id($part);
$part->{LABEL_from_magic} = $ids->{ID_FS_LABEL} if $ids->{ID_FS_LABEL};
+ $part->{UUID_from_magic} = $ids->{ID_FS_UUID} if $ids->{ID_FS_UUID};
my $p;
if ($ids->{ID_FS_USAGE} eq 'raid') {
diff --git a/perl-install/fs/wild_device.pm b/perl-install/fs/wild_device.pm
index dea15a4d3..ebb391cdf 100644
--- a/perl-install/fs/wild_device.pm
+++ b/perl-install/fs/wild_device.pm
@@ -15,6 +15,8 @@ sub analyze {
'dev', "/dev/$dev";
} elsif ($dev =~ /^LABEL=(.*)/) {
'label', $1;
+ } elsif ($dev =~ /^UUID=(.*)/) {
+ 'uuid', $1;
} elsif ($dev eq 'none' || $dev eq 'rootfs') {
'virtual';
} elsif ($dev =~ m!^(\S+):/\w!) {
@@ -34,6 +36,8 @@ sub to_subpart {
if (my ($kind, $val) = analyze($dev)) {
if ($kind eq 'label') {
$part->{device_LABEL} = $val;
+ } elsif ($kind eq 'label') {
+ $part->{device_UUID} = $val;
} elsif ($kind eq 'dev') {
my %part = (faked_device => 0);
if (my $rdev = (stat "$::prefix$dev")[6]) {
@@ -51,6 +55,7 @@ sub to_subpart {
}
if ($keep) {
$part{device_LABEL} = $1 if $dev =~ m!^disk/by-label/(.*)!;
+ $part{device_UUID} = $1 if $dev =~ m!^disk/by-uuid/(.*)!;
$part{device_alias} = $dev;
$dev = $symlink;
}
@@ -78,6 +83,8 @@ sub from_part {
'LABEL=' . $part->{device_LABEL};
} elsif ($part->{device_alias}) {
"/dev/$part->{device_alias}";
+ } elsif ($part->{prefer_device_UUID} && $part->{device_UUID}) {
+ 'UUID=' . $part->{device_UUID};
} else {
my $faked_device = exists $part->{faked_device} ?
$part->{faked_device} :
diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm
index 64e57c345..f202d0ef4 100644
--- a/perl-install/fsedit.pm
+++ b/perl-install/fsedit.pm
@@ -260,6 +260,7 @@ Do you agree to lose all the partitions?
$_->{bad_fs_type_magic} = 1;
}
$_->{device_LABEL} = $_->{LABEL_from_magic} if $_->{LABEL_from_magic};
+ $_->{device_UUID} = $_->{UUID_from_magic} if $_->{UUID_from_magic};
}
if ($hd->{usb_media_type}) {
@@ -380,7 +381,8 @@ sub suggest_part {
$part->{mntpoint} = $best->{mntpoint};
fs::type::set_type_subpart($part, $best) if !isTrueFS($best) || !isTrueFS($part);
$part->{size} = computeSize($part, $best, $all_hds, \@local_suggestions);
- foreach ('options', 'lv_name', 'encrypt_key', 'device_LABEL', 'prefer_device_LABEL', 'primaryOrExtended') {
+ foreach ('options', 'lv_name', 'encrypt_key', 'primaryOrExtended',
+ 'device_LABEL', 'prefer_device_LABEL', 'device_UUID', 'prefer_device_UUID', 'prefer_device') {
$part->{$_} = $best->{$_} if $best->{$_};
}
$best;
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index a2eb1d548..53d96e34e 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,3 +1,4 @@
+- support for UUID (including UUID=xxx in fstab)
- do not set relatime option for mounting nfs
- nicely adjust mtime of fontconfig cache files