summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/mv_install.py
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2017-01-27 22:04:02 (GMT)
committerBritney Fransen <brfransen@gmail.com>2017-01-27 22:04:02 (GMT)
commitff2f92f8c591385d2f721c9236ee7670c6182e5f (patch)
tree5fd444a51ec0116541475f41af63e937d889e8a9 /abs/core/LinHES-config/mv_install.py
parent16a18d2f23f66b1f4bfdac8ba9a6c8d1b4033d28 (diff)
downloadlinhes_pkgbuild-ff2f92f8c591385d2f721c9236ee7670c6182e5f.zip
linhes_pkgbuild-ff2f92f8c591385d2f721c9236ee7670c6182e5f.tar.gz
linhes_pkgbuild-ff2f92f8c591385d2f721c9236ee7670c6182e5f.tar.bz2
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.
Diffstat (limited to 'abs/core/LinHES-config/mv_install.py')
-rw-r--r--abs/core/LinHES-config/mv_install.py138
1 files changed, 16 insertions, 122 deletions
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()