Look for the string "amazon" in a few different sysctl nodes. There doesn't
seem to be a single spot to check that works with both XenPVHVM and KVM instances.
This commit is contained in:
parent
0e1281fab5
commit
e3afd33ec2
|
@ -1,15 +1,22 @@
|
|||
# $NetBSD: ec2_init,v 1.1 2020/08/05 01:35:18 jmcneill Exp $
|
||||
# $NetBSD: ec2_init,v 1.2 2020/09/09 13:25:48 jmcneill Exp $
|
||||
|
||||
is_ec2() {
|
||||
dmi_vendor="$(/sbin/sysctl -qn machdep.dmi.system-vendor | tr '[A-Z]' '[a-z]')"
|
||||
case "$dmi_vendor" in
|
||||
amazon*)
|
||||
printf YES
|
||||
;;
|
||||
*)
|
||||
printf NO
|
||||
;;
|
||||
esac
|
||||
val=NO
|
||||
# Look for the string "amazon" in one of these sysctl nodes
|
||||
for node in machdep.dmi.system-vendor \
|
||||
machdep.dmi.system-version \
|
||||
machdep.dmi.bios-version \
|
||||
machdep.xen.version ; do
|
||||
if /sbin/sysctl -q $node; then
|
||||
nodeval="$(/sbin/sysctl -n $node | tr '[A-Z]' '[a-z]')"
|
||||
case "$nodeval" in
|
||||
*amazon*)
|
||||
val=YES
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
printf $val
|
||||
}
|
||||
|
||||
ec2_init=$(is_ec2)
|
||||
|
|
Loading…
Reference in New Issue