summaryrefslogtreecommitdiff
path: root/prog/init/sysconfig-lm_sensors-convert
blob: 6a2e68c2c92d4b741c5e522edda91afd281f2bef (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
#!/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 <khali@linux-fr.org>
#
# 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"