summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakupdate_fstab
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-09-21 11:48:28 +0000
committerOlivier Blin <oblin@mandriva.com>2007-09-21 11:48:28 +0000
commitcac7d455fe86e2cf5c524f1c8101c85e67fcf2b0 (patch)
tree18dfa1fc68ee53d4a8afc5505b15360e6d41f73a /perl-install/standalone/drakupdate_fstab
parent58f7e07eacda17f8cb2cb8ef18ed2b8e6a2db86d (diff)
downloaddrakx-backup-do-not-use-cac7d455fe86e2cf5c524f1c8101c85e67fcf2b0.tar
drakx-backup-do-not-use-cac7d455fe86e2cf5c524f1c8101c85e67fcf2b0.tar.gz
drakx-backup-do-not-use-cac7d455fe86e2cf5c524f1c8101c85e67fcf2b0.tar.bz2
drakx-backup-do-not-use-cac7d455fe86e2cf5c524f1c8101c85e67fcf2b0.tar.xz
drakx-backup-do-not-use-cac7d455fe86e2cf5c524f1c8101c85e67fcf2b0.zip
allow to configure harddisks
Diffstat (limited to 'perl-install/standalone/drakupdate_fstab')
-rwxr-xr-xperl-install/standalone/drakupdate_fstab40
1 files changed, 17 insertions, 23 deletions
diff --git a/perl-install/standalone/drakupdate_fstab b/perl-install/standalone/drakupdate_fstab
index cbc182c5c..62db7b691 100755
--- a/perl-install/standalone/drakupdate_fstab
+++ b/perl-install/standalone/drakupdate_fstab
@@ -55,20 +55,6 @@ my ($action) = $raw_action =~ /^--(add|del)/;
main($action, $device_name);
-
-sub check_hard_drives {
- my ($name) = @_;
-
- #- do not do anything if there are many partitions
- #- otherwise we may add main extended partitions
- if (my ($path, $prefix) = $name =~ m!^(.*)/(\w+)\d+$!) {
- my @parts = grep { /^\Q$prefix\E\d+$/ } all($path);
- @parts <= 1;
- } else {
- 1;
- }
-}
-
sub device_name_to_entry {
my ($name) = @_;
$name =~ s|/dev/||;
@@ -107,9 +93,9 @@ sub set_options {
}
sub set_mount_point {
- my ($part, $fstab) = @_;
+ my ($part, $fstab, $is_hd) = @_;
- my $mntpoint = detect_devices::suggest_mount_point($part) or return;
+ my $mntpoint = $is_hd ? 'hd' : detect_devices::suggest_mount_point($part);
$mntpoint = "/media/$mntpoint";
foreach ('', 2 .. 10) {
@@ -121,13 +107,21 @@ sub set_mount_point {
}
sub main {
- my ($action, $device_name) = @_;
-
- if ($::auto) {
- check_hard_drives($device_name) or return;
+ my ($action, $device_name) = @_;
+ my $device = device_name_to_entry($device_name);
+ if ($device->{media_type} eq 'hd') {
+ my $all_hds = fsedit::get_hds();
+ my $hd = find { fs::get::is_same_hd($_, $device) } fs::get::hds($all_hds);
+ $hd or die "unable to find hd for $device->{device}";
+ my @parts = grep { !fsedit::isSwap($_) } partition_table::get_normal_parts($hd);
+ configure_part($action, $_, 'hd') foreach @parts;
+ } else {
+ configure_part($action, $device, undef);
}
+}
- my $part = device_name_to_entry($device_name);
+sub configure_part {
+ my ($action, $part, $is_hd) = @_;
my $fstab_file = '/etc/fstab';
if (!$part) {
print STDERR "Can not find device $device_name\n" if $::testing;
@@ -151,12 +145,12 @@ sub main {
}
my %dynamic = getVarsFromSh('/etc/sysconfig/dynamic');
set_options($part, to_bool($dynamic{SYNC} ne 'no'));
- set_mount_point($part, $fstab) or return;
+ set_mount_point($part, $fstab, $is_hd) or return;
my ($line) = fs::prepare_write_fstab([$part]);
if ($line) {
append_to_file($fstab_file, $line);
- system("mount $part->{mntpoint}") if !$::testing && $device_name =~ /^fd\d+/;
+ system("mount $part->{mntpoint}") if !$::testing && ($device_name =~ /^fd\d+/ || $is_hd);
}
if ($::auto) {