summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxiaojuan.mao <xiaojuan.mao@samsung.com>2017-10-13 12:07:08 +0800
committerxiaojuan.mao <xiaojuan.mao@samsung.com>2017-10-13 12:08:04 +0800
commit5ea707d68b9794ddff5ac4727c15475a6d342cc5 (patch)
tree268fb716eb45bb49b4d11d53e73bc4d189282af8
parentc749329b6ab4a78c278f311eb6b9e52d132d154d (diff)
downloadmic-5ea707d68b9794ddff5ac4727c15475a6d342cc5.tar.gz
mic-5ea707d68b9794ddff5ac4727c15475a6d342cc5.tar.bz2
mic-5ea707d68b9794ddff5ac4727c15475a6d342cc5.zip
The value of fstype is not cpio, an image is generated by cpio.
Change-Id: Ia9ae3d445c708b444da0dee1e5060725db9b9403
-rwxr-xr-xmic/imager/baseimager.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py
index 9c2b30d..ec2edb5 100755
--- a/mic/imager/baseimager.py
+++ b/mic/imager/baseimager.py
@@ -33,7 +33,7 @@ import rpm
import time
from mic import kickstart
from mic import msger, __version__ as VERSION
-from mic.utils.errors import CreatorError, Abort
+from mic.utils.errors import CreatorError, KsError, Abort
from mic.utils import misc, grabber, runner, fs_related as fs
from mic.chroot import kill_proc_inchroot
from mic.archive import get_archive_suffixes
@@ -155,8 +155,11 @@ class BaseImageCreator(object):
if part.fstype and part.fstype == "btrfs":
self._dep_checks.append("mkfs.btrfs")
break
- if part.fstype == "cpio":
- part.fstype = "ext4"
+ if part.cpioopts:
+ if part.fstype == "cpio":
+ part.fstype = "ext4"
+ else:
+ raise KsError("The '--fstype' in ks file need to set 'cpio' when you want to generate image by cpio.")
if len(self.ks.handler.partition.partitions) > 1:
self.multiple_partitions = True
@@ -1330,7 +1333,7 @@ class BaseImageCreator(object):
runner.show('find . | cpio --create %s | gzip > %s' % (item['cpioopts'], tmp_cpio_imgfile))
os.chdir(oldoutdir)
except OSError, (errno, msg):
- raise errors.CreatorError("Create image by cpio error: %s" % msg)
+ raise CreatorError("Create image by cpio error: %s" % msg)
def copy_cpio_image(self):
for item in self._instloops:
@@ -1340,7 +1343,7 @@ class BaseImageCreator(object):
try:
shutil.copyfile(os.path.join(tmp_cpio, item['name']),os.path.join(self._imgdir, item['name']))
except IOError:
- raise errors.CreatorError("Copy cpio image error")
+ raise CreatorError("Copy cpio image error")
os.remove(os.path.join(tmp_cpio, item['name']))
if not os.listdir(tmp_cpio):
shutil.rmtree(tmp_cpio, ignore_errors=True)