From c0a040041ce8489ce909a0e88275676935978df3 Mon Sep 17 00:00:00 2001 From: Vladimir Sokolovsky Date: Thu, 31 Mar 2011 18:07:00 +0200 Subject: [PATCH] install.pl: Grant non root users read/write permission for umad devices instead of default Signed-off-by: Vladimir Sokolovsky --- install.pl | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/install.pl b/install.pl index 0502e7b..d5dbb5f 100755 --- a/install.pl +++ b/install.pl @@ -83,6 +83,7 @@ my $kernel = `uname -r`; chomp $kernel; my $kernel_sources = "/lib/modules/$kernel/build"; chomp $kernel_sources; +my $ib_udev_rules = "/etc/udev/rules.d/90-ib.rules"; my $PACKAGE = 'OFED'; @@ -255,6 +256,7 @@ sub usage print "\n -q Set quiet - no messages will be printed"; print "\n --force Force uninstall RPM coming with Distribution"; print "\n --builddir Change build directory. Default: $builddir"; + print "\n --umad-dev-rw Grant non root users read/write permission for umad devices instead of default"; print "\n\n --all|--hpc|--basic Install all,hpc or basic packages correspondingly"; print RESET "\n\n"; } @@ -1367,7 +1369,7 @@ my $mvapich2_comp_env; my $mvapich2_dat_lib; my $mvapich2_dat_include; my $mvapich2_conf_done = 0; - +my $umad_dev_rw = 0; my $config_given = 0; my $config_net_given = 0; my $kernel_given = 0; @@ -1409,6 +1411,8 @@ while ( $#ARGV >= 0 ) { } elsif ( $cmd_flag eq "--basic" ) { $interactive = 0; $install_option = 'basic'; + } elsif ( $cmd_flag eq "--umad-dev-rw" ) { + $umad_dev_rw = 1; } elsif ( $cmd_flag eq "--build32" ) { if (supported32bit()) { $build32 = 1; @@ -4486,6 +4490,28 @@ sub main check_pcie_link(); } + if ($umad_dev_rw) { + if (-f $ib_udev_rules) { + open(IB_UDEV_RULES, $ib_udev_rules) or die "Can't open $ib_udev_rules: $!"; + my @ib_udev_rules_lines; + while () { + push @ib_udev_rules_lines, $_; + } + close(IPV6); + + open(IB_UDEV_RULES, ">$ib_udev_rules") or die "Can't open $ib_udev_rules: $!"; + foreach my $line (@ib_udev_rules_lines) { + chomp $line; + if ($line =~ /umad/) { + print IB_UDEV_RULES "$line, MODE=\"0666\"\n"; + } else { + print IB_UDEV_RULES "$line\n"; + } + } + close(IB_UDEV_RULES); + } + } + print GREEN "\nInstallation finished successfully.", RESET; if ($interactive) { print GREEN "\nPress any key to continue...", RESET; -- 2.41.0