From 7b556fcdbe7739d97221009e3c291d2ae7c2b4a5 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Mon, 14 Nov 2011 17:12:12 -0600
Subject: linhes-config:  Systems with memory less then 1GB sometimes will have
 problems with an install. The OOM if needed will kill off a process, most of
 the time unsquashfs.  This causes problems later on, when doing work in the
 chroot.

- catch  unsquashfs errors
- try to mount swap space if present.
---
 abs/core/LinHES-config/PKGBUILD      |  4 ++--
 abs/core/LinHES-config/mv_install.py | 23 +++++++++++++++++++++--
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index da17287..cc8b151 100644
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=45
+pkgrel=46
 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=('6259677916192a92d1adf47b276f7829'
+md5sums=('6c0cbf0207f39a961d78861215109044'
          '16b98fcb3753ef6cfc35075c326d30e4'
          'e36da536dd651ef182e7642337889e77'
          '985891a43f7c4c983eb2a362162f1a0f'
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index cc4e4a6..e251291 100755
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -420,6 +420,9 @@ def mount_it():
 #   Mount root
     cmd = "mount /dev/%s %s"  %(hostoptions["rootpartition"], mountpoint)
     runcmd(cmd)
+
+
+
     #logging.debug(cmd)
     #cmdout=commands.getoutput(cmd)
     #logging.debug(cmdout)
@@ -457,6 +460,10 @@ def unmount_it():
     cmd = "sync"
     runcmd(cmd)
 
+def swapon():
+    logging.info("______starting swap______")
+    cmd = "swapon /dev/%s" %(hostoptions["swappartition"])
+    runcmd(cmd)
 
 def create_squashlist():
     logging.debug("Creating squashlist")
@@ -475,7 +482,11 @@ def copy_it(install_type):
     if ( install_type == "install"):
         logging.info("Transferring system")
         cmd = "  unsquashfs -f -d %s /.livesys/medium/larch/system.sqf" %(data_config.MOUNTPOINT)
-        runcmd(cmd)
+        #runcmd(cmd)
+        rc = runcmd(cmd)[0]
+        if rc != 0 :
+            error_out("Running unsquashfs")
+
         #logging.debug(cmd)
         #cmdout=commands.getoutput(cmd)
 
@@ -483,7 +494,10 @@ def copy_it(install_type):
         logging.info("Upgrading system")
         create_squashlist()
         cmd = "  unsquashfs -e %s -f -d %s /.livesys/medium/larch/system.sqf" %(data_config.SQUASHFILE,  data_config.MOUNTPOINT)
-        runcmd(cmd)
+        #runcmd(cmd)
+        rc = runcmd(cmd)[0]
+        if rc != 0 :
+            error_out("Running unsquashfs")
         #logging.debug(cmd)
         #cmdout=commands.getoutput(cmd)
 #   Create the missing dir
@@ -1015,6 +1029,8 @@ def full_install(hostoptions):
     update_status(statusmsg)
     progress(3)
     mount_it()
+    swapon()
+
 
 #   Find number of bytes written to disk before starting copy.  This is used
 #   to have a somewhat decent progress indication.
@@ -1022,6 +1038,8 @@ def full_install(hostoptions):
     msg = "Creating %s" %(systemconfig["hostname"])
     update_status(msg)
 
+
+
 #   Copy system to disk
     copy_it("install")
 #   Remove old fstab so that a new one is created
@@ -1245,6 +1263,7 @@ def upgrade(hostoptions):
     update_status(statusmsg)
     progress(3)
     mount_it()
+    swapon()
     hostoptions["backupfile"] = data_config.BACKUPPATH+data_config.BACKUPFILE
     statgrab( hostoptions["rootdisk"])
     msg = "Upgrading %s" %(systemconfig["hostname"])
-- 
cgit v0.12