diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/wic/plugins/source/rawcopy.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py index 424ed26ed6..e86398ac8f 100644 --- a/scripts/lib/wic/plugins/source/rawcopy.py +++ b/scripts/lib/wic/plugins/source/rawcopy.py | |||
@@ -32,6 +32,25 @@ class RawCopyPlugin(SourcePlugin): | |||
32 | 32 | ||
33 | name = 'rawcopy' | 33 | name = 'rawcopy' |
34 | 34 | ||
35 | @staticmethod | ||
36 | def do_image_label(fstype, dst, label): | ||
37 | if fstype.startswith('ext'): | ||
38 | cmd = 'tune2fs -L %s %s' % (label, dst) | ||
39 | elif fstype in ('msdos', 'vfat'): | ||
40 | cmd = 'dosfslabel %s %s' % (dst, label) | ||
41 | elif fstype == 'btrfs': | ||
42 | cmd = 'btrfs filesystem label %s %s' % (dst, label) | ||
43 | elif fstype == 'swap': | ||
44 | cmd = 'mkswap -L %s %s' % (label, dst) | ||
45 | elif fstype == 'squashfs': | ||
46 | raise WicError("It's not possible to update a squashfs " | ||
47 | "filesystem label '%s'" % (label)) | ||
48 | else: | ||
49 | raise WicError("Cannot update filesystem label: " | ||
50 | "Unknown fstype: '%s'" % (fstype)) | ||
51 | |||
52 | exec_cmd(cmd) | ||
53 | |||
35 | @classmethod | 54 | @classmethod |
36 | def do_prepare_partition(cls, part, source_params, cr, cr_workdir, | 55 | def do_prepare_partition(cls, part, source_params, cr, cr_workdir, |
37 | oe_builddir, bootimg_dir, kernel_dir, | 56 | oe_builddir, bootimg_dir, kernel_dir, |
@@ -66,4 +85,7 @@ class RawCopyPlugin(SourcePlugin): | |||
66 | if filesize > part.size: | 85 | if filesize > part.size: |
67 | part.size = filesize | 86 | part.size = filesize |
68 | 87 | ||
88 | if part.label: | ||
89 | RawCopyPlugin.do_image_label(part.fstype, dst, part.label) | ||
90 | |||
69 | part.source_file = dst | 91 | part.source_file = dst |