This file is indexed.

/usr/bin/mic is in mic2 0.24.12-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
#!/usr/bin/python

# Copyright (C) 2010 Intel Inc.  All rights reserved.
# This program is free software; it may be used, copied, modified
# and distributed under the terms of the GNU General Public Licence,
# either version 2, or version 3 (at your option).

import sys
import mic.utils.cmdln as cmdln
import optparse as _optparse
import subprocess

try:
    import mic.__version__
    version = mic.__version__.version
except:
    version = 'unknown'

MAN_HEADER = r""".TH %(ucname)s "1" "%(date)s" "%(name)s %(version)s" "User Commands"
.SH NAME
%(name)s \- MeeGo image command-line tool.
.SH SYNOPSIS
.B %(name)s
[\fIGLOBALOPTS\fR] \fISUBCOMMAND \fR[\fIOPTS\fR] [\fIARGS\fR...]
.br
.B %(name)s
\fIhelp SUBCOMMAND\fR
.SH DESCRIPTION
MeeGo image command-line tool.
"""
MAN_FOOTER = r"""
.SH "SEE ALSO"
Type 'mic help <subcommand>' for more detailed help on a specific subcommand.
.PP
For additional information, see
 * http://www.meego.com/
 * http://moblin.org/projects/moblin-image-creator-2
.SH AUTHOR
mic was written by Yi Yang, Anas Nashif and Jianfeng Ding. This man page is automatically generated.
"""

