• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python stdout.red函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中stdout.red函数的典型用法代码示例。如果您正苦于以下问题:Python red函数的具体用法?Python red怎么用?Python red使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了red函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_kernel_version

def get_kernel_version(kerneldir):
    """
    Get the kernel version number and nickname

    @arg: string
    @return: string
    """
    # check for linux symlink
    if not os.path.isdir(kerneldir):
        print(red('error')+': no /usr/src/linux found')
        sys.exit(2)

    # best way *here* is to get KV from the sources, not the running KV
    if not os.path.isfile(kerneldir+'/Makefile'):
        # if no /Makefile, that sux big time
        print(red('error')+': no kernel Makefile found')
        sys.exit(2)
    head = []
    nlines = 0
    for line in open(kerneldir+'/Makefile'):
        line = line.replace(' ','')
        head.append(line.rstrip())
        nlines += 1
        if nlines >= 5:
            break
    head = dict(item.split("=") for item in head )

    return head['VERSION']+"."+head['PATCHLEVEL']+"."+head['SUBLEVEL']+head['EXTRAVERSION'], head['NAME']
开发者ID:kungfoo-linux,项目名称:kigen,代码行数:28,代码来源:misc.py


示例2: fail

    def fail(self, step):
        """
        @arg step   string

        @return     exit
        """
        print red('error')+': initramfs.lvm2.'+step+'() failed'
        sys.exit(2)
开发者ID:ac1965,项目名称:kigen,代码行数:8,代码来源:lvm2.py


示例3: fail

    def fail(self, step):
        """
        @arg step   string

        @return     exit
        """
        print red("error") + ": initramfs.busybox." + step + "() failed"
        sys.exit(2)
开发者ID:ac1965,项目名称:kigen,代码行数:8,代码来源:busybox.py


示例4: build_sequence

def build_sequence(master_config, temp, verbose):
	"""
	unionfs_fuse build sequence

	@arg master_config	dict
	@arg temp		dict
	@arg verbose		string

	@return: bool
	"""
	zero = int('0')
	ret = True

	if os.path.isfile('%s/unionfs-fuse-%s.tar.bz2' % (utils.get_distdir(temp), str(master_config['unionfs_fuse_ver']))) is not True:
		ret = download(master_config['unionfs_fuse_ver'], temp, verbose)
		if ret is not zero:
			print red('error: ')+'initramfs.unionfs_fuse.download() failed'
			sys.exit(2)

	ret = extract(master_config['unionfs_fuse_ver'], temp, verbose)
	ret = zero # grr, tar thing to not return 0

#	ret = configure(temp['work'] + '/unionfs_fuse/' + master_config['unionfs_fuse_ver'], master_config, temp, verbose)
#	if ret is not zero:
#		print red('error: ')+'initramfs.unionfs_fuse.configure() failed'
#		sys.exit(2)

	# add fuse lib path
	os.system('echo "CPPFLAGS += -static -I%s/include -L%s/lib/.libs" >> %s' % (temp['work'] + '/fuse-' + master_config['fuse_ver'], temp['work'] + '/fuse-' + master_config['fuse_ver'], temp['work'] + '/unionfs-fuse-' + master_config['unionfs_fuse_ver']+'/Makefile'))
	os.system('echo "CPPFLAGS += -static -I%s/include -L%s/lib/.libs" >> %s' % (temp['work'] + '/fuse-' + master_config['fuse_ver'], temp['work'] + '/fuse-' + master_config['fuse_ver'], temp['work'] + '/unionfs-fuse-' + master_config['unionfs_fuse_ver']+'/src/Makefile'))
	os.system('echo "LIB += -static -L%s/lib/.libs -ldl -lrt" >> %s' % (temp['work'] + '/fuse-' + master_config['fuse_ver'], temp['work'] + '/unionfs-fuse-' + master_config['unionfs_fuse_ver']+'/Makefile'))
	os.system('echo "LIB += -static -L%s/lib/.libs -ldl -lrt" >> %s' % (temp['work'] + '/fuse-' + master_config['fuse_ver'], temp['work'] + '/unionfs-fuse-' + master_config['unionfs_fuse_ver']+'/src/Makefile'))

	ret = compile(temp['work'] + '/unionfs-fuse-' + master_config['unionfs_fuse_ver'], master_config, verbose)
	if ret is not zero:
		print red('error: ')+'initramfs.unionfs_fuse.compile() failed'
		sys.exit(2)

