From ed4c5d4ab52d1a5a3062392efc04a05a202b4ecc Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sat, 20 Jul 2002 20:43:55 +0000 Subject: try very hard to make rdvd work: - if not using devfs, it worked so keeping things unchanged - if using devfs, using the new dynamic rawdevice.script script to bind a rawdevice on demand pb: can't have both a devfs and a non-devfs config, the /etc/sysconfig/rawdevices solution gives errors with devfs (since the dvd is not REGISTERed yet) --- perl-install/any.pm | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'perl-install') diff --git a/perl-install/any.pm b/perl-install/any.pm index e78411e3c..e28084f4e 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -956,6 +956,19 @@ sub devfssymlinkf { UNREGISTER ^$devfs_if\$ CFUNCTION GLOBAL unlink $of "); } +sub devfs_rawdevice { + my ($o_if, $of, $prefix) = @_; + + my $devfs_if = $o_if->{devfs_device}; + $devfs_if ||= devices::to_devfs($o_if->{device}); + $devfs_if ||= $o_if->{device}; + + output_p("$prefix/etc/devfs/conf.d/$of.conf", +"REGISTER ^$devfs_if\$ EXECUTE /etc/dynamic/scripts/rawdevice.script add /dev/$devfs_if /dev/$of +UNREGISTER ^$devfs_if\$ EXECUTE /etc/dynamic/scripts/rawdevice.script del /dev/$of +"); +} + sub fileshare_config { my ($in, $type) = @_; #- $type is 'nfs', 'smb' or '' @@ -1138,16 +1151,23 @@ sub alloc_raw_device { } sub config_dvd { - my ($prefix) = @_; - if (my @dvds = grep { detect_devices::isDvdDrive($_) } detect_devices::cdroms__faking_ide_scsi()) { - log::l("configuring DVD"); - #- create /dev/dvd symlink - each_index { - devfssymlinkf($_, 'dvd' . ($::i ? $::i + 1 : ''), $prefix); - } @dvds; - if (my $raw_dev = alloc_raw_device($prefix, 'dvd')) { - devfssymlinkf({ device => $raw_dev }, 'rdvd', $prefix); - } + my ($prefix, $have_devfsd) = @_; + + #- can't have both a devfs and a non-devfs config + #- the /etc/sysconfig/rawdevices solution gives errors with devfs + + my @dvds = grep { detect_devices::isDvdDrive($_) } detect_devices::cdroms__faking_ide_scsi() or return; + + log::l("configuring DVD"); + #- create /dev/dvd symlink + each_index { + devfssymlinkf($_, 'dvd' . ($::i ? $::i + 1 : ''), $prefix); + devfs_rawdevice($_, 'rdvd' . ($::i ? $::i + 1 : ''), $prefix) if $have_devfsd; + } @dvds; + + if (!$have_devfsd) { + my $raw_dev = alloc_raw_device($prefix, 'dvd'); + symlink($raw_dev, "$prefix/dev/rdvd"); } } -- cgit v1.2.1