class MIC(cmdln.Cmdln):
    """Usage: mic [GLOBALOPTS] SUBCOMMAND [OPTS] [ARGS...]
    or: mic help SUBCOMMAND

    MeeGo Image Tool.
    Type 'mic help <subcommand>' for help on a specific subcommand.

    ${command_list}
    ${help_list}
    global ${option_list}
    For additional information, see
    * http://www.meego.com/
    """
    name = 'mic'
    conf = None
    man_header = MAN_HEADER
    man_footer = MAN_FOOTER

    def run_subcmd(self, subcmd, opts, args):
        creator = "mic-image-creator"
        convertor = "mic-image-convertor"
        chroot = "mic-chroot"
        writer = "mic-image-writer"
        vmlauncher = "mic-vm-launcher"
        tools = {
                 "cr":creator, "create":creator,
                 "cv":convertor, "convert":convertor,
                 "ch":chroot, "chroot":chroot,
                 "wr":writer, "write":writer,
                 "lv":vmlauncher, "launchvm":vmlauncher
                }

        changed_opts = {"overlaysizemb":"overlay-size-mb", "cachedir":"cache", "srcimg":"source-image", "dstformat":"target-format",
                        "srcformat":"source-format", "convertto":"convert-to", "give_shell":"shell", "saveto":"save-to",
                        "unpackonly":"unpack-only", "convertonly":"convert-only", "buildbootstrap":"build-bootstrap",
                        "bindmounts":"bind-mounts", "use_comps":"use-comps", "run_mode":"run-mode", "save_kernel":"save-kernel",
                        "file":"logfile", "include_src":"include-source"
                       }

        argv = [tools[subcmd]]
        for key in opts.__dict__.keys():
            if key == "addrepos":
                addrepos = getattr(opts, key)
                if not addrepos:
                    continue
                for repo in getattr(opts, key):
                    optstr = "--repo=%s" % repo
                    argv.append(optstr)
                continue
            value = getattr(opts, key)
            if value == None or (type(value) is bool and value == False) or value == "":
                continue
            optstr = "--%s" % key.replace("_", "-")
            if key in changed_opts.keys():
                optstr = "--%s" % changed_opts[key]
            if type(value) is not bool:
                optstr += "=%s" % value
            argv.append(optstr)
        for arg in args:
            argv.append(arg)
        subprocess.call(argv)

    def get_version(self):
        return version

    def get_optparser(self):
        """this is the parser for "global" options (not specific to subcommand)"""

        optparser = cmdln.CmdlnOptionParser(self, version=version)
        return optparser



    def get_cmd_help(self, cmdname):
        doc = self._get_cmd_handler(cmdname).__doc__
        doc = self._help_reindent(doc)
        doc = self._help_preprocess(doc, cmdname)
        doc = doc.rstrip() + '\n' # trim down trailing space
        return self._str(doc)


    """ For mic-image-creator """
    @cmdln.alias('cr')
    @cmdln.option("-c", "--config", type="string", dest="config",
                    help="Path to kickstart config file")

    @cmdln.option("-f", "--format", type="string", dest="format",
                    help="Image format, you can specify as fs, livecd, liveusb, loop, raw, nand, mrstnand, ubi, jffs2, vdi or vmdk")

    @cmdln.option("-t", "--tmpdir", type="string",
                      dest="tmpdir",
                      help="Temporary directory to use (default: /var/tmp)")
    @cmdln.option("-k", "--cache", type="string",
                      dest="cachedir", default=None,
                      help="Cache directory to use (default: private cache)")
    @cmdln.option("-o", "--outdir", type="string",
                      dest="outdir", default=None,
                      help="Output directory to use (default: current work dir)")
    @cmdln.option("", "--release", type="string",
                      dest="release", default=None,
                      help="Generate a MeeGo release with all necessary files for publishing.")
    @cmdln.option("", "--genchecksum", action="store_true",
                      dest="genchecksum", default=False,
                      help="Generate checksum for image file if this option is provided")
    @cmdln.option("-P", "--prefix", type="string",
                      dest="prefix", default=None,
                      help="Image name prefix (default: meego)")
    @cmdln.option("-S", "--suffix", type="string",
                      dest="suffix", default=None,
                      help="Image name suffix (default: date stamp)")
    @cmdln.option("-b", "--build-bootstrap", action="store_true",
                      dest="buildbootstrap", default=False,
                      help="Build a bootstrap, it should be used with -B or --bootstrap together")
    @cmdln.option("", "--rebuild-bootstrap", action="store_true", default=False,
                      help="Rebuild the bootstrap")
    @cmdln.option("", "--mainrepo", type="string",
                      dest="mainrepo", default=None,
                      help="Specify main repo name, it must be a repo name in your kickstart file")
    @cmdln.option("", "--siteconf", type="string", action="store",
                      dest="siteconf",
                      help="Specify site config file, it can be used to set tmpdir, cachedir, outputdir, it also can be used to remap/reroute a repo in kickstart to another equivalent repo, the default site configs are /etc/mic2/mic2.conf and ~/.mic2.conf.")
    @cmdln.option("", "--ignore-siteconf", action="store_true",
                      dest="ignore_siteconf", default=False,
                      help="Ignore site configs, this will ignore the default site configs, also ignore --siteconf option.")
    @cmdln.option("", "--repo", type="string", action="append", metavar="REPO",
                      dest="addrepos",
                      help="Specify additional repo, it may be a simple URL or a complicated tuple string, you can specify multiple repos using this option multiple times")
    @cmdln.option("", "--default-ks", type="string",
                      help="Set which kickstart file from repos to select in advance, if specified, there isn't interaction needed any more.")
    @cmdln.option("-B", "--bootstrap", type="string",
                      dest="bootstrap", default=None,
                      help="Use a given bootstrap env to create image")
    @cmdln.option("-a", "--arch", type="string",
                      dest="arch", default=None,
                      help="Specify target arch of image, for example: arm")
    @cmdln.option("", "--use-comps", action="store_true",
                      dest="use_comps", default=False,
                      help="Use comps instead of patterns if comps exists")
    @cmdln.option("", "--run-mode", type="int",
                      dest="run_mode", default=-1,
                      help="Specify run mode, 0 means legacy, 1 means bootstrap, by default it is gotten from config file.")
    @cmdln.option("", "--alt-initrd-name", type="string",
                      dest="alt_initrd_name", default=None,
                      help="Name of alternate INITRD image, if NOT to use the one from kernel package")
    @cmdln.option("", "--record-pkgs", type="string",
                      dest="record_pkgs", default=None,
                      help="Record the installed packages, valid values: name, content")
    @cmdln.option("", "--local-pkgs-path", type="string",
                      dest="local_pkgs_path", default=None,
                      help="Path for local pkgs (rpms) to be installed")
    @cmdln.option("-p", "--package", type="string", dest="package", default="none",
                      help="Package format, this option will package up output into a given-format package, "
                           "currently only tar, tar.gz and tar.bz2 are supported, the default "
                           "is none, i.e. doesn't package up output")
    @cmdln.option("", "--compress-disk-image", type="string",
                      dest="compress_disk_image", default=None,
                      help="Compress the disk image that is created. When using --release option default is bz2,"
                           " otherwise default is none. Supported compression methods: bz2, none")
    @cmdln.option("", "--include-source", action="store_true",
                      dest="include_src", default=False,
                      help="Generate a image with source rpms included")

    @cmdln.option("-i", "--interactive", action="store_true",
                      dest="interactive", default=False,
                      help="Directly write into a USB disk.")
    @cmdln.option("", "--fstype", type="string",
                      dest="fstype", default="vfat",
                      help="File system type for live USB file image, ext3 or vfat, the default is vfat.")
    @cmdln.option("", "--overlay-size-mb", type="int", default=64,
                      help="Overlay size in MB as unit, it means how size changes you can save in your live USB disk.")

    @cmdln.option("", "--initrd-url", type="string",
                      dest="initrd_url", default=None,
                      help="Remote URL of INITRD image.")
    @cmdln.option("", "--initrd-path", type="string",
                      dest="initrd_path", default=None,
                      help="Local path of INITRD image.")
    @cmdln.option("", "--kernel-url", type="string",
                      dest="kernel_url", default=None,
                      help="Remote URL of kernel file (vmlinuz).")
    @cmdln.option("", "--kernel-path", type="string",
                      dest="kernel_path", default=None,
                      help="Local path of kernel file (vmlinuz).")
    @cmdln.option("", "--kernel-rpm-url", type="string",
                      dest="kernel_rpm_url", default=None,
                      help="Remote URL of kernel rpm package.")
    @cmdln.option("", "--kernel-rpm-path", type="string",
                      dest="kernel_rpm_path", default=None,
                      help="Local path to kernel rpm package.")
    @cmdln.option("", "--bootimg-only", action="store_true", dest="bootimg_only",
                      help="Create boot image only.")

    @cmdln.option("-s", "--skip-compression", action="store_true", dest="skip_compression",
                      default=False, help=_optparse.SUPPRESS_HELP)
    @cmdln.option("", "--skip-minimize", action="store_true", dest="skip_minimize",
                      default=False, help=_optparse.SUPPRESS_HELP)
    @cmdln.option("-l", "--shell", action="store_true", dest="give_shell",
                      help=_optparse.SUPPRESS_HELP)
    @cmdln.option('-d', '--debug', action='store_true',
                      help='Output debugging information')
    @cmdln.option('-v', '--verbose', dest='verbose', action='store_true',
                      help='Output verbose information')
    @cmdln.option('', '--logfile', type="string", dest="file",
                      help='Save debug information to FILE')
    @cmdln.option("", "--traceback", action="store_true",
                      default=False, help="Dump call stack")
    @cmdln.option("", "--save-kernel", action="store_true",
                      dest="save_kernel", default=False,
                      help="Save kernel image file into outdir")
    @cmdln.option("", "--pkgmgr", type="string",
                      help="Specify the package manager, the available package managers have zypper and yum currently.")
    @cmdln.option("", "--volumeid", type="string", default=None,
                      help="Specify volume id, valid only for livecd")
    def do_create(self, subcmd, opts, *args):
        """${cmd_name}: Create an image

        This command is used to create various images, including
        live CD, live USB, loop, raw/KVM/QEMU, VMWare/vmdk,
        VirtualBox/vdi, Moorestown/mrstnand, jffs2 and ubi.

        Examples:
           mic create                         # create an image according to the default config
           mic create --format=liveusb        # create a live USB image

        ${cmd_usage}
        ${cmd_option_list}
        """

        self.run_subcmd(subcmd, opts, args)


    """ For mic-image-convertor """
    @cmdln.alias('cv')
    @cmdln.option("-F", "--source-format", type="string", dest="srcformat",
                    help="Source image format, possible values are: raw, vmdk or vdi (default: automatically detect image type).")
    @cmdln.option("-I", "--source-image", type="string", dest="srcimg",
                    help="Source image which was created by mic-image-creator or an image file system.")
    @cmdln.option("-T", "--target-format", type="string", dest="dstformat",
                    help="Target image format, possible values are: livecd and liveusb")
    @cmdln.option("-t", "--tmpdir", type="string",
                      dest="tmpdir", default="/var/tmp",
                      help="Temporary directory to use (default: /var/tmp)")
    @cmdln.option("-o", "--outdir", type="string",
                      dest="outdir", default=None,
                      help="Output directory to use (default: current work dir)")
    @cmdln.option("-P", "--prefix", type="string",
                      dest="prefix", default=None,
                      help="Image name prefix (default: meego)")
    @cmdln.option("-S", "--suffix", type="string",
                      dest="suffix", default=None,
                      help="Image name suffix (default: date stamp)")
    @cmdln.option("-i", "--interactive", action="store_true",
                      dest="interactive", default=False,
                      help="Directly write into a USB disk.")
    @cmdln.option("", "--fstype", type="string",
                      dest="fstype", default="vfat",
                      help="File system type for live USB image, ext3 or vfat, the default is vfat.")
    @cmdln.option("", "--overlay-size-mb", type="int",
                      dest="overlaysizemb", default=64,
                      help="Overlay size in MB as unit, it means how size changes you can save in your live USB disk.")
    @cmdln.option("-s", "--skip-compression", action="store_true", dest="skip_compression",
                      default=False, help=_optparse.SUPPRESS_HELP)
    @cmdln.option("", "--skip-minimize", action="store_true", dest="skip_minimize",
                      default=False, help=_optparse.SUPPRESS_HELP)
    @cmdln.option("-l", "--shell", action="store_true", dest="give_shell",
                      help=_optparse.SUPPRESS_HELP)
    def do_convert(self, subcmd, opts, *args):
        """${cmd_name}: convert an image format to another one

        This command is used to convert a live, raw, vmdk or vdi
        image to a live image.

        Examples:
           mic convert -I <yourimage> -T liveusb    # convert your image to a live USB image

        ${cmd_usage}
        ${cmd_option_list}
        """

        self.run_subcmd(subcmd, opts, args)



    """ For mic-chroot """
    @cmdln.alias('ch')
    @cmdln.option("-s", "--save-to", type="string", dest="saveto",
                    help="Save unpacked filesystem to the specified path ")
    @cmdln.option("", "--unpack-only", action="store_true",
                      dest="unpackonly", default=False,
                      help="Just unpack an image, this is used to"
                           "unpack an image with -s option together"
                     )
    @cmdln.option("-b", "--bind-mounts", type="string", dest="bindmounts",
                      help="Specify bind mount list, for example: -b "
                           "\"/proc:/proc;/:/parentroot\""
                     )
    @cmdln.option("-c", "--convert-to", type="string", dest="convertto",
                      help="Convert it to the specified type live image on"
                           " exiting, the allowed value is livecd or liveusb"
                     )
    @cmdln.option("-e", "--execute", type="string", dest="execute",
                      help="Execute the given command within the chroot"
                           " instead of an interactive shell"
                     )
    @cmdln.option("", "--convert-only", action="store_true",
                      dest="convertonly", default=False,
                      help="Just convert an image, this will skip chroot and"
                           " directly convert an image/filesytem with -c "
                           "option together"
                     )
    @cmdln.option("-o", "--outdir", type="string",
                      dest="outdir", default=None,
                      help="Output directory to use "
                           "(default: current work dir)"
                     )
    @cmdln.option('-d', '--debug', action='store_true',
                      help='Output debugging information')
    @cmdln.option('-v', '--verbose', dest='verbose', action='store_true',
                      help='Output verbose information')
    @cmdln.option('', '--logfile', type="string", dest="file",
                      help='Save debug information to FILE')
    def do_chroot(self, subcmd, opts, *args):
        """${cmd_name}: chroot into an image

        This command is used to chroot into a live image to do some changes.

        Examples:
           mic chroot -s /fs/path <your live image>   # unpack your live image to /fs/path and chroot into it

        ${cmd_usage}
        ${cmd_option_list}
        """

        self.run_subcmd(subcmd, opts, args)


    """ For mic-image-writer """
    @cmdln.alias('wr')
    @cmdln.option("-c", "--console", action="store_true", dest="console",
                      default=False, help="Run in console mode")
    @cmdln.option("-g", "--gui", action="store_true", dest="gui",
                      default=False, help="Run in GUI mode")
    def do_write(self, subcmd, opts, *args):
        """${cmd_name}: write a live image to usb disk

        This command is used to write a live image to usb disk.

        Examples:
           mic write <your live image>   # write a live image to usb disk

        ${cmd_usage}
        ${cmd_option_list}
        """

        self.run_subcmd(subcmd, opts, args)

    """ For mic-vm-launcher """
    @cmdln.alias('lv')
    def do_launchvm(self, subcmd, opts, *args):
        """${cmd_name}: launch a virtual machine image

        This command is used to launch a virtual machine image.

        Examples:
           mic launch <your vm image>   # launch a virtual machine image

        ${cmd_usage}
        ${cmd_option_list}
        """

        self.run_subcmd(subcmd, opts, args)


if __name__ == "__main__":
    mic = MIC()
    sys.exit(mic.main(sys.argv))