# TODO remove manpage rm -rf %s/unionfs_fuse/man % temp['work']

	ret = strip(master_config, temp)
	if ret is not zero:
		print red('error: ')+'initramfs.unionfs_fuse.strip() failed'
		sys.exit(2)

	ret = compress(master_config, temp, verbose)
	if ret is not zero:
		print red('error: ')+'initramfs.unionfs_fuse.compress() failed'
		sys.exit(2)

	ret = cache(temp['work'] + '/unionfs-fuse-' + master_config['unionfs_fuse_ver'], master_config, temp, verbose)
	if ret is not zero:
		print red('error: ')+'initramfs.unionfs_fuse.compress() failed'

	return ret
开发者ID:ac1965,项目名称:kigen,代码行数:55,代码来源:unionfs_fuse.py


示例5: chgdir

 def chgdir(self, dir):
     """
     Change to directory
 
     @arg: string
     @return: none
     """
     if not os.path.isdir(dir):
         print red('error') + ': ' + 'cannot change dir to ' + dir
         sys.exit(2)
     if not os.getcwd() == dir:
         os.chdir(dir)
开发者ID:ac1965,项目名称:kigen,代码行数:12,代码来源:kernel.py


示例6: build_sequence

def build_sequence(master_config, temp, verbose):
	"""
	fuse build sequence

	@arg: dict
	@arg: dict
	@arg: string
	@return: bool
	"""
	zero = int('0')
	ret = True

	if os.path.isfile('%s/fuse-%s.tar.gz' % (utils.get_distdir(temp), str(master_config['fuse_ver']))) is not True:
		ret = download(master_config['fuse_ver'], temp, verbose)
		if ret is not zero:
			print(red('error: ')+'initramfs.fuse.download() failed')
			sys.exit(2)

	ret = extract(master_config['fuse_ver'], temp, verbose)
	ret = zero # grr, tar thing to not return 0 when success

	ret = configure(temp['work'] + '/fuse-' + master_config['fuse_ver'], master_config, temp, verbose)
	if ret is not zero:
		print(red('error: ')+'initramfs.fuse.configure() failed')
		sys.exit(2)

	ret = compile(temp['work'] + '/fuse-' + master_config['fuse_ver'], master_config, verbose)
	if ret is not zero:
		print(red('error: ')+'initramfs.fuse.compile() failed')
		sys.exit(2)

#	ret = install(temp['work'] + '/fuse-' + master_config['fuse_ver'], master_config, verbose)
#	if ret is not zero:
#		print red('error: ')+'initramfs.fuse.install() failed'
#		sys.exit(2)
#
#	ret = strip(master_config, temp)
#	if ret is not zero:
#		print red('error: ')+'initramfs.fuse.strip() failed'
#		sys.exit(2)
#
#	ret = compress(master_config, temp, verbose)
#	if ret is not zero:
#		print red('error: ')+'initramfs.fuse.compress() failed'
#		sys.exit(2)

	ret = cache(temp['work'] + '/fuse-' + master_config['fuse_ver'], master_config, temp, verbose)
	if ret is not zero:
		print(red('error: ')+'initramfs.fuse.compress() failed')
		sys.exit(2)

	return ret
开发者ID:kungfoo-linux,项目名称:kigen,代码行数:52,代码来源:fuse.py


示例7: fail

    def fail(self, step):
        """
        @arg step   string

        @return     exit
        """
        print(red("error") + ": initramfs.screen." + step + "() failed")
        sys.exit(2)
开发者ID:r1k0,项目名称:kigen,代码行数:8,代码来源:screen.py


示例8: fail

    def fail(self, step):
        """
        @arg step   string

        @return     exit
        """
        print(red('error')+': initramfs.splash.'+step+'() failed')
        sys.exit(2)
开发者ID:r1k0,项目名称:kigen,代码行数:8,代码来源:splash.py


