blob: cd606a20346f35ab0d2b0d43e1a9e4e754a717a0 (
plain)
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
|
# Fact: architecture
#
# Purpose:
# Return the CPU hardware architecture.
#
# Resolution:
# On OpenBSD, Linux and Debian's kfreebsd, use the hardwaremodel fact.
# Gentoo and Debian call "x86_86" "amd64".
# Gentoo also calls "i386" "x86".
#
# Caveats:
#
Facter.add(:architecture) do
confine :kernel => [:linux, :"gnu/kfreebsd"]
setcode do
model = Facter.value(:hardwaremodel)
case model
# most linuxen use "x86_64"
when "x86_64"
case Facter.value(:operatingsystem)
when "Debian", "Gentoo", "GNU/kFreeBSD"
"amd64"
else
model
end
when /(i[3456]86|pentium)/
case Facter.value(:operatingsystem)
when "Gentoo"
"x86"
else
"i386"
end
else
model
end
end
end
Facter.add(:architecture) do
confine :kernel => :openbsd
setcode do
architecture = Facter.value(:hardwaremodel)
end
end
|