summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/imager/baseimager.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/mic/imager/baseimager.py')
-rw-r--r--scripts/lib/mic/imager/baseimager.py82
1 files changed, 6 insertions, 76 deletions
diff --git a/scripts/lib/mic/imager/baseimager.py b/scripts/lib/mic/imager/baseimager.py
index 6efc6c1294..4d6be29a0e 100644
--- a/scripts/lib/mic/imager/baseimager.py
+++ b/scripts/lib/mic/imager/baseimager.py
@@ -1,4 +1,3 @@
1
2#!/usr/bin/python -tt 1#!/usr/bin/python -tt
3# 2#
4# Copyright (c) 2007 Red Hat Inc. 3# Copyright (c) 2007 Red Hat Inc.
@@ -69,9 +68,10 @@ class BaseImageCreator(object):
69 68
70 self.ks = None 69 self.ks = None
71 self.name = "target" 70 self.name = "target"
72 self.tmpdir = "/var/tmp/mic" 71 self.tmpdir = "/var/tmp/wic"
73 self.cachedir = "/var/tmp/mic/cache" 72 self.cachedir = "/var/tmp/wic/cache"
74 self.workdir = "/var/tmp/mic/build" 73 self.workdir = "/var/tmp/wic/build"
74
75 self.destdir = "." 75 self.destdir = "."
76 self.installerfw_prefix = "INSTALLERFW_" 76 self.installerfw_prefix = "INSTALLERFW_"
77 self.target_arch = "noarch" 77 self.target_arch = "noarch"
@@ -463,7 +463,7 @@ class BaseImageCreator(object):
463 env[self.installerfw_prefix + "DISTRO_NAME"] = self.distro_name 463 env[self.installerfw_prefix + "DISTRO_NAME"] = self.distro_name
464 464
465 # Name of the image creation tool 465 # Name of the image creation tool
466 env[self.installerfw_prefix + "INSTALLER_NAME"] = "mic" 466 env[self.installerfw_prefix + "INSTALLER_NAME"] = "wic"
467 467
468 # The real current location of the mounted file-systems 468 # The real current location of the mounted file-systems
469 if in_chroot: 469 if in_chroot:
@@ -668,7 +668,7 @@ class BaseImageCreator(object):
668 if cachedir: 668 if cachedir:
669 self.cachedir = cachedir 669 self.cachedir = cachedir
670 else: 670 else:
671 self.cachedir = self.__builddir + "/mic-cache" 671 self.cachedir = self.__builddir + "/wic-cache"
672 fs.makedirs(self.cachedir) 672 fs.makedirs(self.cachedir)
673 return self.cachedir 673 return self.cachedir
674 674
@@ -751,52 +751,8 @@ class BaseImageCreator(object):
751 self.__setup_tmpdir() 751 self.__setup_tmpdir()
752 self.__ensure_builddir() 752 self.__ensure_builddir()
753 753
754 # prevent popup dialog in Ubuntu(s)
755 misc.hide_loopdev_presentation()
756
757 fs.makedirs(self._instroot)
758 fs.makedirs(self._outdir)
759
760 self._mount_instroot(base_on) 754 self._mount_instroot(base_on)
761 755
762 for d in ("/dev/pts",
763 "/etc",
764 "/boot",
765 "/var/log",
766 "/sys",
767 "/proc",
768 "/usr/bin"):
769 fs.makedirs(self._instroot + d)
770
771 if self.target_arch and self.target_arch.startswith("arm"):
772 self.qemu_emulator = misc.setup_qemu_emulator(self._instroot,
773 self.target_arch)
774
775
776 self.get_cachedir(cachedir)
777
778 # bind mount system directories into _instroot
779 for (f, dest) in [("/sys", None),
780 ("/proc", None),
781 ("/proc/sys/fs/binfmt_misc", None),
782 ("/dev/pts", None)]:
783 self.__bindmounts.append(
784 fs.BindChrootMount(
785 f, self._instroot, dest))
786
787 self._do_bindmounts()
788
789 self.__create_minimal_dev()
790
791 if os.path.exists(self._instroot + "/etc/mtab"):
792 os.unlink(self._instroot + "/etc/mtab")
793 os.symlink("../proc/mounts", self._instroot + "/etc/mtab")
794
795 self.__write_fstab()
796
797 # get size of available space in 'instroot' fs
798 self._root_fs_avail = misc.get_filesystem_avail(self._instroot)
799
800 def unmount(self): 756 def unmount(self):
801 """Unmounts the target filesystem. 757 """Unmounts the target filesystem.
802 758
@@ -805,34 +761,8 @@ class BaseImageCreator(object):
805 from the install root. 761 from the install root.
806 762
807 """ 763 """
808 try:
809 mtab = self._instroot + "/etc/mtab"
810 if not os.path.islink(mtab):
811 os.unlink(self._instroot + "/etc/mtab")
812
813 if self.qemu_emulator:
814 os.unlink(self._instroot + self.qemu_emulator)
815 except OSError:
816 pass
817
818 self._undo_bindmounts()
819
820 """ Clean up yum garbage """
821 try:
822 instroot_pdir = os.path.dirname(self._instroot + self._instroot)
823 if os.path.exists(instroot_pdir):
824 shutil.rmtree(instroot_pdir, ignore_errors = True)
825 yumlibdir = self._instroot + "/var/lib/yum"
826 if os.path.exists(yumlibdir):
827 shutil.rmtree(yumlibdir, ignore_errors = True)
828 except OSError:
829 pass
830
831 self._unmount_instroot() 764 self._unmount_instroot()
832 765
833 # reset settings of popup dialog in Ubuntu(s)
834 misc.unhide_loopdev_presentation()
835
836 766
837 def cleanup(self): 767 def cleanup(self):
838 """Unmounts the target filesystem and deletes temporary files. 768 """Unmounts the target filesystem and deletes temporary files.