Blob Blame History Raw
#!/bin/sh

# Convert an lm_sensors service configuration file from the old convention
# (MODULE_0, MODULE_1...) to the new convention (HWMON_MODULES).
#
# Copyright (C) 2009  Jean Delvare <jdelvare@suse.de>
#
# Released without a license on purpose. This is public domain code, so
# that package maintainers can include it in their post-install script.

CONFIG=/etc/sysconfig/lm_sensors
test -r "$CONFIG" || exit 0

unset ${!MODULE_*} $HWMON_MODULES
. "$CONFIG"
test -n "$HWMON_MODULES" && exit 0

for i in ${!MODULE_*} ; do
	eval module=\$$i
	if test -z "$HWMON_MODULES" ; then
		HWMON_MODULES="$module"
	else
		HWMON_MODULES="$HWMON_MODULES $module"
	fi
done
test -z "$HWMON_MODULES" && exit 0

echo >> "$CONFIG"
echo "# New configuration format generated by sysconfig-lm_sensors-convert" >> "$CONFIG"
echo "HWMON_MODULES=\"$HWMON_MODULES\"" >> "$CONFIG"