From ff2f92f8c591385d2f721c9236ee7670c6182e5f Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Fri, 27 Jan 2017 22:04:02 +0000
Subject: LinHES-config: mv_install.py: use static mount 2.28.2 to mount
 image_mount

Versions of util-linux mount after 2.28.2 do not allow 1 image to be mounted to multiple loop devices.
---
 abs/core/LinHES-config/PKGBUILD      |   6 +-
 abs/core/LinHES-config/mv_install.py | 138 ++++-------------------------------
 2 files changed, 19 insertions(+), 125 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index f67f84d..aafc539 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
-pkgver=8.4.2
-pkgrel=5
+pkgver=8.4.3
+pkgrel=1
 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'
@@ -141,7 +141,7 @@ package() {
     install -o root -g root  -D -m 0755 blacklist_nouveau.conf $pkgdir/etc/modprobe.d/blacklist_nouveau.conf
 }
 
-md5sums=('97b810ddc35d1f441dbe8cdd6886e2af'
+md5sums=('ce1acca6520ae58727db4b20329bb3f0'
          '51525188ac6f6034422c5d71d0c84408'
          'f6e9dd7bc6cf0aaa3bd203dab4cb79b9'
          '2596460462cf6c889cf8f95485537b20'
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index ed3e342..9a65898 100644
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -630,7 +630,7 @@ def format_disk(install_type):
 
 def mount_it():
     logging.info("______Mounting disk______")
-#   Create mount points
+    #   Create mount points
     try:
         mountpoint = data_config.MOUNTPOINT
         mp = mountpoint
@@ -744,116 +744,38 @@ def create_squashlist():
     f.close()
 
 def mount_for_copy_it():
-    mounts = {}
+    #Use static build mount and umount from mount2.28.2.tar.xz
+    #Versions of util-linux mount after 2.28.2 do not allow 1 image to be
+    #    mounted to multiple loop devices.
+    #Our ISO mounts airootfs.img to both / and /image_mount
+    cmd = 'tar -xvf /tmp/mount2.28.2.tar.xz -C /tmp/'
+    rc = runcmd(cmd)[0]
+    if rc != 0 :
+        error_out("Failed to extract static mount from /tmp/mount2.28.2.tar.xz")
 
-    #mounts['/image_mount/root'] =  'root-image'
-    #mounts['/image_mount/usr/share'] = 'usr-share'
-    #mounts['/image_mount/lib/modules'] = 'lib-modules'
-    #mounts['/image_mount/var/lib/pacman'] = 'var-lib-pacman'
-    #mounts['/image_mount/data/storage/disk0/pacman/pkg'] = 'data-storage-disk0-pacman-pkg'
-    #mounts['/image_mount/var/cache/pacman'] = 'var-cache-pacman'
+    mounts = {}
     mounts['/image_mount'] =  'airootfs'
     for image_mount, fsimage in mounts.iteritems():
         try:
             os.makedirs(image_mount)
         except:
             pass
-        #cmd = 'mount /run/archiso/sfs/%s/%s.fs %s' %(fsimage,fsimage,image_mount)
-        cmd = 'mount /run/archiso/sfs/%s/%s.img %s' %(fsimage,fsimage,image_mount)
+        cmd = '/tmp/mount /run/archiso/sfs/%s/%s.img %s' %(fsimage,fsimage,image_mount)
         rc = runcmd(cmd)[0]
         if rc != 0 :
             error_out("Mount image %s" %fsimage)
 
 
-
-
-    #image_mount='/image_mount/root'
-    #try:
-        #os.makedirs(image_mount)
-    #except:
-        #pass
-
-    #image_mount='/image_mount/usr/share'
-    #try:
-        #os.makedirs(image_mount)
-    #except:
-        #pass
-
-    #image_mount='/image_mount/lib/modules'
-    #try:
-        #os.makedirs(image_mount)
-    #except:
-        #pass
-
-    #image_mount='/image_mount/var/cache/pacman'
-    #try:
-        #os.makedirs(image_mount)
-    #except:
-        #pass
-
-    #image_mount='/image_mount/var/lib/pacman'
-    #try:
-        #os.makedirs(image_mount)
-    #except:
-        #pass
-
-
-    #fsimage='root-image'
-    #cmd = 'mount /run/archiso/sfs/%s/%s.fs /image_mount/root' %(fsimage,fsimage)
-    #rc = runcmd(cmd)[0]
-    #if rc != 0 :
-        #error_out("Mount image root")
-
-    #fsimage='lib-modules'
-    #cmd = 'mount /run/archiso/sfs/%s/%s.fs /image_mount/lib/modules' %(fsimage,fsimage)
-    #rc = runcmd(cmd)[0]
-    #if rc != 0 :
-        #error_out("Mount image lib-modules")
-
-    #fsimage='usr-share'
-    #cmd = 'mount /run/archiso/sfs/%s/%s.fs /image_mount/usr/share' %(fsimage,fsimage)
-    #rc = runcmd(cmd)[0]
-    #if rc != 0 :
-        #error_out("Mount image usr share")
-
-    #fsimage='var-lib-pacman'
-    #cmd = 'mount /run/archiso/sfs/%s/%s.fs /image_mount/var/lib/pacman' %(fsimage,fsimage)
-    #rc = runcmd(cmd)[0]
-    #if rc != 0 :
-        #error_out("Mount image var-lib-pacman")
-
-    #fsimage='var-cache-pacman'
-    #cmd = 'mount /run/archiso/sfs/%s/%s.fs /image_mount/var/cache/pacman' %(fsimage,fsimage)
-    #rc = runcmd(cmd)[0]
-    #if rc != 0 :
-        #error_out("Mount image var-cahce-pacman")
-
-
 def umount_for_copy_it():
     mounts = {}
     mounts['/image_mount'] =  'airootfs'
-
-
-    #mounts['/image_mount/root'] =  'root-image'
-    #mounts['/image_mount/usr/share'] = 'usr-share'
-    #mounts['/image_mount/lib/modules'] = 'lib-modules'
-    #mounts['/image_mount/var/lib/pacman'] = 'var-lib-pacman'
-    #mounts['/image_mount/data/storage/disk0/pacman/pkg'] = 'data-storage-disk0-pacman-pkg'
-    #mounts['/image_mount/var/cache/pacman'] = 'var-cache-pacman'
-
-
-
     for image_mount, fsimage in mounts.iteritems():
-        #cmd = 'mount /run/archiso/sfs/%s/%s.fs %s' %(fsimage,fsimage,image_mount)
-        cmd='umount %s' %(image_mount)
+        cmd='/tmp/umount %s' %(image_mount)
         rc = runcmd(cmd)[0]
         if rc != 0 :
             error_out("unMount image %s" %image_mount)
 
 
-
-
-
 def copy_it(install_type):
     logging.info("______Transferring to disk______")
     mount_for_copy_it()
@@ -861,25 +783,8 @@ def copy_it(install_type):
     logging.debug(  install_type)
     if ( install_type == "install"):
         logging.info("Transferring system")
-        #cmdlist = ['rsync -arp /image_mount/root/* /new_boot',
-                   ##'rsync -arp /image_mount/lib/* /new_boot/lib/',
-                   #'rsync -arp /image_mount/lib /new_boot/',
-                   #'rsync -arp /image_mount/lib64 /new_boot/',
-                   #'rsync -arp /image_mount/usr /new_boot',
-                   #'rsync -arp /image_mount/sbin /new_boot',
-                   #'rsync -arp /image_mount/bin /new_boot',
-                   #'rsync -arp /image_mount/var /new_boot',
-                   #'rsync -arp /image_mount/data/storage/disk0/* /new_boot/data/storage/disk0/',
-                   #'rysnc -arp /image_mount/var-lib-pacman/sync /new_boot/var/lib/pacman/'
-                   #]
-
-        #cmdlist = ['rsync -arp  --exclude var-lib-pacman --exclude boot-orig /image_mount/* /new_boot',
-        #           'rsync -arp /image_mount/var-lib-pacman/sync /new_boot/var/lib/pacman/',
-        #           'rsync -arp /image_mount/boot-orig/* /new_boot/boot/ '
-        #           ]
-
-
-        cmdlist = ['rsync -arp  --exclude var-lib-pacman --exclude boot-orig /image_mount/* /new_boot']
+
+        cmdlist = ['rsync -arp --exclude var-lib-pacman --exclude boot-orig --exclude tmp/mount2.28.2.tar.xz /image_mount/* /new_boot']
 
         for cmd in cmdlist:
             rc = runcmd(cmd)[0]
@@ -891,16 +796,9 @@ def copy_it(install_type):
     if ( install_type == "upgrade"):
         logging.info("Upgrading system")
 
-        #cmdlist = ['rsync -arp --exclude /home --exclude /data/srv/mysql /image_mount/root/* /new_boot',
-                    #'rsync -arp /image_mount/lib/* /new_boot/lib/',
-                    #'rsync -arp /image_mount/usr /new_boot',
-                    #'rsync -arp /image_mount/var /new_boot']
-
-        cmdlist = ['rsync -arp  --exclude var-lib-pacman --exclude boot-orig  --exclude /home --exclude /data/srv/mysql /image_mount/* /new_boot']
-
+        cmdlist = ['rsync -arp --exclude var-lib-pacman --exclude boot-orig --exclude tmp/mount2.28.2.tar.xz --exclude /home --exclude /data/srv/mysql /image_mount/* /new_boot']
 
         for cmd in cmdlist:
-            #runcmd(cmd)
             rc = runcmd(cmd)[0]
             if rc != 0 :
                 error_out("Running %s" %cmd)
@@ -925,10 +823,7 @@ def copy_it(install_type):
     cp_and_log("/var/lib/dhcpcd/*.lease", data_config.MOUNTPOINT+"/var/lib/dhcpcd/")
 
 
-
-
-
-#   General fixup
+    #   General fixup
     cmd = "chmod 777 %s/tmp" %(data_config.MOUNTPOINT)
     runcmd(cmd)
     cmd = "chmod 1777 %s/var/lock" %(data_config.MOUNTPOINT)
@@ -951,7 +846,6 @@ def copy_it(install_type):
     runcmd(cmd)
 
 
-
     #sys.exit(3)
     apply_pristine()
     post_process()
-- 
cgit v0.12