|
|
|
@ -25,6 +25,7 @@ import string
|
|
|
|
|
from time import sleep
|
|
|
|
|
from subprocess import PIPE,STDOUT
|
|
|
|
|
from shutil import copy2
|
|
|
|
|
from calculate.core.server.task_set import TaskSet
|
|
|
|
|
from calculate.lib.utils.files import (runOsCommand,pathJoin,
|
|
|
|
|
isMount,process,listDirectory,STDOUT,
|
|
|
|
|
checkUtils,readFile,find,copyWithPath,
|
|
|
|
@ -63,15 +64,15 @@ class InstallError(Exception):
|
|
|
|
|
from migrate_users import migrate, currentUsers, MigrationError
|
|
|
|
|
from calculate.lib.encrypt import encrypt
|
|
|
|
|
|
|
|
|
|
_ = lambda x:x
|
|
|
|
|
from calculate.lib.cl_lang import setLocalTranslate,getLazyLocalTranslate
|
|
|
|
|
setLocalTranslate('cl_install3',sys.modules[__name__])
|
|
|
|
|
__ = getLazyLocalTranslate(_)
|
|
|
|
|
|
|
|
|
|
class Install:
|
|
|
|
|
class Install(TaskSet):
|
|
|
|
|
"""Primary class for templates appling and system installation"""
|
|
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
|
self.clVars = None
|
|
|
|
|
def init(self):
|
|
|
|
|
# refresh information about LVM
|
|
|
|
|
refreshLVM()
|
|
|
|
|
# refresh information about device in udevadm info
|
|
|
|
@ -308,17 +309,17 @@ class Install:
|
|
|
|
|
grubProcess = process(cmdGrub,
|
|
|
|
|
"--device-map=%s/boot/grub/device.map"%target.getDirectory(),
|
|
|
|
|
"--batch",stderr=STDOUT)
|
|
|
|
|
bootDisk = self.Select('os_install_disk_grub',
|
|
|
|
|
where='os_install_disk_mount',
|
|
|
|
|
_in=('/','/boot'),
|
|
|
|
|
sort='DESC',limit=1)
|
|
|
|
|
bootDisk = self.clVars.Select('os_install_disk_grub',
|
|
|
|
|
where='os_install_disk_mount',
|
|
|
|
|
_in=('/', '/boot'),
|
|
|
|
|
sort='DESC', limit=1)
|
|
|
|
|
if not bootDisk:
|
|
|
|
|
raise DistributiveError(_("Failed to determine the boot disk"))
|
|
|
|
|
self.setActivePartition(bootDisk)
|
|
|
|
|
for mbrDisk in self.clVars.Get('os_install_mbr'):
|
|
|
|
|
mbrDiskNum = self.Select("os_device_map",
|
|
|
|
|
where="os_device_dev",
|
|
|
|
|
eq=mbrDisk)
|
|
|
|
|
mbrDiskNum = self.clVars.Select("os_device_map",
|
|
|
|
|
where="os_device_dev",
|
|
|
|
|
eq=mbrDisk)
|
|
|
|
|
if not mbrDiskNum and mbrDiskNum != 0:
|
|
|
|
|
raise DistributiveError(_("Failed to determine mbr"))
|
|
|
|
|
for line in ("root (hd%s)"%bootDisk,
|
|
|
|
@ -479,7 +480,7 @@ class Install:
|
|
|
|
|
"""
|
|
|
|
|
res = True
|
|
|
|
|
for disk in self.clVars.Select('os_disk_dev',
|
|
|
|
|
where='os_disk_format',like='ntfs'):
|
|
|
|
|
where='os_disk_format', like='ntfs'):
|
|
|
|
|
mountDir = self._getFreeDirectory('/var/lib/calculate/mount.ntfs')
|
|
|
|
|
try:
|
|
|
|
|
os.mkdir(mountDir)
|
|
|
|
@ -523,6 +524,3 @@ class Install:
|
|
|
|
|
"""
|
|
|
|
|
distr.close()
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def mytest(self):
|
|
|
|
|
return False
|
|
|
|
|