use File::Path;
use File::Find;
use File::Copy;
+use Cwd;
+use Term::ANSIColor qw(:constants);
# use Cwd;
sub usage
{
- print "\n Usage: $0 [-c <packages config_file>] [-n|--net <network config_file>]\n";
- print "\n [-k|--kernel <kernel version>]\n";
- print "\n";
+ print BLUE;
+ print "\n Usage: $0 [-c <packages config_file>] [-n|--net <network config_file>]";
+ print "\n [-p|--print-available <kernel version>]";
+ print "\n [-k|--kernel <kernel version>]";
+ print RESET . "\n\n";
}
$| = 1;
my $LOCK_EXCLUSIVE = 2;
my $UNLOCK = 8;
+#Setup some defaults
+my $KEY_ESC=27;
+my $KEY_CNTL_C=3;
+my $KEY_ENTER=13;
+
+my $INSTALL_CHOICE;
my $interactive = 1;
my $verbose = 0;
my $verbose2 = 0;
my $verbose3 = 0;
+my $print_available = 0;
+
+my $clear_string = `clear`;
+
+my $distro;
+
+my $build32 = 0;
+my $arch = `uname -m`;
+chomp $arch;
+my $kernel = `uname -r`;
+chomp $kernel;
+
+my $PACKAGE = 'OFED';
+
+my $WDIR = dirname($0);
+chdir $WDIR;
+my $CWD = getcwd;
+my $TMPDIR = '/tmp';
+my $netdir;
+
+# Define RPMs environment
+my $dist_rpm;
+if (-f "/etc/issue") {
+ $dist_rpm = `rpm -qf /etc/issue`;
+}
+else {
+ $dist_rpm = "unsupported";
+}
+
+my $SRPMS = $CWD . '/' . 'SRPMS/';
+chomp $SRPMS;
+my $RPMS = $CWD . '/' . 'RPMS' . '/' . $dist_rpm;
+chomp $RPMS;
+if (not -d $RPMS) {
+ mkpath([$RPMS]);
+}
+
+my $config = $CWD . '/ofed.conf';
+chomp $config;
+my $config_net;
+
+my $TOPDIR = "/var/tmp/" . $PACKAGE . "_topdir";
+chomp $TOPDIR;
+
+rmtree ("$TOPDIR");
+mkpath([$TOPDIR . '/BUILD' ,$TOPDIR . '/RPMS',$TOPDIR . '/SOURCES',$TOPDIR . '/SPECS',$TOPDIR . '/SRPMS']);
+my $ofedlogs = "/tmp/$PACKAGE.$$.logs";
+mkpath([$ofedlogs]);
+
+my $prefix ='/usr';
+chomp $prefix;
+
+my $target_cpu = `rpm --eval '%{_target_cpu}'`;
+chomp $target_cpu;
+
+my $target_cpu32;
+if (-f "/etc/SuSE-release") {
+ $target_cpu32 = 'i586';
+}
+else {
+ $target_cpu32 = 'i686';
+}
+chomp $target_cpu32;
+
+my $mandir = `rpm --eval '%{_mandir}'`;
+chomp $mandir;
+my $sysconfdir = `rpm --eval '%{_sysconfdir}'`;
+chomp $sysconfdir;
my %main_packages = ();
my @selected_packages = ();
my @selected_by_user = ();
"perftest", "mstflint", "tvflash",
"qlvnictools", "sdpnetstat", "srptools", "rds-tools",
"ibutils", "infiniband-diags",
- "open-iscsi-generic",
"ofed-docs", "ofed-scripts",
"mpi-selector", "mvapich", "mvapich2", "openmpi", "mpitests",
);
{ name => "mlx4", available => 1, selected => 0,
included_in_rpm => 0, requires => ["core"], },
'ehca' =>
- { name => "ehca", available => 1, selected => 0,
+ { name => "ehca", available => 0, selected => 0,
included_in_rpm => 0, requires => ["core"], },
'ipath' =>
- { name => "ipath", available => 1, selected => 0,
+ { name => "ipath", available => 0, selected => 0,
included_in_rpm => 0, requires => ["core"], },
'cxgb3' =>
{ name => "cxgb3", available => 1, selected => 0,
available => 1, mode => "kernel", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [], ofa_req_inst => [], },
'kernel-ib-devel' =>
- { name => "kernel-ib", parent => "ofa_kernel",
+ { name => "kernel-ib-devel", parent => "ofa_kernel",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "kernel", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
dist_req_inst => [], ofa_req_build => [], ofa_req_inst => [],
install32 => 1, exception => 0 },
'libibverbs-devel' =>
- { name => "libibverbs", parent => "libibverbs",
+ { name => "libibverbs-devel", parent => "libibverbs",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
ofa_req_inst => ["libibverbs"],
install32 => 1, exception => 0 },
'libibverbs-devel-static' =>
- { name => "libibverbs", parent => "libibverbs",
+ { name => "libibverbs-devel-static", parent => "libibverbs",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
ofa_req_inst => ["libibverbs"],
install32 => 1, exception => 0 },
'libibverbs-utils' =>
- { name => "libibverbs", parent => "libibverbs",
+ { name => "libibverbs-utils", parent => "libibverbs",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
ofa_req_inst => ["libibverbs"],
install32 => 0, exception => 0 },
'libibverbs-debuginfo' =>
- { name => "libibverbs", parent => "libibverbs",
+ { name => "libibverbs-debuginfo", parent => "libibverbs",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
'libehca' =>
{ name => "libehca", parent => "libehca",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
- available => 1, mode => "user", dist_req_build => [],
+ available => 0, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["libibverbs"],
ofa_req_inst => ["libibverbs"],
install32 => 1, exception => 0 },
'libehca-devel-static' =>
{ name => "libehca-devel-static", parent => "libehca",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
- available => 1, mode => "user", dist_req_build => [],
+ available => 0, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["libibverbs","libibverbs-devel"],
ofa_req_inst => ["libibverbs", "libehca"],
install32 => 1, exception => 0 },
'libehca-debuginfo' =>
{ name => "libehca-debuginfo", parent => "libehca",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
- available => 1, mode => "user", dist_req_build => [],
+ available => 0, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["libibverbs","libibverbs-devel"],
ofa_req_inst => [],
install32 => 0, exception => 0 },
'libipathverbs' =>
{ name => "libipathverbs", parent => "libipathverbs",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
- available => 1, mode => "user", dist_req_build => [],
+ available => 0, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["libibverbs-devel"],
ofa_req_inst => ["libibverbs"],
install32 => 1, exception => 0 },
'libipathverbs-devel' =>
{ name => "libipathverbs-devel", parent => "libipathverbs",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
- available => 1, mode => "user", dist_req_build => [],
+ available => 0, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["libibverbs","libibverbs-devel"],
ofa_req_inst => ["libibverbs", "libipathverbs"],
install32 => 1, exception => 0 },
'libipathverbs-debuginfo' =>
{ name => "libipathverbs-debuginfo", parent => "libipathverbs",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
- available => 1, mode => "user", dist_req_build => [],
+ available => 0, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["libibverbs","libibverbs-devel"],
ofa_req_inst => [],
install32 => 0, exception => 0 },
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["libibverbs","libibverbs-devel"],
- ofa_req_inst => ["libibverbs", "libibcm"],
+ ofa_req_inst => ["libibverbs", "libibverbs-devel", "libibcm"],
install32 => 1, exception => 0 },
'libibcm-debuginfo' =>
{ name => "libibcm-debuginfo", parent => "libibcm",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["libibverbs"],
- ofa_req_inst => ["libibverbs"],
+ ofa_req_inst => ["libibverbs", "libibcommon"],
install32 => 1, exception => 0 },
'libibumad-devel' =>
{ name => "libibumad-devel", parent => "libibumad",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["libibverbs","libibverbs-devel"],
- ofa_req_inst => ["libibverbs", "libibumad"],
+ ofa_req_inst => ["libibverbs", "libibcommon-devel", "libibumad"],
install32 => 1, exception => 0 },
'libibumad-debuginfo' =>
{ name => "libibumad-debuginfo", parent => "libibumad",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
- ofa_req_inst => [],
+ ofa_req_inst => ["libibumad-devel", "opensm-libs"],
install32 => 1, exception => 0 },
'opensm-libs' =>
{ name => "opensm-libs", parent => "opensm",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
- ofa_req_inst => [],
+ ofa_req_inst => ["libibumad"],
install32 => 1, exception => 0 },
'opensm-static' =>
{ name => "opensm-static", parent => "opensm",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
- ofa_req_inst => [],
+ ofa_req_inst => ["libibumad-devel", "opensm-libs"],
install32 => 1, exception => 0 },
'opensm-debuginfo' =>
{ name => "opensm-debuginfo", parent => "opensm",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
- ofa_req_inst => [],
+ ofa_req_inst => ["libibverbs", "libibverbs-devel"],
install32 => 1, exception => 0 },
'librdmacm-devel' =>
{ name => "librdmacm-devel", parent => "librdmacm",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
- ofa_req_inst => [],
+ ofa_req_inst => ["librdmacm"],
install32 => 1, exception => 0 },
'librdmacm-debuginfo' =>
{ name => "librdmacm-debuginfo", parent => "librdmacm",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
- ofa_req_inst => [],
+ ofa_req_inst => ["libsdp"],
install32 => 1, exception => 0 },
'libsdp-debuginfo' =>
{ name => "libsdp-debuginfo", parent => "libsdp",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["libibverbs-devel", "librdmacm-devel"],
- ofa_req_inst => [],
+ ofa_req_inst => ["libibverbs", "librdmacm"],
install32 => 0, exception => 1 },
'perftest-debuginfo' =>
{ name => "perftest-debuginfo", parent => "perftest",
'ibvexdmtools' =>
{ name => "ibvexdmtools", parent => "qlvnictools",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
- available => 1, mode => "user", dist_req_build => [],
+ available => 0, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
ofa_req_inst => [],
install32 => 0, exception => 0 },
'qlvnictools' =>
{ name => "qlvnictools", parent => "qlvnictools",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
- available => 1, mode => "user", dist_req_build => [],
+ available => 0, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
ofa_req_inst => ["ibvexdmtools"],
install32 => 0, exception => 0 },
'qlvnictools-debuginfo' =>
{ name => "qlvnictools-debuginfo", parent => "qlvnictools",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
- available => 1, mode => "user", dist_req_build => [],
+ available => 0, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
ofa_req_inst => [],
install32 => 0, exception => 0 },
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => [],
- ofa_req_inst => [],
+ ofa_req_inst => ["libibcommon", "libibumad", "libibverbs"],
install32 => 0, exception => 0 },
'srptools-debuginfo' =>
{ name => "srptools-debuginfo", parent => "srptools",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
dist_req_inst => [], ofa_req_build => ["opensm-libs", "opensm-devel"],
- ofa_req_inst => [],
+ ofa_req_inst => ["libibcommon", "libibumad", "opensm-libs"],
install32 => 0, exception => 0 },
'ibutils-debuginfo' =>
{ name => "ibutils-debuginfo", parent => "ibutils",
install32 => 0, exception => 0 },
'open-iscsi-generic' =>
+ { name => ($distro eq 'SuSE') ? 'open-iscsi': 'iscsi-initiator-utils', parent => "open-iscsi-generic",
+ selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
+ available => 1, mode => "user", dist_req_build => [],
+ dist_req_inst => [], ofa_req_build => [],
+ ofa_req_inst => [],
+ install32 => 0, exception => 1 },
+ 'open-iscsi' =>
+ { name => "open-iscsi", parent => "open-iscsi-generic",
+ selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
+ available => 1, mode => "user", dist_req_build => [],
+ dist_req_inst => [], ofa_req_build => [],
+ ofa_req_inst => [],
+ install32 => 0, exception => 1 },
+ 'iscsi-initiator-utils' =>
+ { name => "iscsi-initiator-utils", parent => "open-iscsi-generic",
+ selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
+ available => 1, mode => "user", dist_req_build => [],
+ dist_req_inst => [], ofa_req_build => [],
+ ofa_req_inst => [],
+ install32 => 0, exception => 1 },
+ 'open-iscsi-generic-debuginfo' =>
{ name => "open-iscsi-generic", parent => "open-iscsi-generic",
selected => 0, installed => 0, rpm_exist => 0, rpm_exist32 => 0,
available => 1, mode => "user", dist_req_build => [],
);
-my @hidden_packages = ("open-iscsi", "ibvexdmtools");
-my $build32 = 0;
-my $arch = `uname -m`;
-chomp $arch;
-my $kernel = `uname -r`;
-chomp $kernel;
-
-my $PACKAGE = 'OFED';
-
-my $WDIR = dirname($0);
-chdir $WDIR;
-my $CWD = $ENV{PWD};
-my $TMPDIR = '/tmp';
-my $netdir;
-
-# Define RPMs environment
-my $dist_rpm;
-if (-f "/etc/issue") {
- $dist_rpm = `rpm -qf /etc/issue`;
-}
-else {
- $dist_rpm = "unsupported";
-}
-
-my $SRPMS = $CWD . '/' . 'SRPMS/';
-chomp $SRPMS;
-my $RPMS = $CWD . '/' . 'RPMS' . '/' . $dist_rpm;
-chomp $RPMS;
-if (not -d $RPMS) {
- mkpath([$RPMS]);
-}
-
-my $TOPDIR = "/var/tmp/" . $PACKAGE . "_topdir";
-chomp $TOPDIR;
-
-rmtree ("$TOPDIR");
-mkpath([$TOPDIR . '/BUILD' ,$TOPDIR . '/RPMS',$TOPDIR . '/SOURCES',$TOPDIR . '/SPECS',$TOPDIR . '/SRPMS']);
-my $ofedlogs = "/tmp/$PACKAGE.$$.logs";
-mkpath([$ofedlogs]);
-
-my $prefix ='/usr';
-chomp $prefix;
-
-my $target_cpu = `rpm --eval '%{_target_cpu}'`;
-chomp $target_cpu;
-
-my $target_cpu32;
-if (-f "/etc/SuSE-release") {
- $target_cpu32 = 'i586';
-}
-else {
- $target_cpu32 = 'i686';
-}
-chomp $target_cpu32;
-
-my $mandir = `rpm --eval '%{_mandir}'`;
-chomp $mandir;
-my $sysconfdir = `rpm --eval '%{_sysconfdir}'`;
-chomp $sysconfdir;
+my @hidden_packages = ("open-iscsi-generic", "ibvexdmtools");
my %MPI_SUPPORTED_COMPILERS = (gcc => 0, pgi => 0, intel => 0, pathscale => 0);
# print $key . ' = ' . $MPI_SUPPORTED_COMPILERS{$key} . "\n";
# }
-
-my $config = $CWD . '/ofed.conf';
-chomp $config;
-my $config_net;
-
while ( $#ARGV >= 0 ) {
my $cmd_flag = shift(@ARGV);
$config_net = shift(@ARGV);
} elsif ( $cmd_flag eq "-k" or $cmd_flag eq "--kernel" ) {
$kernel = shift(@ARGV);
+ } elsif ( $cmd_flag eq "-p" or $cmd_flag eq "--print-available" ) {
+ $print_available = 1;
} elsif ( $cmd_flag eq "-v" ) {
$verbose = 1;
} elsif ( $cmd_flag eq "-vv" ) {
my $kernel_rel = $kernel;
$kernel_rel =~ s/-/_/;
+# Set Linux Distribution
+if ( -f "/etc/SuSE-release" ) {
+ $distro = "SuSE";
+}
+elsif ( -f "/etc/fedora-release" ) {
+ if ($kernel =~ m/fc6/) {
+ $distro = "fedora6";
+ }
+ else {
+ $distro = "fedora";
+ }
+}
+elsif ( -f "/etc/rocks-release" ) {
+ $distro = "Rocks";
+}
+elsif ( -f "/etc/redhat-release" ) {
+ if ($kernel =~ m/el5/) {
+ $distro = "redhat5";
+ }
+ else {
+ open(DISTRO, "/etc/redhat-release");
+ if (<DISTRO> =~ m/release\s5/) {
+ $distro = "redhat5";
+ }
+ else {
+ $distro = "redhat";
+ }
+ close DISTRO;
+ }
+}
+elsif ( -f "/etc/debian_version" ) {
+ $distro = "debian";
+}
+else {
+ $distro = "unsupported";
+}
+
sub getch
{
my $c;
$main_packages{$name}{'description'} ) = split(/ /,$info,4);
$main_packages{$name}{'srpmpath'} = $srpm_full_path;
+ print "set_cfg: " .
+ "name: $main_packages{$name}{'name'}, " .
+ "version: $main_packages{$name}{'version'}, " .
+ "release: $main_packages{$name}{'release'}, " .
+ "srpmpath: $main_packages{$name}{'srpmpath'}\n" if ($verbose3);
+
}
-# TBD Set packages availability depending OS/Kernel/arch
+# Set packages availability depending OS/Kernel/arch
sub set_availability
{
+ # Ehca
+ if ($arch =~ m/ppc64|powerpc/ and
+ $kernel =~ m/2.6.1[6-9]|2.6.2[0-9]|2.6.9-55/) {
+ $kernel_modules_info{'ehca'}{'available'} = 1;
+ $packages_info{'libehca'}{'available'} = 1;
+ $packages_info{'libehca-devel-static'}{'available'} = 1;
+ $packages_info{'libehca-debuginfo'}{'available'} = 1;
+ }
+
+ # Ipath
+ if ( ($arch =~ m/ppc64/ and
+ $kernel =~ m/2.6.16.[0-9.]*-[0-9.]*-[A-Za-z0-9.]*|2.6.1[7-9]|2.6.2[0-9]/) or
+ ($arch =~ m/x86_64/ and
+ $kernel =~ m/2.6.5|2.6.9-22|2.6.9-34|2.6.9-42|2.6.9-55|2.6.16.[0-9.]*-[0-9.]*-[A-Za-z0-9.]*|2.6.1[7-9]|2.6.2[0-9]/) ) {
+ $kernel_modules_info{'ipath'}{'available'} = 1;
+ $packages_info{'libipathverbs'}{'available'} = 1;
+ $packages_info{'libipathverbs-devel'}{'available'} = 1;
+ $packages_info{'libipathverbs-debuginfo'}{'available'} = 1;
+ }
+
+ # Iser
+ if ($kernel =~ m/2.6.9-34|2.6.9-42|2.6.9-55|2.6.16.[0-9.]*-[0-9.]*-[A-Za-z0-9.]*|el5/) {
+ $kernel_modules_info{'iser'}{'available'} = 1;
+ $packages_info{'open-iscsi-generic'}{'available'} = 1;
+ }
+
+ # Vnic
+ if ($kernel =~ m/2.6.9-34|2.6.9-42|2.6.9-55|2.6.16.[0-9.]*-[0-9.]*-[A-Za-z0-9.]*|2.6.19/) {
+ $kernel_modules_info{'vnic'}{'available'} = 1;
+ $packages_info{'ibvexdmtools'}{'available'} = 1;
+ $packages_info{'qlvnictools'}{'available'} = 1;
+ $packages_info{'qlvnictools-debuginfo'}{'available'} = 1;
+ }
}
# Set rpm_exist parameter for existing RPMs
}
}
+sub show_menu
+{
+ my $menu = shift @_;
+ my $max_inp;
+
+ print $clear_string;
+ if ($menu eq "main") {
+ print "$PACKAGE Distribution Software Installation Menu\n\n";
+ print " 1) View $PACKAGE Installation Guide\n";
+ print " 2) Install $PACKAGE Software\n";
+ print " 3) Show Installed Software\n";
+ print " 4) Configure IPoIB\n";
+ print " 5) Uninstall $PACKAGE Software\n";
+# print " 6) Generate Supporting Information for Problem Report\n";
+ print "\n Q) Exit\n";
+ $max_inp=5;
+ print "\nSelect Option [1-$max_inp]:"
+ }
+ elsif ($menu eq "select") {
+ print "$PACKAGE Distribution Software Installation Menu\n\n";
+ print " 1) Basic ($PACKAGE modules and basic user level libraries)\n";
+ print " 2) HPC ($PACKAGE modules and libraries, MPI and diagnostic tools)\n";
+ print " 3) All packages (all of Basic, HPC)\n";
+ print " 4) Customize\n";
+ print "\n Q) Exit\n";
+ $max_inp=4;
+ print "\nSelect Option [1-$max_inp]:"
+ }
+
+ return $max_inp;
+}
+
# Select package for installation
sub select_packages
{
if ($interactive) {
- my $ans;
- open(CONFIG, "+>$config") || die "Can't open $config: $!";;
- flock CONFIG, $LOCK_EXCLUSIVE;
- for my $package ( @all_packages ) {
- next if (not $packages_info{$package}{'available'});
- print "Install $package? [y/N]:";
- $ans = getch();
- if ( $ans eq 'Y' or $ans eq 'y' ) {
- print CONFIG "$package=y\n";
- push (@selected_by_user, $package);
+ my $inp;
+ my $ok = 0;
+ my $max_inp;
- if ($package eq "kernel-ib") {
- # Select kernel modules to be installed
- for my $module ( @kernel_modules ) {
- print "Install $module module? [y/N]:";
- $ans = getch();
- if ( $ans eq 'Y' or $ans eq 'y' ) {
- push (@selected_modules_by_user, $module);
- print CONFIG "$module=y\n";
- }
- }
- }
+ while (! $ok) {
+ $max_inp = show_menu("main");
+ $inp = getch();
+
+ if ($inp =~ m/[qQ]/ || $inp =~ m/[Xx]/ ) {
+ die "Exiting\n";
}
- else {
- print CONFIG "$package=n\n";
+ if (ord($inp) == $KEY_ENTER) {
+ next;
+ }
+ if ($inp =~ m/[0123456789abcdefABCDEF]/)
+ {
+ $inp = hex($inp);
+ }
+ if ($inp < 1 || $inp > $max_inp)
+ {
+ print "Invalid choice...Try again\n";
+ next;
}
+ $ok = 1;
}
- if ($arch eq "x86_64" or $arch eq "ppc64") {
- print "Install 32-bit packages? [y/N]:";
- $ans = getch();
- if ( $ans eq 'Y' or $ans eq 'y' ) {
- $build32 = 1;
- print CONFIG "build32=1\n";
+
+ if ($inp == 1) {
+ }
+ elsif ($inp == 2) {
+ $ok = 0;
+ while (! $ok) {
+ $max_inp = show_menu("select");
+ $inp = getch();
+ if ($inp =~ m/[qQ]/ || $inp =~ m/[Xx]/ ) {
+ die "Exiting\n";
+ }
+ if (ord($inp) == $KEY_ENTER) {
+ next;
+ }
+ if ($inp =~ m/[0123456789abcdefABCDEF]/)
+ {
+ $inp = hex($inp);
+ }
+ if ($inp < 1 || $inp > $max_inp)
+ {
+ print "Invalid choice...Try again\n";
+ next;
+ }
+ $ok = 1;
}
- else {
- $build32 = 0;
- print CONFIG "build32=0\n";
+ if ($inp == 1) {
+ # BASIC packages
+ }
+ elsif ($inp == 2) {
+ # HPC packages
}
+ elsif ($inp == 3) {
+ # All packages
+ }
+ elsif ($inp == 4) {
+ # Custom installation
+ my $ans;
+ open(CONFIG, "+>$config") || die "Can't open $config: $!";;
+ flock CONFIG, $LOCK_EXCLUSIVE;
+ for my $package ( @all_packages ) {
+ next if (not $packages_info{$package}{'available'});
+ print "Install $package? [y/N]:";
+ $ans = getch();
+ if ( $ans eq 'Y' or $ans eq 'y' ) {
+ print CONFIG "$package=y\n";
+ push (@selected_by_user, $package);
+
+ if ($package eq "kernel-ib") {
+ # Select kernel modules to be installed
+ for my $module ( @kernel_modules ) {
+ next if (not $kernel_modules_info{$module}{'available'});
+ print "Install $module module? [y/N]:";
+ $ans = getch();
+ if ( $ans eq 'Y' or $ans eq 'y' ) {
+ push (@selected_modules_by_user, $module);
+ print CONFIG "$module=y\n";
+ }
+ }
+ }
+ }
+ else {
+ print CONFIG "$package=n\n";
+ }
+ }
+ if ($arch eq "x86_64" or $arch eq "ppc64") {
+ print "Install 32-bit packages? [y/N]:";
+ $ans = getch();
+ if ( $ans eq 'Y' or $ans eq 'y' ) {
+ $build32 = 1;
+ print CONFIG "build32=1\n";
+ }
+ else {
+ $build32 = 0;
+ print CONFIG "build32=0\n";
+ }
+ }
+ print "Please enter the $PACKAGE installation directory: [$prefix]:";
+ $ans = <STDIN>;
+ chomp $ans;
+ if ($ans) {
+ $prefix = $ans;
+ }
+ print CONFIG "prefix=$prefix\n";
+ }
+ }
+ elsif ($inp == 3) {
+ }
+ elsif ($inp == 4) {
}
- print "Please enter the $PACKAGE installation directory: [$prefix]:";
- $prefix = <STDIN>;
- chomp $prefix;
- print CONFIG "prefix=$prefix\n";
+ elsif ($inp == 5) {
+ }
+
}
else {
open(CONFIG, "$config") || die "Can't open $config: $!";
next;
}
+ if (not $packages_info{$package}{'available'} and $selected eq 'y') {
+ print "$package is not available on this platform\n";
+ next;
+ }
+
if ( $selected eq 'y' ) {
- # $packages_info{$package}{'selected'} = 1;
push (@selected_by_user, $package);
print "select_package: selected $package\n" if ($verbose);
}
if (not $packages_info{$package}{'selected'}) {
$packages_info{$package}{'selected'} = 1;
push (@selected_packages, $package);
- print "select_dependent: Selected package $package\n" if ($verbose);
+ print "select_dependent: Selected package $package\n" if ($verbose2);
}
}
$res = $? >> 8;
$sig = $? & 127;
if ($sig or $res) {
- print "Failed to build $name RPM\n";
- print "See $ofedlogs/$name.rpmbuild.log\n";
+ print RED "Failed to build $name RPM", RESET . "\n";
+ print RED "See $ofedlogs/$name.rpmbuild.log", RESET . "\n";
exit 1;
}
$res = $? >> 8;
$sig = $? & 127;
if ($sig or $res) {
- print "Failed to build $name RPM\n";
- print "See $ofedlogs/$name.rpmbuild.log\n";
+ print RED "Failed to build $name RPM", RESET . "\n";
+ print RED "See $ofedlogs/$name.rpmbuild.log", RESET . "\n";
exit 1;
}
$res = $? >> 8;
$sig = $? & 127;
if ($sig or $res) {
- print "Failed to build $name RPM\n";
- print "See $ofedlogs/$name.rpmbuild.log\n";
+ print RED "Failed to build $name RPM", RESET . "\n";
+ print RED "See $ofedlogs/$name.rpmbuild.log", RESET . "\n";
exit 1;
}
my $package = "$RPMS/$name-$version-$release.$target_cpu.rpm";
if (not -f $package) {
- print "$package does not exist\n";
+ print RED "$package does not exist", RESET . "\n";
exit 1;
}
$res = $? >> 8;
$sig = $? & 127;
if ($sig or $res) {
- print "Failed to install $name RPM\n";
- print "See $ofedlogs/$name.rpminstall.log\n";
+ print RED "Failed to install $name RPM", RESET . "\n";
+ print RED "See $ofedlogs/$name.rpminstall.log", RESET . "\n";
exit 1;
}
}
$package = "$RPMS/$name-$version-$release.$target_cpu.rpm";
if (not -f $package) {
- print "$package does not exist\n";
+ print RED "$package does not exist", RESET . "\n";
exit 1;
}
$cmd = "rpm -iv";
$res = $? >> 8;
$sig = $? & 127;
if ($sig or $res) {
- print "Failed to install $name RPM\n";
- print "See $ofedlogs/$name.rpminstall.log\n";
+ print RED "Failed to install $name RPM", RESET . "\n";
+ print RED "See $ofedlogs/$name.rpminstall.log", RESET . "\n";
exit 1;
}
if ($build32 and $packages_info{$name}{'install32'}) {
$package = "$RPMS/$name-$version-$release.$target_cpu32.rpm";
if (not -f $package) {
- print "$package does not exist\n";
+ print RED "$package does not exist", RESET . "\n";
# exit 1;
}
$cmd = "rpm -iv";
$res = $? >> 8;
$sig = $? & 127;
if ($sig or $res) {
- print "Failed to install $name RPM\n";
- print "See $ofedlogs/$name.rpminstall.log\n";
+ print RED "Failed to install $name RPM", RESET . "\n";
+ print RED "See $ofedlogs/$name.rpminstall.log", RESET . "\n";
exit 1;
}
}
if ($sig or $res) {
my $cmd = "rpm -e --allmatches";
for my $package (@all_packages, @hidden_packages) {
- if (is_installed($package)) {
- $cmd .= " $package";
+ if (is_installed($packages_info{$package}{'name'})) {
+ $cmd .= " $packages_info{$package}{'name'}";
$cnt ++;
}
}
$res = $? >> 8;
$sig = $? & 127;
if ($sig or $res) {
- print "Failed to uninstall the previous installation\n";
- print "See $ofedlogs/ofed_uninstall.log\n";
+ print RED "Failed to uninstall the previous installation", RESET . "\n";
+ print RED "See $ofedlogs/ofed_uninstall.log", RESET . "\n";
exit 1;
}
}
}
### MAIN AREA ###
+if ($print_available) {
+ set_availability();
+ for my $package ( @all_packages, @hidden_packages) {
+ next if (not $packages_info{$package}{'available'});
+ if ($package eq "kernel-ib") {
+ print "Kernel modules: ";
+ for my $module ( @kernel_modules ) {
+ next if (not $kernel_modules_info{$module}{'available'});
+ print $module . ' ';
+ }
+ print "\nOther packages: ";
+ }
+ print $package . ' ';
+ }
+ print "\n";
+ exit 0;
+}
+print BLUE "Detected Linux Distribution: $distro", RESET . "\n" if ($verbose);
# Set RPMs info for available source RPMs
for my $srcrpm ( <$SRPMS*> ) {
set_cfg ($srcrpm);
}
set_existing_rpms();
+set_availability();
select_packages();
resolve_dependencies();
print_selected();
print "Build and install selected_packages: @selected_packages\n";
for my $package ( @selected_packages) {
if ($packages_info{$package}{'mode'} eq "user") {
- if ( (not $packages_info{$package}{'rpm_exist'}) or
- ($build32 and $packages_info{$package}{'install32'} and
- not $packages_info{$package}{'rpm_exist32'}) ) {
- my $parent = $packages_info{$package}{'parent'};
- print "Build $parent RPM\n" if ($verbose);
- build_rpm($parent);
- }
+ if (not $packages_info{$package}{'exception'}) {
+ if ( (not $packages_info{$package}{'rpm_exist'}) or
+ ($build32 and $packages_info{$package}{'install32'} and
+ not $packages_info{$package}{'rpm_exist32'}) ) {
+ my $parent = $packages_info{$package}{'parent'};
+ print "Build $parent RPM\n" if ($verbose);
+ build_rpm($parent);
+ }
- if ( (not $packages_info{$package}{'rpm_exist'}) or
- ($build32 and $packages_info{$package}{'install32'} and
- not $packages_info{$package}{'rpm_exist32'}) ) {
- print "$package was not created\n";
- exit 1;
+ if ( (not $packages_info{$package}{'rpm_exist'}) or
+ ($build32 and $packages_info{$package}{'install32'} and
+ not $packages_info{$package}{'rpm_exist32'}) ) {
+ print RED "$package was not created", RESET . "\n";
+ exit 1;
+ }
+ print "Install $package RPM\n" if ($verbose);
+ install_rpm($package);
+ }
+ else {
+ if ($package eq "open-iscsi-generic") {
+ my $real_name = $packages_info{$package}{'name'};
+ print "open-iscsi-generic real name: $real_name rpm_exist: $packages_info{$real_name}{'rpm_exist'}\n";
+ if (not $packages_info{$real_name}{'rpm_exist'}) {
+ my $parent = $packages_info{$real_name}{'parent'};
+ print "Build $parent RPM\n" if ($verbose);
+ build_rpm($parent);
+ }
+ if (not $packages_info{$real_name}{'rpm_exist'}) {
+ print RED "$real_name was not created", RESET . "\n";
+ exit 1;
+ }
+ print "Install $real_name RPM\n" if ($verbose);
+ install_rpm($real_name);
+ }
}
- print "Install $package RPM\n" if ($verbose);
- install_rpm($package);
}
else {
# kernel modules
build_kernel_rpm($parent);
}
if (not $packages_info{$package}{'rpm_exist'}) {
- print "$package was not created\n";
+ print RED "$package was not created", RESET . "\n";
exit 1;
}
print "Install $package RPM\n" if ($verbose);