示例9: copy_config

 def copy_config(self, source, dest): #, self.dotconfig, self.kerneldir + '/.config', self.quiet):
     """
     Copy kernel .config file to kerneldir 
     (/usr/src/linux by default)
 
     @arg: string
     @arg: string
     @return: none
     """
     cpv = ''
     if self.quiet is '': cpv = '-v'
     print green(' * ') + turquoise('kernel.copy_config') + ' ' + source + ' -> ' + dest
     if os.path.isfile(source):
         return os.system('cp %s %s %s' % (cpv, source, dest))
     else:
         print red('error: ') + source + " doesn't exist."
         sys.exit(2)
开发者ID:ac1965,项目名称:kigen,代码行数:17,代码来源:kernel.py


示例10: fail

    def fail(self, step):
        """
        Exit

        @arg step   string
        @return     exit
        """
        print(red('error')+': initramfs.dropbear.'+step+'() failed')
        sys.exit(2)
开发者ID:kungfoo-linux,项目名称:kigen,代码行数:9,代码来源:dropbear.py


示例11: build_sequence

def build_sequence(master_config, temp, quiet):
	"""
	iscsi build sequence

	@arg: dict
	@arg: dict
	@arg: string
	@return: bool
	"""
	zero = int('0')
	ret = True

	if os.path.isfile('%s/open-iscsi-%s.tar.gz' % (utils.get_distdir(temp), str(master_config['iscsi_ver']))) is not True:
		ret = download(master_config['iscsi_ver'], temp, quiet)
		if ret is not zero:
			print(red('error: ')+'initramfs.iscsi.download() failed')
			sys.exit(2)

	ret = extract(master_config['iscsi_ver'], temp, quiet)
	ret = zero # grr, tar thing to not return 0

	ret = compile(temp['work'] + '/open-iscsi-' + master_config['iscsi_ver'], master_config, quiet)
	if ret is not zero:
		print(red('error: ')+'initramfs.iscsi.compile() failed')
		sys.exit(2)

# TODO remove manpage rm -rf %s/iscsi/man % temp['work']

	ret = strip(master_config, temp)
	if ret is not zero:
		print(red('error: ')+'initramfs.iscsi.strip() failed')
		sys.exit(2)

	ret = compress(master_config, temp, quiet)
	if ret is not zero: 
		print(red('error: ')+'initramfs.iscsi.compress() failed')
		sys.exit(2)

	ret = cache(temp['work'] + '/open-iscsi-' + master_config['iscsi_ver'], master_config, temp, quiet)
	if ret is not zero: 
		print(red('error: ')+'initramfs.iscsi.compress() failed')
		sys.exit(2)

	return ret
开发者ID:kungfoo-linux,项目名称:kigen,代码行数:44,代码来源:iscsi.py


示例12: chgdir

    def chgdir(self, dir):
        """
        Change to directory

        @arg: string
        @return: none
        """
        if not os.path.isdir(dir):
            print(red("error") + ": " + "cannot change dir to " + dir)
            sys.exit(2)
        if not os.getcwd() == dir:
            os.chdir(dir)
开发者ID:r1k0,项目名称:kigen,代码行数:12,代码来源:screen.py


示例13: getdotconfig

def getdotconfig(binary, kerneldir, libdir, verbose):

    print(green(' * ')+turquoise('tool.extract.kernel.getdotconfig ')+'from '+binary+' to /var/tmp/kigen/dotconfig')

    if not os.path.isfile(binary):
        print(red('error')+': '+binary+' is not a file!')
        sys.exit(2)

    if os.path.isfile('/var/tmp/kigen/dotconfig'):
        from time import strftime
        os.system('mv %s %s-%s ' % ('/var/tmp/kigen/dotconfig', '/var/tmp/kigen/dotconfig', strftime("%Y-%m-%d-%H-%M-%S")))

    os.system('sh %s %s > /var/tmp/kigen/dotconfig 2>/dev/null' % (libdir+'/tools/extract-ikconfig', binary))
开发者ID:kungfoo-linux,项目名称:kigen,代码行数:13,代码来源:extract.py


示例14: initramfs

