summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-10-03 16:04:14 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-10-03 16:04:14 +0000
commit64308004a3bae593842b9b8017b6b19e7da8848c (patch)
treebd83471636ae9c5f79e1311546abeb5529abac70
parent99bd4eca6049d61697011df7a38538175c146dc5 (diff)
downloaddrakx-backup-do-not-use-64308004a3bae593842b9b8017b6b19e7da8848c.tar
drakx-backup-do-not-use-64308004a3bae593842b9b8017b6b19e7da8848c.tar.gz
drakx-backup-do-not-use-64308004a3bae593842b9b8017b6b19e7da8848c.tar.bz2
drakx-backup-do-not-use-64308004a3bae593842b9b8017b6b19e7da8848c.tar.xz
drakx-backup-do-not-use-64308004a3bae593842b9b8017b6b19e7da8848c.zip
- use /dev/cdrom in fstab, and write corresponding udev rule
(the rules were generated at boot time but here we ensure consistent naming)
-rw-r--r--perl-install/fs/any.pm29
-rw-r--r--perl-install/install/NEWS2
-rw-r--r--perl-install/install/steps.pm1
3 files changed, 32 insertions, 0 deletions
diff --git a/perl-install/fs/any.pm b/perl-install/fs/any.pm
index 03abd0573..08886fde3 100644
--- a/perl-install/fs/any.pm
+++ b/perl-install/fs/any.pm
@@ -50,6 +50,35 @@ sub write_hds {
@$fstab = fs::get::fstab($all_hds);
}
+sub set_cdrom_symlink_udev_rule {
+ my ($raw_hds) = @_;
+
+ my $cdrom_helper = '/lib/udev/cdrom_helper';
+ -x "$::prefix$cdrom_helper" or return;
+
+ my $udev_rule = "$::prefix/etc/udev/rules.d/61-block_config.rules";
+ if (-e $udev_rule) {
+ log::l("cleaning $udev_rule from previous cdrom symlink rules");
+ substInFile { $_ = '' if /SYMLINK\+="cdrom/ } $udev_rule;
+ }
+
+ foreach (grep { $_->{media_type} eq 'cdrom' } @$raw_hds) {
+ my @env = (
+ 'SUBSYSTEM=block',
+ run_program::rooted_get_stdout($::prefix, '/lib/udev/path_id', "/block/$_->{device}"),
+ run_program::rooted_get_stdout($::prefix, '/lib/udev/cdrom_id', "/dev/$_->{device}"),
+ );
+ local %ENV = (%ENV, map { if_(/(.*?)=(.*)/, $1 => $2) } @env);
+
+ log::l("calling $cdrom_helper with ID_PATH=$ENV{ID_PATH}");
+ my ($alias) = run_program::rooted_get_stdout($::prefix, $cdrom_helper) =~ /(\w+)/;
+
+ log::l("using alias $alias for $_->{device}");
+ $_->{device_alias} = $alias;
+ symlink($_->{device}, "$::prefix/dev/$alias");
+ }
+}
+
sub check_hds_boot_and_root {
my ($all_hds, $fstab) = @_;
fs::get::root_($fstab) or die "Oops, no root partition";
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index 32c851501..705c06ef2 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,3 +1,5 @@
+- use /dev/cdrom in fstab, and write corresponding udev rule
+ (the rules were generated at boot time but here we ensure consistent naming)
- 2008 logo
- bootloader:
o if there is a /boot, check /boot instead of "/" to allow grub or not
diff --git a/perl-install/install/steps.pm b/perl-install/install/steps.pm
index b29697d05..0d4b17558 100644
--- a/perl-install/install/steps.pm
+++ b/perl-install/install/steps.pm
@@ -460,6 +460,7 @@ Consoles 1,3,4,7 may also contain interesting information";
#- for mandrake_firstime
touch "$::prefix/var/lock/TMP_1ST";
+ fs::any::set_cdrom_symlink_udev_rule($o->{all_hds}{raw_hds});
any::config_mtools($::prefix);
#- make sure wins is disabled in /etc/nsswitch.conf