Many bugfix. Added auxilary variables. Added templates fstab and grub.

master3.3
Mike Hiretsky 14 years ago
parent 56decdcf56
commit 17660c35ab

@ -13,7 +13,6 @@ import sys
from cl_utils import runOsCommand,isMount,removeDir,typeFile
from shutil import copyfile
from cl_template import _terms
from subprocess import Popen,PIPE
class DistributiveError(Exception):

@ -21,24 +21,33 @@ import os
import re
import sys
import cl_overriding
install_errors = ""
def installExit(*args,**kwars):
raise InstallError(globals()["install_errors"])
def overprintERROR(s):
globals()["install_errors"] += s +"\n"
cl_overriding.exit = installExit
cl_overriding.printERROR = overprintERROR
from cl_lang import lang
from cl_template import template
from cl_fill import clLocale
from cl_template import template
from cl_datavars import DataVars
from cl_print import color_print
from cl_distr import PartitionDistributive,DistributiveRepository,\
DistributiveError, ScratchDistributive
from time import sleep
import cl_overriding
from subprocess import Popen,PIPE
tr = lang()
tr.setGlobalDomain('cl_install')
tr.setLanguage(sys.modules[__name__])
def installExit(*args,**kwars):
raise InstallError("Processing template error")
cl_overriding.exit = installExit
class InstallError(Exception):
"""Installation Error"""
@ -63,7 +72,7 @@ class cl_install(color_print):
def __init__(self):
self.clVars = None
self.clTemp = None
self.clTempl = None
self.color = True
def colorPrint(self,*argv,**kwarg):
@ -85,10 +94,10 @@ class cl_install(color_print):
def applyTemplatesForSystem(self):
"""Apply templates for root of system."""
self.clVars.Set("cl_root_path","/", True)
self.clTemp = template(self.clVars)
dirsFiles = self.clTemp.applyTemplates()
if self.clTemp.getError():
self.printERROR(self.clTemp.getError())
self.clTempl = template(self.clVars)
dirsFiles = self.clTempl.applyTemplates()
if self.clTempl.getError():
self.printERROR(self.clTempl.getError())
return False
else:
return dirsFiles
@ -169,11 +178,10 @@ class cl_install(color_print):
def applyTemplates(self,directory):
"""Apply templates for root of system."""
self.clVars.Set("cl_root_path",directory, True)
self.clTemp = template(self.clVars)
dirsFiles = self.clTemp.applyTemplates()
if self.clTemp.getError():
self.printERROR(self.clTemp.getError())
return False
self.clTempl = template(self.clVars)
dirsFiles = self.clTempl.applyTemplates()
if self.clTempl.getError():
raise InstallError(self.clTempl.getError())
else:
return dirsFiles
@ -222,7 +230,7 @@ class cl_install(color_print):
"""
pipe = Popen(["/sbin/grub",
"--device-map=%s/boot/grub/device.map"%target.getDirectory(),
"--batch"], stdin=PIPE,stdout=PIPE)
"--batch"], stdin=PIPE, stdout=PIPE,stderr=PIPE)
pipe.stdin.write("root (hd%s)\n"%
self.getFieldByField("grub","install","/"))
# TODO: change hd0 for bootloader install to other disks
@ -279,16 +287,20 @@ class cl_install(color_print):
self.printWARNING("Interrupting the installation")
error = _("Installation manually interrupt")
try:
if self.clTempl:
self.clTempl.closeFiles()
if sourceDistr:
self.printSUCCESS(_("Releasing source distributive"))
sourceDistr.close()
if targetDistr:
self.printSUCCESS(_("Unmount target system volume"))
targetDistr.close()
except (InstallError,DistributiveError),e:
error = "%s\n%s" % (str(error),_("Unmouting error"))
except KeyboardInterrupt,e:
pass
if error:
for line in str(error).split('\n'):
for line in filter(lambda x: x,str(error).split('\n')):
self.printERROR(line)
return False
self.printSUCCESS(_("System successfully installed"))

@ -1,2 +1,2 @@
# Calculate belong()!=&&pkg(sys-boot/grub)!= path=/boot/grub
# Calculate belong()!=&&pkg(sys-boot/grub)!= path=/boot

@ -3,10 +3,10 @@ default 0
fallback 1
#?os_linux_ver<9.8#
splashimage=(hd#-disk(/boot,grub)-#)/boot/grub/calculate.xpm.gz
#linuxver#
#os_linux_ver#
#?os_linux_ver>=9.8#
splashimage=(hd#-disk(/boot,grub)-#)/boot/grub/grub-calculate.xpm.gz
#linuxver#
#os_linux_ver#
#?os_linux_system==desktop&&os_linux_subname!=#
title #-os_linux_name-# #-os_arch_machine-# #-os_linux_ver-# #-os_linux_subname-#
@ -14,20 +14,21 @@ title #-os_linux_name-# #-os_arch_machine-# #-os_linux_ver-# #-os_linux_subname-
#?os_linux_system==desktop&&os_linux_subname==#
title #-os_linux_name-# #-os_arch_machine-# #-os_linux_ver-#
#os_linux_system#
#?os_linux_system=server#
#?os_linux_system==server#
title #-os_linux_name-# #-os_arch_machine-# #-os_linux_ver-#
#os_linux_system#
root (hd#-disk(/boot,grub)-#)
#?os_linux_system=desktop#
kernel /boot/vmlinuz root=#-root_install_set-# video=uvesafb:ywrap,1024x768-32@60,mtrr:3,splash=silent,theme:tty1 CONSOLE=/dev/tty1 udev quiet #-os_kernel_resume-# elevator=#-os_kernel_scheduler-# doscsi#-os_kernel_attr-#
#?os_linux_system==desktop#
kernel /boot/vmlinuz root=#-os_root_dev-# video=uvesafb:ywrap,1024x768-32@60,mtrr:3,splash=silent,theme:tty1 CONSOLE=/dev/tty1 udev quiet #-os_kernel_resume-# elevator=#-os_kernel_scheduler-# doscsi#-os_kernel_attr-#
#os_linux_system#
#?os_linux_system=server&os_linux_shortname!=CSS#
kernel /boot/vmlinuz root=#-root_install_set-# video=uvesafb:ywrap,1024x768-32@60,mtrr:3,splash=silent,theme:tty1 CONSOLE=/dev/tty1 udev quiet #-os_kernel_resume-# elevator=#-os_kerenl_scheduler-# doscsi#-os_kernel_attr-#
#?os_linux_system==server&&os_linux_shortname!=CSS#
kernel /boot/vmlinuz root=#-os_root_dev-# video=uvesafb:ywrap,1024x768-32@60,mtrr:3,splash=silent,theme:tty1 CONSOLE=/dev/tty1 udev quiet #-os_kernel_resume-# elevator=#-os_kerenl_scheduler-# doscsi#-os_kernel_attr-#
#os_linux_system#
#?os_linux_shortname=CSS#
kernel /boot/vmlinuz root=#-root_install_set-# video=uvesafb:ywrap,1024x768-32@60,mtrr:3 udev quiet #-os_kernel_resume-# elevator=#-os_kernel_scheduler-# doscsi#-os_kernel_attr-#
#?os_linux_shortname==CSS#
kernel /boot/vmlinuz root=#-os_root_dev-# video=uvesafb:ywrap,1024x768-32@60,mtrr:3 udev quiet #-os_kernel_resume-# elevator=#-os_kernel_scheduler-# doscsi#-os_kernel_attr-#
#os_linux_shortname#
initrd /boot/initrd
#-os_grub_info-#
# Uncomment if you have Windows on hard disk

@ -1,2 +1,2 @@
# Calculate belong()!=&&pkg(sys-apps/openrc)!= append=skip path=/etc
# Calculate belong()!=&&pkg(sys-apps/openrc)!= name=etc

Loading…
Cancel
Save