Added daemon for detect cpu freq modules.

master
Mike Hiretsky 14 years ago
parent 10deb927f2
commit ccb3a84c36

@ -0,0 +1,64 @@
#!/sbin/runscript
depend() {
need modules
}
KERNEL_VERSION=`uname -r`
KERNEL_VERSION_CONF=${KERNEL_VERSION//./_}
KERNEL_VERSION_CONF="modules_${KERNEL_VERSION_CONF//-/_}"
MODULES_PATH="/lib/modules/${KERNEL_VERSION}"
CONF_FILE="/etc/conf.d/modules"
get_cpufreq_modules(){
MODULES_STRING=""
for path in $(find $MODULES_PATH -name cpufreq)
do
for module_path in $(find $path -name *.ko)
do
module_name=${module_path##\/*\/}
module_name=${module_name%.ko}
if modprobe $module_name &>/dev/null;
then
if [[ ${MODULES_STRING} ]];
then
MODULES_STRING="${MODULES_STRING} $module_name"
else
MODULES_STRING=$module_name
fi
fi
done
done
}
find_string_modules(){
find_string=$(awk "/^\s*[^#]*\s*${KERNEL_VERSION_CONF}/ {print}" < ${CONF_FILE})
if [[ -n $find_string ]];
then
return 0
fi
return 1
}
add_autoload_modules(){
if ! find_string_modules;
then
ebegin "Added rules for cpu frequency"
get_cpufreq_modules
echo ${KERNEL_VERSION_CONF}=\"${MODULES_STRING}\" >> ${CONF_FILE}
else
ebegin "Cpu frequency modules already detected"
fi
}
start() {
add_autoload_modules
eend
}
stop() {
if rc-update show boot | grep -q calculate-builder
then
rc-update del calculate-builder boot
fi
}

@ -256,6 +256,11 @@ class cl_kernel(color_print):
symlink=True)
self._installFile(newKernelName,symlinkKernelName, symlink=True)
self._installFile(newSystemMap, symlinkSystemMap, symlink=True)
builderDaemon='/etc/init.d/calculate-builder'
bootRunlevel='/etc/runlevels/boot/calculate-builder'
if not path.lexists(bootRunlevel):
os.symlink(builderDaemon,bootRunlevel)
except IOError,e:
self.printERROR(
_("Can not create symlink to current kernel: %s '%s'")%

@ -67,12 +67,13 @@ def create_data_files(data_dirs, prefix="", replace_dirname=""):
data_files += create_data_files(data_dirs_share, share_calculate_dir)
data_files += [('/usr/share/calculate/config', ['data/chroot.rc',])]
data_files += [('/usr/share/calculate/config', ['data/chroot.rc']),
('/etc/init.d', ['data/calculate-builder'])]
class cl_install_data(install_data):
def run (self):
install_data.run(self)
data_file = []
data_file = [("/etc/init.d/calculate-builder",0755)]
fileNames = map(lambda x: os.path.split(x[0])[1], data_file)
listNames = map(lambda x: filter(lambda y: y, x[0].split("/")),data_file)
data_find = {}

Loading…
Cancel
Save