This shell script searches for suitable configuration files due to systems DMI data and installs them. --- Index: sensors/prog/detect/install.sh =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ sensors/prog/detect/install.sh 2010-03-31 22:00:20.015242241 +0200 @@ -0,0 +1,58 @@ +#!/bin/bash + +SYSFS_PATH=/sys/class/dmi/id +CONF_PATH=/var/lib/sensors/conf +INSTALL_FILE=/etc/sensors.d/automobo.conf + +BOARD_VENDOR=`cat $SYSFS_PATH/board_vendor` +BOARD_NAME=`cat $SYSFS_PATH/board_name` +BOARD_VERSION=`cat $SYSFS_PATH/board_version` +SYS_VENDOR=`cat $SYSFS_PATH/sys_vendor` +PRODUCT_NAME=`cat $SYSFS_PATH/product_name` +PRODUCT_VERSION=`cat $SYSFS_PATH/product_version` + +# only for testing +#BOARD_VENDOR=Fujitsu +#BOARD_NAME=D2312C1 +#BOARD_VERSION=1.0 +#SYS_VENDOR=Fujitsu +#PRODUCT_NAME=D2312D2 +#PRODUCT_VERSION=2.0 + +SEARCH_BOARD_VERSION=$CONF_PATH"/"$BOARD_VENDOR"_"$BOARD_NAME"_"$BOARD_VERSION +SEARCH_BOARD=$CONF_PATH"/"$BOARD_VENDOR"_"$BOARD_NAME +SEARCH_SYS_VERSION=$CONF_PATH"/"$SYS_VENDOR"_"$PRODUCT_NAME"_"$PRODUCT_VERSION +SEARCH_SYS=$CONF_PATH"/"$SYS_VENDOR"_"$PRODUCT_NAME + +echo "Looking for config: $SEARCH_BOARD_VERSION" +if [ -h "$SEARCH_BOARD_VERSION" ]; then + echo "Found suitable config" + cp -f $SEARCH_BOARD_VERSION $INSTALL_FILE + exit 0 +fi + +echo "Looking for config: $SEARCH_BOARD" +if [ -h "$SEARCH_BOARD" ]; then + echo "Found suitable config" + cp -f $SEARCH_BOARD $INSTALL_FILE + exit 0 +fi + +echo "Looking for config: $SEARCH_SYS_VERSION" +if [ -h "$SEARCH_SYS_VERSION" ]; then + echo "Found suitable config" + cp -f $SEARCH_SYS_VERSION $INSTALL_FILE + exit 0 +fi + +echo "Looking for config: $SEARCH_SYS" +if [ -h "$SEARCH_SYS" ]; then + echo "Found suitable config" + cp -f $SEARCH_SYS $INSTALL_FILE + exit 0 +fi + +echo "Could not find a suitable config" +rm -f $INSTALL_FILE + +exit 1 _______________________________________________ lm-sensors mailing list lm-sensors@xxxxxxxxxxxxxx http://lists.lm-sensors.org/mailman/listinfo/lm-sensors