From 649b5da147f6d2107142c596c915f23b06f9bea1 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 29 Jun 2009 11:28:57 -0500
Subject: linhes-config: set first parition to active on new installs.

---
 abs/core-testing/LinHES-config/PKGBUILD      |  2 +-
 abs/core-testing/LinHES-config/mv_install.py | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 8a17408..984926b 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.0
-pkgrel=29
+pkgrel=31
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev )
 pkgdesc="Install and configure your system"
 depends=(bc libstatgrab  mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates rsync python-parted ddcxinfo)
diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py
index 9d70a55..e96dd56 100755
--- a/abs/core-testing/LinHES-config/mv_install.py
+++ b/abs/core-testing/LinHES-config/mv_install.py
@@ -307,6 +307,19 @@ def create_partitions(diskdevice, size, ptype, startsector):
                 (newpart.getDeviceNodeName(),  newpart.getSize(),  diskdevice))
     return newpart.getDeviceNodeName()
 
+def set_active_parition(diskdevice):
+        """ Set the bootable flag for this partition. """
+        logging.debug("    Setting active parition")
+        device = parted.getDevice(diskdevice)
+        partdisk = parted.Disk(device)
+        try:
+            for partition in partdisk.partitions:
+                partition.setFlag(parted.PARTITION_BOOT)
+            partdisk.commit()
+        except:
+            logging.info("    Couldn't set the active partition")
+            logging.info("    Depending on your system this may not matter")
+
 
 def partition_disk():
     global hostoptions
@@ -319,6 +332,7 @@ def partition_disk():
     label = "data"
     partitions_removeall("/dev/"+datadisk, label)
     hostoptions["rootpartition"] = create_partitions("/dev/"+rootdisk, hostoptions["rootsize"], "NORMAL", 0)
+    set_active_parition("/dev/"+rootdisk)
     hostoptions["swappartition"] = create_partitions("/dev/"+rootdisk, hostoptions["swapsize"], "SWAP", 1)
     if datadisk != rootdisk:
         hostoptions["datapartition"] = create_partitions("/dev/"+datadisk, hostoptions["datasize"], "NORMAL", 0)
-- 
cgit v0.12