File: pseries_platform

package info (click to toggle)
powerpc-utils 1.3.13-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,044 kB
  • sloc: ansic: 18,549; sh: 4,697; perl: 980; makefile: 239
file content (47 lines) | stat: -rw-r--r-- 1,455 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

# Copyright (c) 2014 - IBM
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

SOURCE_FILE="pseries_platform"
PLATFORM_FILE=/proc/cpuinfo
export PLATFORM_UNKNOWN=0
export PLATFORM_POWERNV=1
export PLATFORM_POWERKVM_GUEST=2
export PLATFORM_PSERIES_LPAR=3

export platform_name
export platform

platform_string=$(sed -n 's/^platform\t*: \(.*\)/\1/p' $PLATFORM_FILE)
case "$platform_string" in
"PowerNV")
	platform_name="PowerNV Host"
	platform=$PLATFORM_POWERNV;;
"IBM pSeries (emulated by qemu)")
	platform_name="Power KVM pSeries Guest"
	platform=$PLATFORM_POWERKVM_GUEST;;
"pSeries")
	platform_name="PowerVM pSeries LPAR"
	platform=$PLATFORM_PSERIES_LPAR;;
*)
	platform_name="Unknown"
	platform=$PLATFORM_UNKNOWN;;
esac

if [ $SOURCE_FILE = `basename $0` ]; then
	echo $platform_name
fi