|
Packit |
857059 |
#!/usr/bin/perl
|
|
Packit |
857059 |
# BEGIN_ICS_COPYRIGHT8 ****************************************
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# Copyright (c) 2015-2017, Intel Corporation
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# Redistribution and use in source and binary forms, with or without
|
|
Packit |
857059 |
# modification, are permitted provided that the following conditions are met:
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
857059 |
# this list of conditions and the following disclaimer.
|
|
Packit |
857059 |
# * Redistributions in binary form must reproduce the above copyright
|
|
Packit |
857059 |
# notice, this list of conditions and the following disclaimer in the
|
|
Packit |
857059 |
# documentation and/or other materials provided with the distribution.
|
|
Packit |
857059 |
# * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
857059 |
# may be used to endorse or promote products derived from this software
|
|
Packit |
857059 |
# without specific prior written permission.
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
857059 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
857059 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Packit |
857059 |
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
Packit |
857059 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit |
857059 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Packit |
857059 |
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Packit |
857059 |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Packit |
857059 |
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
857059 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# END_ICS_COPYRIGHT8 ****************************************
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# [ICS VERSION STRING: unknown]
|
|
Packit |
857059 |
use strict;
|
|
Packit |
857059 |
#use Term::ANSIColor;
|
|
Packit |
857059 |
#use Term::ANSIColor qw(:constants);
|
|
Packit |
857059 |
#use File::Basename;
|
|
Packit |
857059 |
#use Math::BigInt;
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# ==========================================================================
|
|
Packit |
857059 |
# Fast Fabric installation
|
|
Packit |
857059 |
|
|
Packit |
857059 |
my $FF_CONF_FILE = "/usr/lib/opa/tools/opafastfabric.conf";
|
|
Packit |
857059 |
my $FF_TLS_CONF_FILE = "/etc/opa/opaff.xml";
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub get_rpms_dir_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $srcdir=$ComponentInfo{'fastfabric'}{'SrcDir'};
|
|
Packit |
857059 |
return "$srcdir/RPMS/*";
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub available_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $srcdir=$ComponentInfo{'fastfabric'}{'SrcDir'};
|
|
Packit |
857059 |
return ((rpm_resolve("$srcdir/RPMS/*/opa-mpi-apps", "any") ne "") &&
|
|
Packit |
857059 |
(rpm_resolve("$srcdir/RPMS/*/opa-fastfabric", "any") ne ""));
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub installed_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
return rpm_is_installed("opa-fastfabric", "any");
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# only called if installed_fastfabric is true
|
|
Packit |
857059 |
sub installed_version_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $version = rpm_query_version_release_pkg("opa-fastfabric");
|
|
Packit |
857059 |
return dot_version("$version");
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# only called if available_fastfabric is true
|
|
Packit |
857059 |
sub media_version_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $srcdir=$ComponentInfo{'fastfabric'}{'SrcDir'};
|
|
Packit |
857059 |
my $rpmfile = rpm_resolve("$srcdir/RPMS/*/opa-fastfabric", "any");
|
|
Packit |
857059 |
my $version= rpm_query_version_release("$rpmfile");
|
|
Packit |
857059 |
# assume media properly built with matching versions for all rpms
|
|
Packit |
857059 |
return dot_version("$version");
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub build_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $osver = $_[0];
|
|
Packit |
857059 |
my $debug = $_[1]; # enable extra debug of build itself
|
|
Packit |
857059 |
my $build_temp = $_[2]; # temp area for use by build
|
|
Packit |
857059 |
my $force = $_[3]; # force a rebuild
|
|
Packit |
857059 |
return 0; # success
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub need_reinstall_fastfabric($$)
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $install_list = shift(); # total that will be installed when done
|
|
Packit |
857059 |
my $installing_list = shift(); # what items are being installed/reinstalled
|
|
Packit |
857059 |
|
|
Packit |
857059 |
return "no";
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub check_os_prereqs_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
return rpm_check_os_prereqs("fastfabric", "user");
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub preinstall_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $install_list = $_[0]; # total that will be installed when done
|
|
Packit |
857059 |
my $installing_list = $_[1]; # what items are being installed/reinstalled
|
|
Packit |
857059 |
|
|
Packit |
857059 |
return 0; # success
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub install_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $install_list = $_[0]; # total that will be installed when done
|
|
Packit |
857059 |
my $installing_list = $_[1]; # what items are being installed/reinstalled
|
|
Packit |
857059 |
|
|
Packit |
857059 |
my $depricated_dir = "/etc/sysconfig/opa";
|
|
Packit |
857059 |
|
|
Packit |
857059 |
my $version=media_version_fastfabric();
|
|
Packit |
857059 |
chomp $version;
|
|
Packit |
857059 |
printf("Installing $ComponentInfo{'fastfabric'}{'Name'} $version $DBG_FREE...\n");
|
|
Packit |
857059 |
LogPrint "Installing $ComponentInfo{'fastfabric'}{'Name'} $version $DBG_FREE for $CUR_DISTRO_VENDOR $CUR_VENDOR_VER\n";
|
|
Packit |
857059 |
|
|
Packit |
857059 |
install_comp_rpms('fastfabric', " -U ", $install_list);
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# TBD - spec file should do this
|
|
Packit |
857059 |
check_dir("/usr/share/opa/samples");
|
|
Packit |
857059 |
system "chmod ug+x /usr/share/opa/samples/hostverify.sh";
|
|
Packit |
857059 |
system "rm -f /usr/share/opa/samples/nodeverify.sh";
|
|
Packit |
857059 |
|
|
Packit |
857059 |
check_rpm_config_file("$FF_TLS_CONF_FILE");
|
|
Packit |
857059 |
printf("Default opaff.xml can be found in '/usr/share/opa/samples/opaff.xml-sample'\n");
|
|
Packit |
857059 |
check_rpm_config_file("$CONFIG_DIR/opa/opamon.conf", $depricated_dir);
|
|
Packit |
857059 |
check_rpm_config_file("$CONFIG_DIR/opa/opafastfabric.conf", $depricated_dir);
|
|
Packit |
857059 |
check_rpm_config_file("$CONFIG_DIR/opa/allhosts", $depricated_dir);
|
|
Packit |
857059 |
check_rpm_config_file("$CONFIG_DIR/opa/chassis", $depricated_dir);
|
|
Packit |
857059 |
check_rpm_config_file("$CONFIG_DIR/opa/hosts", $depricated_dir);
|
|
Packit |
857059 |
check_rpm_config_file("$CONFIG_DIR/opa/ports", $depricated_dir);
|
|
Packit |
857059 |
check_rpm_config_file("$CONFIG_DIR/opa/switches", $depricated_dir);
|
|
Packit |
857059 |
# TBD - this should not be a config file
|
|
Packit |
857059 |
check_rpm_config_file("/usr/lib/opa/tools/osid_wrapper");
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# TBD - spec file should remove this
|
|
Packit |
857059 |
system("rm -rf $OPA_CONFIG_DIR/iba_stat.conf"); # old config
|
|
Packit |
857059 |
|
|
Packit |
857059 |
$ComponentWasInstalled{'fastfabric'}=1;
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub postinstall_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $install_list = $_[0]; # total that will be installed when done
|
|
Packit |
857059 |
my $installing_list = $_[1]; # what items are being installed/reinstalled
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub uninstall_fastfabric
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $install_list = $_[0]; # total that will be left installed when done
|
|
Packit |
857059 |
my $uninstalling_list = $_[1]; # what items are being uninstalled
|
|
Packit |
857059 |
|
|
Packit |
857059 |
uninstall_comp_rpms('fastfabric', '', $install_list, $uninstalling_list, 'verbose');
|
|
Packit |
857059 |
|
|
Packit |
857059 |
NormalPrint("Uninstalling $ComponentInfo{'fastfabric'}{'Name'}...\n");
|
|
Packit |
857059 |
remove_conf_file("$ComponentInfo{'fastfabric'}{'Name'}", "$FF_CONF_FILE");
|
|
Packit |
857059 |
remove_conf_file("$ComponentInfo{'fastfabric'}{'Name'}", "$OPA_CONFIG_DIR/iba_stat.conf");
|
|
Packit |
857059 |
remove_conf_file("$ComponentInfo{'fastfabric'}{'Name'}", "$FF_TLS_CONF_FILE");
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# remove samples we installed (or user compiled), however do not remove
|
|
Packit |
857059 |
# any logs or other files the user may have created
|
|
Packit |
857059 |
remove_installed_files "/usr/share/opa/samples";
|
|
Packit |
857059 |
system "rmdir /usr/share/opa/samples 2>/dev/null"; # remove only if empty
|
|
Packit |
857059 |
# just in case, newer rpms should clean these up
|
|
Packit |
857059 |
|
|
Packit |
857059 |
system("rm -rf /usr/lib/opa/.comp_fastfabric.pl");
|
|
Packit |
857059 |
system "rmdir /usr/lib/opa 2>/dev/null"; # remove only if empty
|
|
Packit |
857059 |
system "rmdir $BASE_DIR 2>/dev/null"; # remove only if empty
|
|
Packit |
857059 |
system "rmdir $OPA_CONFIG_DIR 2>/dev/null"; # remove only if empty
|
|
Packit |
857059 |
$ComponentWasInstalled{'fastfabric'}=0;
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
#############################################################################
|
|
Packit |
857059 |
##
|
|
Packit |
857059 |
## OPAMGT SDK
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub get_rpms_dir_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $srcdir=$ComponentInfo{'opamgt_sdk'}{'SrcDir'};
|
|
Packit |
857059 |
return "$srcdir/RPMS/*";
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub available_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $srcdir = $ComponentInfo{'opamgt_sdk'}{'SrcDir'};
|
|
Packit |
857059 |
return ( rpm_exists("$srcdir/RPMS/*/opa-libopamgt-devel", "any") &&
|
|
Packit |
857059 |
rpm_exists("$srcdir/RPMS/*/opa-libopamgt", "any"));
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub installed_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
return ( rpm_is_installed("opa-libopamgt-devel", "any") &&
|
|
Packit |
857059 |
rpm_is_installed("opa-libopamgt", "any"));
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub installed_version_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $version = rpm_query_version_release_pkg("opa-libopamgt-devel");
|
|
Packit |
857059 |
return dot_version("$version");
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub media_version_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $srcdir = $ComponentInfo{'opamgt_sdk'}{'SrcDir'};
|
|
Packit |
857059 |
my $rpm = rpm_resolve("$srcdir/RPMS/*/opa-libopamgt-devel", "any");
|
|
Packit |
857059 |
my $version = rpm_query_version_release($rpm);
|
|
Packit |
857059 |
return dot_version("$version");
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub build_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
return 0;
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub need_reinstall_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
return "no";
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub check_os_prereqs_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
return rpm_check_os_prereqs("opamgt_sdk", "user");
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub preinstall_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
return 0;
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub install_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $install_list = $_[0]; # total that will be installed when done
|
|
Packit |
857059 |
my $installing_list = $_[1]; # what items are being installed/reinstalled
|
|
Packit |
857059 |
|
|
Packit |
857059 |
my $version=media_version_opamgt_sdk();
|
|
Packit |
857059 |
chomp $version;
|
|
Packit |
857059 |
printf("Installing $ComponentInfo{'opamgt_sdk'}{'Name'} $version $DBG_FREE...\n");
|
|
Packit |
857059 |
LogPrint "Installing $ComponentInfo{'opamgt_sdk'}{'Name'} $version $DBG_FREE for $CUR_DISTRO_VENDOR $CUR_VENDOR_VER\n";
|
|
Packit |
857059 |
|
|
Packit |
857059 |
install_comp_rpms('opamgt_sdk', "", $install_list);
|
|
Packit |
857059 |
|
|
Packit |
857059 |
$ComponentWasInstalled{'opamgt_sdk'}=1;
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub postinstall_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
sub uninstall_opamgt_sdk
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
my $install_list = $_[0]; # total that will be left installed when done
|
|
Packit |
857059 |
my $uninstalling_list = $_[1]; # what items are being uninstalled
|
|
Packit |
857059 |
|
|
Packit |
857059 |
uninstall_comp_rpms('opamgt_sdk', '', $install_list, $uninstalling_list, 'verbose');
|
|
Packit |
857059 |
$ComponentWasInstalled{'opamgt_sdk'}=0;
|
|
Packit |
857059 |
}
|