/[gli]/trunk/src/GLIArchitectureTemplate.py
Gentoo

Diff of /trunk/src/GLIArchitectureTemplate.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 130 Revision 131
1""" 1"""
2Gentoo Linux Installer 2Gentoo Linux Installer
3 3
4$Id: GLIArchitectureTemplate.py,v 1.11 2004/11/16 06:59:51 agaffney Exp $ 4$Id: GLIArchitectureTemplate.py,v 1.12 2004/11/16 07:07:59 agaffney Exp $
5Copyright 2004 Gentoo Technologies Inc. 5Copyright 2004 Gentoo Technologies Inc.
6 6
7 7
8The ArchitectureTemplate is largely meant to be an abstract class and an 8The ArchitectureTemplate is largely meant to be an abstract class and an
9interface (yes, it is both at the same time!). The purpose of this is to create 9interface (yes, it is both at the same time!). The purpose of this is to create
808 return (start_sector, end_sector) 808 return (start_sector, end_sector)
809 809
810 def _sectors_to_megabytes(self, sectors, sector_bytes=512): 810 def _sectors_to_megabytes(self, sectors, sector_bytes=512):
811 return float((float(sectors) * sector_bytes)/ float(1024*1024)) 811 return float((float(sectors) * sector_bytes)/ float(1024*1024))
812 812
813 def _sectors_to_kibibytes(self, sectors, sector_bytes=512): 813 def _sectors_to_bytes(self, sectors, sector_bytes=512):
814 return float((sectors * sector_bytes) / 1000) 814 return (int(sectors) * sector_bytes)
815 815
816 def _run_parted_command(self, device, cmd): 816 def _run_parted_command(self, device, cmd):
817 parted_output = commands.getoutput("parted -s " + device + " " + cmd) 817 parted_output = commands.getoutput("parted -s " + device + " " + cmd)
818 print "parted -s " + device + " " + cmd 818 print "parted -s " + device + " " + cmd
819 819
899 total_sectors = end - start + 1 899 total_sectors = end - start + 1
900 commands.getstatus("resize2fs " + device + str(minor) + " " + str(total_sectors) + "s") 900 commands.getstatus("resize2fs " + device + str(minor) + " " + str(total_sectors) + "s")
901 print "resize2fs " + device + str(minor) + " " + str(total_sectors) + "s" 901 print "resize2fs " + device + str(minor) + " " + str(total_sectors) + "s"
902 elif type == "ntfs": 902 elif type == "ntfs":
903 total_sectors = end - start + 1 903 total_sectors = end - start + 1
904 total_kibibytes = int(self._sectors_to_kibibytes(total_sectors)) 904 total_bytes = int(self._sectors_to_bytes(total_sectors))
905 commands.getstatus("ntfsresize --size " + str(total_kibibytes) + "k " + device + str(minor)) 905 commands.getstatus("ntfsresize --size " + str(total_bytes) + " " + device + str(minor))
906 print "ntfsresize --size " + str(total_kibibytes) + "k " + device + str(minor) 906 print "ntfsresize --size " + str(total_bytes) + " " + device + str(minor)
907 else: 907 else:
908 start = float(self._sectors_to_megabytes(start)) 908 start = float(self._sectors_to_megabytes(start))
909 end = float(self._sectors_to_megabytes(end)) 909 end = float(self._sectors_to_megabytes(end))
910 self._run_parted_command(device, "resize " + str(minor) + " " + str(start) + " " + str(end)) 910 self._run_parted_command(device, "resize " + str(minor) + " " + str(start) + " " + str(end))
911 print " Deleting old minor " + str(part) + " to be recreated in 3rd pass" 911 print " Deleting old minor " + str(part) + " to be recreated in 3rd pass"

Legend:
Removed from v.130  
changed lines
  Added in v.131

  ViewVC Help
Powered by ViewVC 1.1.20