def initramfs(temproot, extract, to, verbose):
    """
    Extract user initramfs

    @return: bool
    """
    # copy initramfs to /usr/src/linux/usr/initramfs_data.cpio.gz, should we care?
    print(green(' * ') + turquoise('tool.extract.initramfs ') + 'to ' + to)

    # clean previous root
    if os.path.isdir(to):
        from time import strftime
        os.system('mv %s %s-%s ' % (to, to, strftime("%Y-%m-%d-%H-%M-%S")))
    else:
        process('mkdir -p %s' % to, verbose)

    # create dir if needed
    if not os.path.isdir(to):
        os.makedirs(to)

    # check if binary is gzip or xz format
    ret = gziporxz(extract, verbose)
    if ret is ':(':
        print(red('error') + ': don\'t know the format of %s' % extract)

    if ret is 'gzip':
        process('cp %s %s/initramfs_data.cpio.gz' % (extract, to), verbose)
        # extract gzip archive
        process('gzip -d -f %s/initramfs_data.cpio.gz' % to, verbose)

    elif ret is 'xz':
        process('cp %s %s/initramfs_data.cpio.xz' % (extract, to), verbose)
        process('unxz %s/initramfs_data.cpio.xz' % to, verbose)

    # extract cpio archive
    os.chdir(to)
    os.system('cpio -id < initramfs_data.cpio 2>/dev/null')
    os.system('rm initramfs_data.cpio')
开发者ID:kungfoo-linux,项目名称:kigen,代码行数:38,代码来源:extract.py


示例15: build

    def build(self):
        """
        luks build sequence

        @return: bool
        """
        zero = int('0')

        # make sure dev-libs/libgcrypt has static-libs use flag enabled
        if not pkg_has_useflag('dev-libs', 'libgcrypt', 'static-libs'):
            print(red('error')+': utils.pkg_has_useflag("dev-libs", "libgcrypt", "static-libs") failed, remerge libgcrypt with +static-libs')
            sys.exit(2)

        if os.path.isfile('%s/cryptsetup-%s.tar.bz2' % (get_distdir(self.temp), self.luks_ver)) is not True:
            print(green(' * ') + '... luks.download')
            if self.download() is not zero:
                process('rm -v %s/cryptsetup-%s.tar.bz2' % (get_distdir(self.temp), self.luks_ver), self.verbose)
                self.fail('download')

        print(green(' * ') + '... luks.extract')
        self.extract()
        # grr, tar thing to not return 0 when success

        print(green(' * ') + '... luks.configure')
        if self.configure()is not zero: self.fail('configure')

        print(green(' * ') + '... luks.make')
        if self.make() is not zero: self.fail('make')

        print(green(' * ') + '... luks.strip')
        if self.strip() is not zero: self.fail('strip')

        print(green(' * ') + '... luks.compress')
        if self.compress() is not zero: self.fail('compress')

        print(green(' * ') + '... luks.cache')
        if self.cache() is not zero: self.fail('cache')
开发者ID:r1k0,项目名称:kigen,代码行数:37,代码来源:luks.py


示例16: cli_parser

