summaryrefslogtreecommitdiffstats
path: root/abs
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2011-08-26 17:20:46 (GMT)
committerJames Meyer <james.meyer@operamail.com>2011-08-26 17:23:58 (GMT)
commitb99a6e96e555c1cbecd56b536abb324e9b6859f8 (patch)
treeddf395a4d2c4beec1b5f3e7020eda7dfa5893c7a /abs
parent14b4d549c02c3480230858551b99e380d43180de (diff)
downloadlinhes_pkgbuild-b99a6e96e555c1cbecd56b536abb324e9b6859f8.zip
linhes_pkgbuild-b99a6e96e555c1cbecd56b536abb324e9b6859f8.tar.gz
linhes_pkgbuild-b99a6e96e555c1cbecd56b536abb324e9b6859f8.tar.bz2
linhes-config: align disk partitions at 2048. Some drives report 512 sector size, when they are in fact 4k. By aligning at 2048 is works for both legacy 512 and 4k.
Diffstat (limited to 'abs')
-rw-r--r--abs/core/LinHES-config/PKGBUILD4
-rwxr-xr-xabs/core/LinHES-config/mv_install.py11
2 files changed, 11 insertions, 4 deletions
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 865ba40..66d1d42 100644
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-config
pkgver=2.3
-pkgrel=4
+pkgrel=5
conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
pkgdesc="Install and configure your system"
depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
@@ -101,7 +101,7 @@ build() {
install -m 0755 issue $startdir/pkg/etc/issue
}
-md5sums=('3cf9277d2a205ef20b75d5f8b36d4f0d'
+md5sums=('b078307bd347cba80978511b0e75b68a'
'16b98fcb3753ef6cfc35075c326d30e4'
'e36da536dd651ef182e7642337889e77'
'985891a43f7c4c983eb2a362162f1a0f'
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index c032aad..e774521 100755
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -263,6 +263,7 @@ def create_partitions(diskdevice, size, ptype, startsector):
newstart = 0
totalused = 0
device = parted.getDevice(diskdevice)
+ logging.debug("Sector size is %s %s", %( diskdevice , device.sectorSize))
partdisk = parted.Disk(device)
for partition in partdisk.partitions:
if partition.type != parted.PARTITION_FREESPACE:
@@ -280,7 +281,7 @@ def create_partitions(diskdevice, size, ptype, startsector):
newstart = usedend+1
if startsector == 0:
- newstart = 0
+ newstart = 2048
if size == "ALL":
logging.debug(" Using the rest of the disk %s", (device.length-newstart) )
try:
@@ -292,6 +293,10 @@ def create_partitions(diskdevice, size, ptype, startsector):
# convert size in MB to a length on the device in sectors
length = (int(size) * (1024 * 1024)) / device.sectorSize
logging.debug("Size is %s", length)
+ if length > device.length:
+ length = device.length - newstart
+ logging.info("Size is larger then disk, reducing size")
+ logging.debug("New Size is %s", length)
try:
geom = parted.Geometry(device=device, start=newstart, length=length)
except:
@@ -299,7 +304,9 @@ def create_partitions(diskdevice, size, ptype, startsector):
error_out("invalid parition size")
#collect device constraint
- constraint = device.getConstraint()
+ #constraint = device.getConstraint()
+ #constraint = parted.Constraint(device=device)
+ constraint = parted.Constraint(exactGeom = geom )
# new partition
if ptype == "NORMAL":
newpart = parted.Partition(disk=partdisk, type=parted.PARTITION_NORMAL, geometry=geom)