/usr/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Linux/Archs/PowerPC.pm is in fusioninventory-agent 1:2.3.10.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | package FusionInventory::Agent::Task::Inventory::Linux::Archs::PowerPC;
use strict;
use warnings;
use Config;
use FusionInventory::Agent::Tools;
use FusionInventory::Agent::Tools::Linux;
#processor : 0
#cpu : POWER4+ (gq)
#clock : 1452.000000MHz
#revision : 2.1
#
#processor : 1
#cpu : POWER4+ (gq)
#clock : 1452.000000MHz
#revision : 2.1
#
#timebase : 181495202
#machine : CHRP IBM,7029-6C3
#
#
sub isEnabled {
return
$Config{archname} =~ /^(ppc|powerpc)/;
}
sub doInventory {
my (%params) = @_;
my $inventory = $params{inventory};
my $logger = $params{logger};
foreach my $cpu (_getCPUsFromProc(
logger => $logger, file => '/proc/cpuinfo'
)) {
$inventory->addEntry(
section => 'CPUS',
entry => $cpu
);
}
my $bios;
$bios->{SSN} = getFirstLine(file => '/proc/device-tree/serial-number');
$bios->{SSN} =~ s/[^\,^\.^\w^\ ]//g; # I remove some unprintable char
$bios->{SMODEL} = getFirstLine(file => '/proc/device-tree/model');
$bios->{SMODEL} =~ s/[^\,^\.^\w^\ ]//g;
my $colorCode = getFirstLine(file => '/proc/device-tree/color-code');
my ($color) = unpack "h7" , $colorCode;
$bios->{SMODEL} .= " color: $color" if $color;
$bios->{BVERSION} =
getFirstLine(file => '/proc/device-tree/openprom/model');
$bios->{BVERSION} =~ s/[^\,^\.^\w^\ ]//g;
my $copyright = getFirstLine(file => '/proc/device-tree/copyright');
if ($copyright && $copyright =~ /Apple/) {
# What about the Apple clone?
$bios->{BMANUFACTURER} = "Apple Computer, Inc.";
$bios->{SMANUFACTURER} = "Apple Computer, Inc."
}
$inventory->setBios($bios);
}
sub _getCPUsFromProc {
my @cpus;
foreach my $cpu (getCPUsFromProc(@_)) {
my $speed;
if (
$cpu->{clock} &&
$cpu->{clock} =~ /(\d+)/
) {
$speed = $1;
}
my $manufacturer;
if ($cpu->{machine} &&
$cpu->{machine} =~ /IBM/
) {
$manufacturer = 'IBM';
}
push @cpus, {
ARCH => 'PowerPC',
NAME => $cpu->{cpu},
MANUFACTURER => $manufacturer,
SPEED => $speed
};
}
return @cpus;
}
1;
|