37 lines
1.1 KiB
Bash
37 lines
1.1 KiB
Bash
#!/bin/bash
|
|
#
|
|
# machine - detects specific hardware platforms (mostly notebooks)
|
|
#
|
|
# Copyright (c) 2008-2010 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
|
#
|
|
|
|
[ -e /etc/sysconfig/machine ] && . /etc/sysconfig/machine
|
|
|
|
function getdmivar() {
|
|
local dmivalue
|
|
[ $1 ] || return 0
|
|
|
|
dmivalue=`/usr/sbin/dmidecode -s $1 2>/dev/null | head -n1`
|
|
echo $dmivalue
|
|
return 0
|
|
}
|
|
|
|
[ -e /var/lib/dbus/machine-id ] && DBUS_ID=`cat /var/lib/dbus/machine-id`
|
|
|
|
[ "$DBUS_ID" ] || dbus-uuidgen > /var/lib/dbus/machine-id
|
|
|
|
[ "$SYSTEM_MANUFACTURER" = "`getdmivar system-manufacturer`" -a \
|
|
"$SYSTEM_PRODUCT_NAME" = "`getdmivar system-product-name`" -a \
|
|
"$BIOS_VENDOR" = "`getdmivar bios-vendor`" ] && exit 0
|
|
|
|
cat > /etc/sysconfig/machine << _EOF
|
|
BIOS_VENDOR="`getdmivar bios-vendor`"
|
|
BIOS_VERSION="`getdmivar bios-version`"
|
|
BIOS_RELEASE_DATE="`getdmivar bios-release-date`"
|
|
SYSTEM_MANUFACTURER="`getdmivar system-manufacturer`"
|
|
SYSTEM_PRODUCT_NAME="`getdmivar system-product-name`"
|
|
SYSTEM_VERSION="`getdmivar system-version`"
|
|
SYSTEM_SERIAL_NUMBER="`getdmivar system-serial-number`"
|
|
SYSTEM_UUID="`getdmivar system-serial-uuid`"
|
|
_EOF
|