cpupower: Use 'performance' instead of '<not_supported>' on failure

At least, it will be easier to start the service this way, although
this does not solve bug #4810 yet.
This commit is contained in:
Eugene Shatokhin 2015-02-09 21:00:36 +03:00
parent 1f160d2b5e
commit 85fcd22a4c

View file

@ -29,7 +29,7 @@
%define rpmrel %mkrel 0.%{kpatch}.%{mibrel}
%endif
%else
%define rpmrel 1
%define rpmrel 2
%endif
# fakerel and fakever never change, they are used to fool
@ -1034,12 +1034,14 @@ CFG_FILE=%{_sysconfdir}/sysconfig/cpupower
if ! [ -e "${AVAIL_FILE}" ]; then
echo "Warning: CPU frequency scaling is not supported."
sed -i 's/@GOVERNOR@/<not_supported>/g' "${CFG_FILE}"
echo "Setting 'performance' governor as the default, just in case."
sed -i 's/@GOVERNOR@/performance/g' "${CFG_FILE}"
exit 0
fi
# Set "ondemand" or "powersave" by default. Do not enable cpupower.service
# if neither are supported.
# Set "ondemand" or "powersave" by default, if they are supported,
# "performance" otherwise.
# ? Perhaps it is better to do this in runtime rather than here?
if grep "ondemand" "${AVAIL_FILE}" >/dev/null 2>&1; then
echo "Info: setting 'ondemand' governor as the default."
sed -i 's/@GOVERNOR@/ondemand/g' "${CFG_FILE}"
@ -1047,10 +1049,10 @@ elif grep "powersave" "${AVAIL_FILE}" >/dev/null 2>&1; then
echo "Info: setting 'powersave' governor as the default."
sed -i 's/@GOVERNOR@/powersave/g' "${CFG_FILE}"
else
echo -n "Warning: not setting the default governor. Available governors:"
echo -n "Info: setting 'performance' governor as the default."
cat "${AVAIL_FILE}"
echo
sed -i 's/@GOVERNOR@/<not_supported>/g' "${CFG_FILE}"
sed -i 's/@GOVERNOR@/performance/g' "${CFG_FILE}"
exit 0
fi