def cli_parser():

    target = 'none'

    cli = { 'nocache':      '',                 \
            'oldconfig':    True,               \
            'kerneldir':    kerneldir,          \
            'arch':         identify_arch()}

    verbose = { 'std':      '',     \
                'set':      False,  \
                'logfile':  '/var/log/kigen.log'}

    master_conf = {}
    kernel_conf = {}
    modules_conf = {}
    initramfs_conf = {}
    version_conf = {}

    # copy command line arguments
    cliopts = sys.argv

    # parse /etc/kigen/master.conf
    master_conf = etc_parser_master()

    # if not enough parameters exit with usage
    if len(sys.argv) < 2:
        print_usage()
        sys.exit(2)

    # set default kernel sources
    if 'kernel-sources' in master_conf:
        # if set grab value from config file
        cli['kerneldir'] = master_conf['kernel-sources']
    # else: exit

    # @@ cli['KV'] = get_kernel_version(cli['kerneldir'])
    cli['KV'] = get_kernel_utsrelease(cli['kerneldir'])

    # exit if kernel dir doesn't exist
    if not os.path.isdir(cli['kerneldir']):
        print red('error') + ': ' + cli['kerneldir'] + ' does not exist.'
        sys.exit(2)
    # exit if kernel version is not found
    if cli['KV'] is 'none':
        print red('error') + ': ' + cli['kerneldir']+'/Makefile not found'
        sys.exit(2)

    # prevent multiple targets from running
    if 'k' in cliopts and 'i' in cliopts:
        print red('error: ') + 'kigen cannot run multiple targets at once'
        print_usage()
        sys.exit(2)
    elif 'initramfs' in cliopts and 'kernel' in cliopts:
        print red('error: ') + 'kigen cannot run multiple targets at once'
        print_usage()
        sys.exit(2)
    elif 'k' in cliopts and 'initramfs' in cliopts:
        print red('error: ') + 'kigen cannot run multiple targets at once'
        print_usage()
        sys.exit(2)
    elif 'i' in cliopts and 'kernel' in cliopts:
        print red('error: ') + 'kigen cannot run multiple targets at once'
        print_usage()
        sys.exit(2)

    # === parsing for the kernel target ===
    if 'kernel' in sys.argv or 'k' in sys.argv:
        # we found the kernel target
        # parse accordingly
        if 'kernel' in sys.argv:
            target = 'kernel'
            cliopts.remove('kernel')
        if 'k' in sys.argv:
            target = 'kernel'
            cliopts.remove('k')

        # parse 
        kernel_conf = etc_parser_kernel()

        try:
            # parse command line
            opts, args = getopt(cliopts[1:], "idhn", [  \
                                    "help",                     \
                                    "info",                     \
                                    "version",                  \
                                    "credits",                  \
                                    "conf=",                    \
                                    "dotconfig=",               \
                                    "bbconf=",                  \
                                    "rename=",                  \
                                    "initramfs=",               \
                                    "mrproper",                 \
                                    "clean",                    \
                                    "menuconfig",               \
                                    "allyesconfig",             \
                                    "nomodinstall",             \
                                    "fakeroot=",                \
                                    "allnoconfig",              \
                                    "nooldconfig",              \
#.........这里部分代码省略.........
开发者ID:ac1965,项目名称:kigen,代码行数:101,代码来源:cliparser.py


示例17: cli_parser

def cli_parser():

    target = ''

    cli = { 'nocache':      '',                 \
            'oldconfig':    True,               \
            # typically kernel sources are found here
            'kerneldir':    '/usr/src/linux',   \
            'arch':         utils.misc.identify_arch()}

    verbose = { 'std':      '',     \
                'set':      False,  \
                'logfile':  '/var/log/kigen.log'}

    master_conf     = {}
    kernel_conf     = {}
    modules_conf    = {}
    initramfs_conf  = {}
    version_conf    = {}
    url_conf        = {}

    # copy command line arguments
    cliopts = sys.argv

    # parse /etc/kigen/master.conf
    master_conf = etcparser.etc_parser_master()

    # if not enough parameters exit with usage
    if len(sys.argv) < 2:
        usage.print_usage()
        sys.exit(2)

    # set default kernel sources
    if 'kernel-sources' in master_conf:
        # if set grab value from config file
        cli['kerneldir'] = master_conf['kernel-sources']
    # else: exit

    if not 'tool' in cliopts and not 't' in cliopts:
        # don't check for kernel version if we use 'kigen tool'
        cli['KV'], cli['KNAME'] = utils.misc.get_kernel_version(cli['kerneldir'])

        # exit if kernel dir doesn't exist
        if not os.path.isdir(cli['kerneldir']):
            print(stdout.red('error') + ': ' + cli['kerneldir'] + ' does not exist.')
            sys.exit(2)
        # exit if kernel version is not found
        if cli['KV'] is 'none':
            print(stdout.red('error') + ': ' + cli['kerneldir']+'/Makefile not found')
            sys.exit(2)

    # prevent multiple targets from running
    if ('k' in cliopts and 'i' in cliopts)               or \
        ('initramfs' in cliopts and 'kernel' in cliopts) or \
        ('k' in cliopts and 'initramfs' in cliopts)      or \
        ('i' in cliopts and 'kernel' in cliopts)         or \
        ('t' in cliopts and 'kernel' in cliopts)         or \
        ('t' in cliopts and 'initramfs' in cliopts)      or \
        ('tool' in cliopts and 'kernel' in cliopts)      or \
        ('tool' in cliopts and 'initramfs' in cliopts)   or \
        ('tool' in cliopts and 'i' in cliopts)           or \
        ('tool' in cliopts and 'k' in cliopts)           or \
        ('t' in cliopts and 'i' in cliopts)              or \
        ('t' in cliopts and 'k' in cliopts):
        print(stdout.red('error') + ': kigen cannot run multiple targets at once.')
        sys.exit(2)

    # === parsing for the kernel target ===
    if 'kernel' in sys.argv or 'k' in sys.argv:
        # we found the kernel target
        # parse accordingly
        if 'kernel' in sys.argv:
            target = 'kernel'
            cliopts.remove('kernel')
        if 'k' in sys.argv:
            target = 'k'
            cliopts.remove('k')

        # parse 
        kernel_conf = etcparser.etc_parser_kernel()

        try:
            # parse command line
            opts, args = getopt(cliopts[1:], "dhn", [           \
                                    "help",                     \
                                    "version",                  \
                                    "credits",                  \
                                    "conf=",                    \
                                    "dotconfig=",               \
                                    "bbconf=",                  \
                                    "rename=",                  \
                                    "initramfs=",               \
                                    "mrproper",                 \
                                    "clean",                    \
                                    "silentoldconfig",          \
                                    "defconfig",                \
                                    "localmodconfig",           \
                                    "localyesconfig",           \
                                    "menuconfig",               \
                                    "allyesconfig",             \
#.........这里部分代码省略.........
开发者ID:kungfoo-linux,项目名称:kigen,代码行数:101,代码来源:cliparser.py


示例18: build

    def build(self):
        """
        Build kernel
        """
        zero = int('0')

        print(green(' * ')+'Kernel sources Makefile version '+white(self.KV)+' aka '+white(self.kname))

        # dotconfig provided by config file
        if self.kernel_conf['dotconfig']:
            # backup the previous .config if found
            if os.path.isfile(self.kernel_conf['dotconfig']):
                from time import strftime
                self.copy_config(self.kerneldir + '/.config', self.kerneldir + '/.config-' + str(strftime("%Y-%m-%d-%H-%M-%S")))

            # copy the custom .config if they are not the same
            if self.kernel_conf['dotconfig'] != self.kerneldir + '/.config':
                self.copy_config(self.kernel_conf['dotconfig'], self.kerneldir + '/.config')
        # dot config provided by cli

        if self.dotconfig:
            # backup the previous .config if found
            if os.path.isfile(self.kerneldir + '/.config'):
                from time import strftime
                self.copy_config(self.kerneldir + '/.config', self.kerneldir + '/.config-' + str(strftime("%Y-%m-%d-%H-%M-%S")))

            # copy the custom .config if they are not the same
            if self.dotconfig != self.kerneldir + '/.config':
                self.copy_config(self.dotconfig, self.kerneldir + '/.config')
        # WARN do not use self.dotconfig from now on but use self.kerneldir + '/.config' to point to kernel config

        if (self.mrproper is True) or (self.mrproper == 'True'):
            if self.make_mrproper() is not zero: self.fail('mrproper')
        if (self.clean is True) or (self.clean == 'True' ):
            if self.make_clean() is not zero: self.fail('clean')

        # self.fixdotconfig is a list like : initramfs,selinux,splash,pax
        fixdotconfiglist = self.fixdotconfig.split(',')
        d = {}
        for i in fixdotconfiglist:
            d[i] = ''
            if 'initramfs' in d:
                # PATCH initramfs kernel option
                self.add_option('CONFIG_INITRAMFS_SOURCE='+self.temp['initramfs'])
            if 'selinux' in d:
                # PATCH selinux kernel option
                self.add_option('CONFIG_AUDIT=y')
                self.add_option('CONFIG_AUDITSYSCALL=y')
                self.add_option('CONFIG_AUDIT_TREE=y')
                self.add_option('CONFIG_AUDIT_GENERIC=y')
                self.add_option('CONFIG_SECURITY_NETWORK=y')
                # above required to show SElinux
                self.add_option('CONFIG_SECURITY_SELINUX=y')
            if 'pax' in d:
                # PATCH PaX kernel option
                self.add_option('CONFIG_PAX_EMUTRAP=y')
            if 'splash' in d:
                # PATCH splash support
                self.add_option('CONFIG_FB=y')
                self.add_option('CONFIG_CONNECTOR=y')
                self.add_option('CONFIG_FB_UVESA=y')
                self.add_option('CONFIG_BLK_DEV=y')
                self.add_option('CONFIG_BLK_DEV_RAM=y')
                self.add_option('CONFIG_BLK_DEV_INITRD=y')
                self.add_option('CONFIG_FB_MODE_HELPERS=y')
                self.add_option('CONFIG_FB_TILEBLITTING=n')
                self.add_option('CONFIG_FRAMEBUFFER_CONSOLE=y')
                self.add_option('CONFIG_FB_CON_DECOR=y')
                self.add_option('CONFIG_INPUT_EVDEV=y')
                self.add_option('CONFIG_EXT2_FS=y')
                # FIXME this needs sys-apps/v86d
#                self.add_option('/usr/share/v86d/initramfs')

        # !!! by default don't alter dotconfig
        # !!! only if --fixdotconfig=<feat> is passed
        if (self.initramfs is not '') and (os.path.isfile(self.initramfs)):
            # user provides an initramfs!
            # FIXME do error handling: gzip screws it all like tar
#            if (self.fixdotconfig is True) or (self.kernel_conf['fixdotconfig'] is True):
#                self.add_option('CONFIG_INITRAMFS_SOURCE='+self.temp['initramfs'])
            self.import_user_initramfs(self.initramfs)
        #else:
        #    # ensure previous run with --initramfs have not left INITRAMFS configs if --fixdotconfig
        #    if self.fixdotconfig is True:
        #        self.remove_option('CONFIG_INITRAMFS_SOURCE')

        # initramfs provided by config file only
        elif (self.kernel_conf['initramfs'] is not '') and (self.initramfs is '') and (os.path.isfile(self.initramfs)):
#            if (self.fixdotconfig is True) or (self.kernel_conf['fixdotconfig'] is True):
#                self.add_option('CONFIG_INITRAMFS_SOURCE='+self.temp['initramfs'])
            self.import_user_initramfs(self.kernel_conf['initramfs'])
#        else:
#            if self.fixdotconfig is True:
#                self.remove_option('CONFIG_INITRAMFS_SOURCE')
        elif (self.initramfs is not ''):
            print(red('error: ') + self.initramfs + " is not a file")
            sys.exit(2)
 
        if self.defconfig is True:
            if self.make_defconfig() is not zero: self.fail('defconfig')
#.........这里部分代码省略.........
开发者ID:kungfoo-linux,项目名称:kigen,代码行数:101,代码来源:kernel.py


示例19: print_usage_initramfs

def print_usage_initramfs(cli, master_conf, initramfs_conf, modules_conf):
    print('Parameter:\t\t    Config value:\tDescription:')
    print()
    print('--execute, -x\t\t\t\t\tExecute')
    print()
    print('Features:')
    print('+ from source code')
    print('| --source-luks             ', end='')
    print(initramfs_conf['source-luks'], end='') # bool
    print('\t\tInclude LUKS support from sources')
    print('| --source-lvm2             ', end='')
    print(initramfs_conf['source-lvm2'], end='') # bool
    print('\t\tInclude LVM2 support from sources')
    print(stdout.red('| --source-dropbear         '), end='')
    print(initramfs_conf['source-dropbear'], end='') # bool
    print('\t\tInclude dropbear support from sources')
    print('|  --debugflag              ', end='')
    print(initramfs_conf['debugflag'], end='') # bool
    print('\t\t Compile dropbear with #define DEBUG_TRACE in debug.h')
    print('| --source-screen           ', end='')
    print(initramfs_conf['source-screen'], end='') # bool
    print('\t\tInclude the screen binary tool from sources')
    print('| --source-disklabel        ', end='')
    print(initramfs_conf['source-disklabel'], end='') # bool
    print('\t\tInclude support for UUID/LABEL from sources')
    print('| --source-ttyecho          ', end='')
    print(initramfs_conf['source-ttyecho'], end='') # bool
    print('\t\tCompile and include the handy ttyecho.c tool')
    print('| --source-strace           ', end='')
    print(initramfs_conf['source-strace'], end='') # bool
    print('\t\tCompile and include the strace binary tool from sources')
    print('| --source-dmraid           ', end='')
    print(initramfs_conf['source-dmraid'], end='') # bool
    print('\t\tInclude DMRAID support from sources')
#    print('| --source-all              ', end='')
#    print(initramfs_conf['source-all'], end='') # bool
#    print('\t\tInclude all possible features from sources')

    print('+ from host binaries')
    print('| --host-busybox            ', end='')
    print(initramfs_conf['bin-busybox'], end='') # bool
    print('\t\tInclude busybox support from host')
    print('| --host-luks               ', end='')
    print(initramfs_conf['bin-luks'], end='') # bool
    print('\t\tInclude LUKS support from host')
    print('| --host-lvm2               ', end='')
    print(initramfs_conf['bin-lvm2'], end='') # bool
    print('\t\tInclude LVM2 support from host')
    print('| --host-dropbear           ', end='')
    print(initramfs_conf['bin-dropbear'], end='') # bool
    print('\t\tInclude dropbear support from host')
    print('| --host-screen             ', end='')
    print(initramfs_conf['bin-screen'], end='') # bool
    print('\t\tInclude the screen binary tool from host')
    print('| --host-disklabel          ', end='')
    print(initramfs_conf['bin-disklabel'], end='') # bool
    print('\t\tInclude support for UUID/LABEL from host')
    print('| --host-strace             ', end='')
    print(initramfs_conf['bin-strace'], end='') # bool
    print('\t\tInclude the strace binary tool from host')
#    print('| --host-evms               ', end='')
#    print(initramfs_conf['bin-evms'], end='') # bool
#    print('\t\tInclude the evms binary tool from host')
    print('| --host-glibc              ', end='')
    print(initramfs_conf['bin-glibc'], end='') # bool
    print('\t\tInclude host GNU C libraries (required for dns,dropbear)')
    print('| --host-libncurses         ', end='')
    print(initramfs_conf['bin-libncurses'], end='') # bool
    print('\t\tInclude host libncurses (required for dropbear)')
    print('| --host-zlib               ', end='')
    print(initramfs_conf['bin-zlib'], end='') # bool
    print('\t\tInclude host zlib (required for dropbear)')
    print('| --host-dmraid             ', end='')
    print(initramfs_conf['bin-dmraid'], end='') # bool
    print('\t\tInclude DMRAID support from host')
#    print('| --host-all                ', end='')
#    print(initramfs_conf['bin-all'], end='') # bool
#    print('\t\tInclude all possible features from host')
    print()

    print(stdout.yellow('  --dynlibs                 '), end='')
    print(initramfs_conf['dynlibs'], end='') # bool
    print('\t\tInclude detected libraries from dynamically linked binaries')

    # fix \t display depending on length of cli[splash']
    if cli['splash'] != '':
        if len(cli['splash']) <= 4:
            tab = '\t\t\t'
        elif len(cli['splash']) > 4 and len(cli['splash']) < 8:
            tab = '\t\t'
        elif len(cli['splash']) > 8:
            tab = '\t\t'
    else:
        tab = '\t\t\t'
#    print('  --splash=<theme>          "'+initramfs_conf['splash'], end='"')
#    print(tab+'Include splash support (splashutils must be merged)')
#    print('   --sres=YxZ[,YxZ]         "'+initramfs_conf['sres'], end='"')
#    print('\t\t\t Splash resolution, all if not set')

    # fix \t display depending on length of cli['ply']
#.........这里部分代码省略.........
开发者ID:r1k0,项目名称:kigen,代码行数:101,代码来源:usage.py



注:本文中的stdout.red函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python stdwin.fleep函数代码示例发布时间:2022-05-27
下一篇:
Python stdout.green函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap