Added variables for disk drives

master3.3
Mike Hiretsky 14 years ago
parent 948e65259c
commit 3520ad2ecb

@ -348,8 +348,17 @@ class PartitionDistributive(Distributive):
def formatPartition(self,format=""): def formatPartition(self,format=""):
"""Format partition""" """Format partition"""
if isMount(self.partition) == '/':
raise DistributiveError(
"Cann't format root partition %s" %
self.partition)
if isMount(self.partition):
raise DistributiveError(
"Cann't format partition %s, because it is mounted" %
self.partition)
# TODO: need multipartition formating # TODO: need multipartition formating
res,errmes = self.runOsCommand("/sbin/mkfs.reiserfs -f %s" % self.partition) res,errmes = self.runOsCommand("/sbin/mkfs.reiserfs -f %s" %
self.partition)
if res == 0: if res == 0:
return True return True
else: else:
@ -367,9 +376,10 @@ class PartitionDistributive(Distributive):
raise DistributiveError("Wrong partition name '%s'"%self.partition) raise DistributiveError("Wrong partition name '%s'"%self.partition)
pipe = Popen(["/sbin/grub", pipe = Popen(["/sbin/grub",
"--device-map=%s/boot/grub/device.map"%self.getDirectory(), "--device-map=%s/boot/grub/device.map"%self.getDirectory(),
"--batch"], stdin=subprocess.PIPE,stdout=subprocess.PIPE) "--no-floppy",
pipe.stdin.write("root (hd%d,%d)\n"%(hddNum,partitionNum)) "--batch"], stdin=PIPE,stdout=PIPE)
# TODO: change hd0 for bootloader install to other disks # TODO: change hd0 for bootloader install to other disks
pipe.stdin.write("root (hd%d,%d)\n"%(hddNum,partitionNum))
pipe.stdin.write("setup (hd0)\n") pipe.stdin.write("setup (hd0)\n")
pipe.stdin.write("quit\n") pipe.stdin.write("quit\n")
pipe.stdin.close() pipe.stdin.close()

@ -95,9 +95,8 @@ class cl_install(color_print):
def printInfo(self,sourceDistr,targetDistr): def printInfo(self,sourceDistr,targetDistr):
self.printSUCCESS(_("Installation %s %s")% self.printSUCCESS(_("Installation %s %s")%
("<needed>","<needed>")) (self.clVars.Get('os_linux_name'),
# (self.clVars.Get('os_linux_name'), self.clVars.Get('os_linux_subname')))
# self.clVars.Get('os_linux_subname')))
self.defaultPrint(_("System information\n")) self.defaultPrint(_("System information\n"))
self.printSUCCESS(_("Computer name")+": %s"% self.printSUCCESS(_("Computer name")+": %s"%
self.clVars.Get('os_net_hostname')) self.clVars.Get('os_net_hostname'))
@ -106,8 +105,7 @@ class cl_install(color_print):
self.printSUCCESS(_("Network devices")+": %s"% self.printSUCCESS(_("Network devices")+": %s"%
self.clVars.Get("os_net_interfaces_info")) self.clVars.Get("os_net_interfaces_info"))
self.printSUCCESS(_("Installed system")+": %s %s"% self.printSUCCESS(_("Installed system")+": %s %s"%
(self.clVars.Get('os_linux_name'), (self.old_os_linux_name, self.old_os_linux_ver))
self.clVars.Get('os_linux_ver')))
self.defaultPrint(_("Hardware\n")) self.defaultPrint(_("Hardware\n"))
self.printSUCCESS(_("Machine hardware name")+": %s"% self.printSUCCESS(_("Machine hardware name")+": %s"%
self.clVars.Get('os_arch_machine')) self.clVars.Get('os_arch_machine'))
@ -184,10 +182,13 @@ class cl_install(color_print):
try: try:
targetDistr = self.getTargetDistributive(disk,buildermode) targetDistr = self.getTargetDistributive(disk,buildermode)
distRep = DistributiveRepository('/usr/calculate/share/linux') distRep = DistributiveRepository('/usr/calculate/share/linux')
osname = osname or self.clVars.Get('os_linux_shortname') self.old_os_linux_name = self.clVars.Get('os_linux_shortname')
self.old_os_linux_ver = self.clVars.Get('os_linux_ver')
if osname:
self.clVars.Set('os_linux_shortname',osname.upper())
sourceDistr = distRep.getLastDistributive( sourceDistr = distRep.getLastDistributive(
march=self.clVars.Get('os_arch_machine'), march=self.clVars.Get('os_arch_machine'),
shortname=osname.lower()) shortname=self.clVars.Get('os_linux_shortname').lower())
if sourceDistr: if sourceDistr:
# print info # print info
self.printInfo(sourceDistr,targetDistr) self.printInfo(sourceDistr,targetDistr)
@ -211,6 +212,7 @@ class cl_install(color_print):
self.prepareBoot(targetDistr) self.prepareBoot(targetDistr)
else: else:
self.printWARNING("No update available.") self.printWARNING("No update available.")
return False
except (InstallError,DistributiveError),e: except (InstallError,DistributiveError),e:
error = e error = e
@ -223,7 +225,7 @@ class cl_install(color_print):
self.printSUCCESS(_("Releasing source distributive")) self.printSUCCESS(_("Releasing source distributive"))
sourceDistr.close() sourceDistr.close()
if targetDistr: if targetDistr:
self.printSUCCESS(_("Unmount installed system volume")) self.printSUCCESS(_("Unmount target system volume"))
targetDistr.close() targetDistr.close()
except KeyboardInterrupt,e: except KeyboardInterrupt,e:
pass pass

@ -31,7 +31,56 @@ class Data:
# program version # program version
cl_ver = {'value':'2.2.0'} cl_ver = {'value':'2.2.0'}
# maching architecture
os_arch_machine = {'mode':'w'} os_arch_machine = {'mode':'w'}
# inforamation about net interfaces
os_net_interfaces_info = {} os_net_interfaces_info = {}
# list of available partition devices
os_disk_dev = {}
# list mounted points for installed system
os_disk_install = {}
# list mounted points for current operation system
os_disk_load = {}
# list filesystem for partition devices
os_disk_format = {}
# list uudi for partition devices
os_disk_uuid = {}
# list grub id for partition devices
os_disk_grub = {}
# type of partition devices (primary, extended or logical)
os_disk_part = {}
# partition size
os_disk_size = {}
# label of partitions
os_disk_name = {}
# devices
os_device_dev = {}
# device type (hdd,cdrom,usb-flash)
os_device_type = {}
# map number for grub
os_device_map = {}
# part of current grub.conf
os_grub_info = {}
# content of device.map file for grub
os_grub_devicemap_info = {}
# information about mount points for fstab
os_fstab_mount_info = {}
# information about swap for fstab
os_fstab_swap_info = {}

Loading…
Cancel
Save