This file is indexed.

/usr/bin/mic-create-bootstrap 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
#!/usr/bin/python -t
#
# mic-create-bootstrap : create a bootstrap to run mic-image-creator
#
# Copyright 2009, Intel Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

import os
import os.path
import sys
import optparse
import shutil
import subprocess
import signal
import tempfile
from mic.imgcreate.fs import *
from mic.utils.bootstrap import *
from mic.imgcreate.kscommands.moblinrepo import *

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

class Usage(Exception):
    def __init__(self, msg = None, no_error = False):
        Exception.__init__(self, msg, no_error)

def parse_options(args):
    parser = optparse.OptionParser(
        usage="mic-create-bootstrap [options]"
        , version = version)

    parser.add_option("-k", "--cache", type="string", dest="cachedir",
                    help="Repo cache dir, it saves too much time to use repo cache.")
    parser.add_option("-n", "--reponame", type="string",
                      dest="reponame",
                      help="repo name, get repo cache according to this"
                     )
    parser.add_option("-r", "--repourl", type="string", dest="repourl",
                      help="Repo URL"
                     )
    parser.add_option("-p", "--proxy", type="string", dest="proxy",
                      help="Specify a http proxy if needed"
                     )
    parser.add_option("-o", "--outdir", type="string",
                      dest="outdir",
                      help="Output directory to use, it should be empty if existed "
                     )

    (options, args) = parser.parse_args()

    return options

def main():
    try:
        options = parse_options(sys.argv[1:])
        if not options:
            return 2
    except Usage, (msg, no_error):
        if no_error:
            out = sys.stdout
            ret = 0
        else:
            out = sys.stderr
            ret = 2
        if msg:
            print >> out, msg
        return ret

    # This command could be executed as non-root as well, however we require root 
    # permissions as the rootfs extracted from rpm packages will have files that 
    # are owned by root and normal user does not have permissions to e.g. remove that.
    if os.geteuid () != 0:
        print "You must run mic-create-bootstrap as root"
        return 1

    if not options.reponame:
        raise Usage("Reponame needs to be given. Giving same repo name as "
                    "before speeds up the download process if the required "
                    "files are already cached.")

    if not options.outdir:
       raise Usage("Please use -o or --outdir option to specify target bootstrap directory.")
    elif not os.path.exists(options.outdir):
       try:
           os.makedirs(options.outdir)
       except OSError, (err, msg):
           raise Usage(msg)
    # The outdir can't be a file
    elif not os.path.isdir(options.outdir):
       raise Usage("Given output dir '%s' is a file." % options.outdir)
    # The output dir must be empty.
    elif len(os.listdir(options.outdir)) != 0:
       raise Usage("Given output dir '%s' is not empty." % options.outdir)
    
    repo = Moblin_RepoData(baseurl=options.repourl, name=options.reponame, proxy=options.proxy)
    repoList = [repo]

    rmcachedir = False
    if not options.cachedir:
        try:
            options.cachedir = tempfile.mkdtemp(dir = "/var/tmp", prefix = "bootstrapcache-")
            rmcachedir = True
        except OSError, (err, msg):
            raise Usage("Failed to create bootstrap cache directory on %s: %s" % ("/var/tmp", msg))

    build_bootstrap(repoList, None, options.cachedir, options.outdir)
    if rmcachedir:
        shutil.rmtree(options.cachedir, ignore_errors = True)
    print "Finished."
    return 0

COLOR_BLACK = "\033[00m"
COLOR_RED =   "\033[1;31m"
if __name__ == "__main__":
    try:
        ret = main()
        sys.exit(ret)
    except (BootstrapError, Usage), e:
        print >> sys.stderr, "\n%sError: %s%s\n" % (COLOR_RED, e, COLOR_BLACK)
        sys.exit(1)