MINI MINI MANI MO
#
#
# osds_unix_linux_okalib.pm
#
# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
#
#
# NAME
# osds_unix_linux_okalib.pm - Linux Unix OSD library components.
#
# DESCRIPTION
# Purpose
# Linux Unix OSD library functions for the install/runtime scripts.
#
# NOTES
# All user visible output should be done in the common code.
# this will ensure a consistent look and feel across all platforms.
#
#
use strict;
use File::Path;
use acfslib;
use okalib;
package osds_unix_linux_okalib;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(
lib_osds_oka_supported
);
use Config;
my ($OSNAME) = $Config{osname};
chomp($OSNAME);
# On Windows, in the CRS environment, this
# redirection does not work. It fails with
# "cannot open file descriptor" or "cannot open pipe NOWAIT".
our ($REDIRECT) = "2>&1";
my ($CACHED_INSTALLED_DRIVERS); # saved find /lib/modules output
my ($CACHED_LOADED_DRIVERS); # saved find lsmod output
our ($ACFSUTIL) = "/sbin/acfsutil"; # Linux
$ACFSUTIL = "/sbin/acfsutil" if ($OSNAME eq "aix");
$ACFSUTIL = "/usr/lib/fs/acfs/acfsutil" if ($OSNAME eq "solaris");
# /sbin/fuser ... RH Enterprise Linux
# /bin/fuser ... Suse
# /usr/sbin/fuser ... AIX, HPUX, Solaris
# /usr/sbin/lsof ... RH Enterprise Linux
# /sbin/modprobe ... RH Enterprise Linux
$ENV{PATH} = $ENV{PATH} . ":/sbin:/bin:/usr/sbin";
my $ORACLE_HOME = $ENV{ORACLE_HOME};
my ($UNAME_R) = `uname -r`;
chomp($UNAME_R);
if (! -e $ACFSUTIL)
{
# Not installed yet.
$ACFSUTIL = "$ORACLE_HOME/usm/install/cmds/bin/acfsutil";
}
our ($TMPDIR) = "/tmp";
# lib_osds_oka_supported
#
# The fact that we got here means that there is some support for
# this platform. However, perhaps not all releases are supported.
# We make that determination here.
#
# return true or false
#
sub lib_osds_oka_supported
{
my ($arch) = $Config{archname}; # Machine architecture - e.g., i386
chomp($arch);
# For the time being, of all the "Unix" versions,
# only Linux, Solaris are supported
if (!(($OSNAME eq "linux") || ($OSNAME eq "solaris")))
{
# TODO for other operating systems
acfslib::lib_error_print_noalert(618,
"OKA is not supported on this operating system: '%s'.",
$OSNAME);
return acfslib::USM_NOT_SUPPORTED;
}
if (!(($arch =~ /^i686/) || ($arch =~ /^x86_64/)
|| ($arch =~ /^aix-thread-multi-64all/)
|| ($arch =~ /^i86pc/)
|| ($arch =~ /^sun4-solaris/)))
{
# TODO for other architectures
acfslib::lib_error_print_noalert(619,
"The '%s' machine architecture is not supported.", $arch);
return acfslib::USM_NOT_SUPPORTED;
}
# Prevent installation on a Solaris non-global zone
if ( ($OSNAME eq "solaris") &&
( ($UNAME_R eq "5.11") || ($UNAME_R eq "5.12")) )
{
# Note: In Solaris acfslib::lib_is_local_container() returns 0 or 1
if ( acfslib::lib_is_local_container() )
{
my ($sngz_detected) = "Solaris non-global zone";
my ($msg) = acfslib::get_acfs_afd_msg(0);
acfslib::lib_error_print_noalert(9430,
"$msg '%s'", $sngz_detected);
return acfslib::USM_NOT_SUPPORTED;
}
}
# Prevent installation on a Linux local container
if ( ($OSNAME eq "linux") )
{
# Note: In Linux acfslib::lib_is_local_container() returns 0 or 1
if ( acfslib::lib_is_local_container() )
{
my ($lxc_detected) = "Linux LXC container";
acfslib::lib_error_print_noalert(619,
"OKA should not be installed on '%s' .", $lxc_detected);
return acfslib::USM_NOT_SUPPORTED;
}
}
# $type is "EL5", for example
my ($type) = osds_acfslib::lib_osds_get_os_type();
if ($type =~ /not supported/)
{
return acfslib::USM_NOT_SUPPORTED;
}
return acfslib::USM_SUPPORTED;
} # end lib_osds_oka_supported
# vim:ts=2:expandtab
OHA YOOOO