Многочисленные изменения оформленные в патчи

master
Mike Hiretsky 10 years ago
parent a49cdd8551
commit d28cf22e17

@ -6,11 +6,9 @@ depend() {
} }
KERNEL_VERSION=`uname -r` KERNEL_VERSION=`uname -r`
KERNEL_VERSION_CONF=${KERNEL_VERSION//./_} KERNEL_VERSION_CONF=
KERNEL_VERSION_CONF="modules_3"
MODULES_PATH="/lib/modules/${KERNEL_VERSION}" MODULES_PATH="/lib/modules/${KERNEL_VERSION}"
CONF_FILE="/etc/conf.d/modules" CONF_FILE="/etc/modules.load.d/cpufreq.conf"
# get variable value from cl-kernel (lib variable) # get variable value from cl-kernel (lib variable)
variable_value() variable_value()
{ {
@ -34,7 +32,7 @@ get_cpufreq_modules(){
then then
if [[ ${MODULES_STRING} ]]; if [[ ${MODULES_STRING} ]];
then then
MODULES_STRING="${MODULES_STRING} $module_name" MODULES_STRING="${MODULES_STRING}\n$module_name"
else else
MODULES_STRING=$module_name MODULES_STRING=$module_name
fi fi
@ -43,25 +41,10 @@ get_cpufreq_modules(){
done done
} }
# find cpu freq modules autoload string
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 cpu freq modules to modules autoload file # add cpu freq modules to modules autoload file
add_autoload_modules(){ add_autoload_modules(){
# get root type # get root type
local roottype=`variable_value os_root_type` local roottype=`variable_value os_root_type`
# if modules have not added yet
if find_string_modules;
then
sed -i "/${KERNEL_VERSION_CONF}=/d" ${CONF_FILE}
fi
ebegin "Added rules for cpu frequency" ebegin "Added rules for cpu frequency"
# detect cpufreq modules # detect cpufreq modules
get_cpufreq_modules get_cpufreq_modules
@ -69,7 +52,8 @@ add_autoload_modules(){
if [[ $roottype == "hdd" ]] if [[ $roottype == "hdd" ]]
then then
# append config string to conf file # append config string to conf file
echo ${KERNEL_VERSION_CONF}=\"${MODULES_STRING}\" >> ${CONF_FILE} [ -d /etc/modules.load.d ]] || mkdir /etc/modules.load.d
echo -e "${MODULES_STRING}" > ${CONF_FILE}
fi fi
} }

@ -254,6 +254,8 @@ class cl_builder(color_print):
def updatePortage(self,builderPath): def updatePortage(self,builderPath):
"""Change branch to master and update portage""" """Change branch to master and update portage"""
return True
if self.assembleIso: if self.assembleIso:
# restore resolv conf if needed # restore resolv conf if needed
resolvFile = "etc/resolv.conf" resolvFile = "etc/resolv.conf"

@ -310,7 +310,7 @@ class fillVars(object, varsShare):
x.split("=")[0].strip() == "os_linux_ver" and\ x.split("=")[0].strip() == "os_linux_ver" and\
x.split("=")[1].strip(), data)) x.split("=")[1].strip(), data))
if verList: if verList:
reVer=re.compile("^((\d+\.)*\d|\d+)$",re.S) reVer=re.compile("^((\d+\.)*\d+|\d+)$",re.S)
reRes = filter(reVer.search,verList) reRes = filter(reVer.search,verList)
if reRes: if reRes:
return reRes[0] return reRes[0]
@ -400,7 +400,9 @@ class fillVars(object, varsShare):
return "" return ""
def get_cl_builder_iso_path(self): def get_cl_builder_iso_path(self):
directory = "/var/calculate/tmp/iso" directory = \
"/var/calculate/tmp/iso-%s-%s"%(self.Get('os_builder_linux_shortname'),
self.Get('os_builder_arch_machine'))
newDirectoryName = directory newDirectoryName = directory
while path.exists(newDirectoryName): while path.exists(newDirectoryName):
newDirectoryName = "%s.%s"%(directory,genpassword(8)) newDirectoryName = "%s.%s"%(directory,genpassword(8))
@ -462,4 +464,5 @@ class fillVars(object, varsShare):
suffix = "calculate=,,timezone:%s"%(timezone) suffix = "calculate=,,timezone:%s"%(timezone)
elif lang: elif lang:
suffix = "calculate=lang:%s,keymap:%s" % (lang,lang) suffix = "calculate=lang:%s,keymap:%s" % (lang,lang)
print suffix
return suffix return suffix

@ -110,7 +110,9 @@ class cl_kernel(color_print):
standardParams = ["--splash=%s"%themeName, "--unionfs", standardParams = ["--splash=%s"%themeName, "--unionfs",
"--all-ramdisk-modules","--disklabel", "--all-ramdisk-modules","--disklabel",
"--no-save-config", "--firmware","--udev", "--no-save-config", "--firmware","--udev",
"--lspci"] "--lspci","--logfile=%s"%
path.join(clVars.Get('cl_kernel_src_path'),
"genkernel.log")]
kernelDir = ["--kerneldir=%s"%clVars.Get('cl_kernel_src_path')] kernelDir = ["--kerneldir=%s"%clVars.Get('cl_kernel_src_path')]
kernelDestination = clVars.Get('cl_kernel_install_path') kernelDestination = clVars.Get('cl_kernel_install_path')
modulePrefix = ["--module-prefix=%s"%kernelDestination] modulePrefix = ["--module-prefix=%s"%kernelDestination]
@ -279,45 +281,6 @@ class cl_kernel(color_print):
"vmlinuz":"vmlinuz-%s", "vmlinuz":"vmlinuz-%s",
"System.map":"System.map-%s"}[obj]%kernelUid) "System.map":"System.map-%s"}[obj]%kernelUid)
def createUidSymlinks(self):
"""Create link iniramfs-UUID,vmlinuz-UUID,System.map-UUID."""
if self.skipByChrootAndShortname():
return True
newInitrdName = self._getNewName("initramfs")
newInitrdNameInstall = self._getNewName("initramfs-install")
newKernelName = self._getNewName("vmlinuz")
newSystemMap = self._getNewName("System.map")
symlinkInitrdName = self._getSymlink("initramfs")
symlinkInitrdNameInstall = self._getSymlink("initramfs-install")
symlinkKernelName = self._getSymlink("vmlinuz")
symlinkSystemMap = self._getSymlink("System.map")
try:
self._installFile(newInitrdName,symlinkInitrdName, symlink=True)
self._installFile(newInitrdNameInstall,symlinkInitrdNameInstall,
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(
_("Failed to create a symlink to the current kernel:"
" %(error)s '%(filename)s'")%
{'error':e.strerror,'filename':e.filename})
self.printERROR(_("The kernel is probably not compiled"))
return False
except OSError,e:
self.printERROR(_("Failed to create a symlink to the "
"current kernel: %s")%
e.strerror)
return False
return True
def installBootFiles(self): def installBootFiles(self):
"""Copy -install files to without suffix name, and save old copy. """Copy -install files to without suffix name, and save old copy.

@ -202,9 +202,6 @@ class kernel_cmd(share_cmd):
if not self.logicObj.installBootFiles(): if not self.logicObj.installBootFiles():
self.printERROR(_("Failed to install the kernel")) self.printERROR(_("Failed to install the kernel"))
return False return False
if not self.logicObj.createUidSymlinks():
self.printERROR(_("Failed to create uid symlinks"))
return False
if not self.logicObj.versionMigrate(): if not self.logicObj.versionMigrate():
self.printERROR(_("Kernel nomenclature update failed")) self.printERROR(_("Kernel nomenclature update failed"))
return False return False
@ -222,9 +219,6 @@ class kernel_cmd(share_cmd):
def makeSymlink(self,options): def makeSymlink(self,options):
"""Set specified kernel to default""" """Set specified kernel to default"""
if not self.logicObj.createUidSymlinks():
self.printERROR(_("Failed to create uid symlinks"))
return False
if not self.logicObj.setKernelForCurrent(): if not self.logicObj.setKernelForCurrent():
self.printWARNING(_("Failed to modify '%s'")%"/usr/scr/linux") self.printWARNING(_("Failed to modify '%s'")%"/usr/scr/linux")
return False return False

@ -46,9 +46,6 @@ if __name__ == "__main__":
if options.v or options.filter or options.xml: if options.v or options.filter or options.xml:
kernel.printVars(options) kernel.printVars(options)
sys.exit(0) sys.exit(0)
# check root
if not kernel.isRoot():
sys.exit(1)
if options.initrd: if options.initrd:
kernel.cleanInitrd(options) kernel.cleanInitrd(options)

@ -62,13 +62,12 @@ def create_data_files(data_dirs, prefix="", replace_dirname=""):
return data_files return data_files
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): class cl_install_data(install_data):
def run (self): def run (self):
install_data.run(self) install_data.run(self)
data_file = [("/etc/init.d/calculate-builder",0755)] data_file = []
fileNames = map(lambda x: os.path.split(x[0])[1], data_file) 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) listNames = map(lambda x: filter(lambda y: y, x[0].split("/")),data_file)
data_find = {} data_find = {}

Loading…
Cancel
Save