| 1 | package System::Info::AIX; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use base "System::Info::Base"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | our $VERSION = "0.050"; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | System::Info::AIX - Object for specific AIX info. | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head2 $si->prepare_sysinfo | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | Use os-specific tools to find out more about the system. | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | =cut | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub prepare_sysinfo { | ||||||||||||||||||||||||||
|
Subroutine
prepare_sysinfo: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 24 | 0 | $self->SUPER::prepare_sysinfo; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | local $ENV{PATH} = "$ENV{PATH}:/usr/sbin"; | |||||||||||||||||||||||||||
| 27 | 0 | $self->prepare_os; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | my @lsdev = grep m/Available/ => `lsdev -C -c processor -S Available`; | |||||||||||||||||||||||||||
| 30 | 0 | $self->{__cpu_count} = scalar @lsdev; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | my ($info) = grep m/^\S+/ => @lsdev; | |||||||||||||||||||||||||||
| 33 | 0 | ($info) = $info =~ m/^(\S+)/; | |||||||||||||||||||||||||||
| 34 | 0 | $info .= " -a 'state type'"; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | my ($cpu) = grep m/\benable:[^:\s]+/ => `lsattr -E -O -l $info`; | |||||||||||||||||||||||||||
| 37 | 0 | ($cpu) = $cpu =~ m/\benable:([^:\s]+)/; | |||||||||||||||||||||||||||
| 38 | 0 | $cpu =~ s/\bPowerPC(?=\b|_)/PPC/i; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | (my $cpu_type = $cpu) =~ s/_.*//; | |||||||||||||||||||||||||||
| 41 | 0 | $self->{__cpu} = $cpu; | |||||||||||||||||||||||||||
| 42 | 0 | $self->{__cpu_type} = $cpu_type; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | my $os = $self->_os; | |||||||||||||||||||||||||||
| 45 | 0 | ▶ | if ( $> == 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 0 | chomp (my $k64 = `bootinfo -K 2>/dev/null`); | |||||||||||||||||||||||||||
| 47 | 0 | ▶ | $k64 and $os .= "/$k64"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | chomp (my $a64 = `bootinfo -y 2>/dev/null`); | |||||||||||||||||||||||||||
| 49 | 0 | ▶ | $a64 and $cpu_type .= "/$a64"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 0 | $self->{__os} = $os; | |||||||||||||||||||||||||||
| 52 | } # prepare_sysinfo | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =head2 $si->prepare_os | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | Use os-specific tools to find out more about the operating system. | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | Abbreviations used in AIX OS version include | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | ML Maintenance Level | ||||||||||||||||||||||||||||
| 61 | TL Technology Level | ||||||||||||||||||||||||||||
| 62 | SP Service Pack | ||||||||||||||||||||||||||||
| 63 | CSP Conclusive/Last SP | ||||||||||||||||||||||||||||
| 64 | RD Release Date (YYWW) | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | When the OS version reports as C<AIX 5.3.0.0/TL12-05>, the C<05> is | ||||||||||||||||||||||||||||
| 67 | the C<SP> number. Newer versions of AIX report using C<TL>, where older | ||||||||||||||||||||||||||||
| 68 | AIX releases report using C<ML>. See C<oslevel -?>. | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =cut | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub prepare_os { | ||||||||||||||||||||||||||
|
Subroutine
prepare_os: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 73 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 0 | my $os = $self->_os; | |||||||||||||||||||||||||||
| 76 | # First try the format used since 5.3ML05 | ||||||||||||||||||||||||||||
| 77 | 0 | chomp ($os = `oslevel -s`); | |||||||||||||||||||||||||||
| 78 | 0 | ▶ | if ($os =~ m/^(\d+)-(\d+)-(\d+)-(\d+)$/ && $1 >= 5300) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$os =~ /^(\d+)-(\d+)-(\d+)-(\d+)$/ and $1 >= 5300
MC/DC0%0/2
$os =~ /^(\d+)-(\d+)-(\d+)-(\d+)$/ and $1 >= 5300
$os =~ /^(\d+)-(\d+)-(\d+)-(\d+)$/
$1 >= 5300
Truth table0%0/3
A and B
A= $os =~ /^(\d+)-(\d+)-(\d+)-(\d+)$/B= $1 >= 5300
| |||||||||||||||||||||||||||||
| 79 | # 6100-09-03-1415 = AIX 6.1.0.0 TL09 SP03 (release 2014, week 15) | ||||||||||||||||||||||||||||
| 80 | # Which will show as AIX 6.1.0.0/TL09-03 | ||||||||||||||||||||||||||||
| 81 | 0 | $os = join (".", split m// => $1) . "/TL$2-$3"; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | else { | ||||||||||||||||||||||||||||
| 84 | 0 | chomp ($os = `oslevel -r`); | |||||||||||||||||||||||||||
| 85 | # 5300-12 = AIX 5.3.0.0/ML12 | ||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if ($os =~ m/^(\d+)-(\d+)$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 87 | 0 | $os = join (".", split // => $1) . "/ML$2"; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | else { | ||||||||||||||||||||||||||||
| 90 | 0 | chomp ($os = `oslevel`); | |||||||||||||||||||||||||||
| 91 | # 5.3.0.0 = AIX 5.3.0.0 | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | # And try figuring out at what maintainance level we are | ||||||||||||||||||||||||||||
| 94 | 0 | my $ml = "00"; | |||||||||||||||||||||||||||
| 95 | 0 | for (grep m/ML\b/ => `instfix -i`) { | |||||||||||||||||||||||||||
| 96 | 0 | ▶ | if (m/All filesets for (\S+) were found/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | 0 | $ml = $1; | |||||||||||||||||||||||||||
| 98 | 0 | ▶ | $ml =~ m/^\d+-(\d+)_AIX_ML/ and $ml = "ML$1"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | 0 | next; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | 0 | $ml =~ s/\+*$/+/; | |||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | 0 | $os .= "/$ml"; | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | 0 | $os =~ s/^/AIX - /; | |||||||||||||||||||||||||||
| 107 | 0 | $self->{__os} = $os; | |||||||||||||||||||||||||||
| 108 | } # prepare_os | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 2 | 1; | |||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | __END__ | ||||||||||||||||||||||||||||