示例#1
0
def installBoot(install_root, profile):
    renderTemplates(profile.get('booting', 'bootloader_templates').split(','))

    if os.access('/proc/mdstat', os.R_OK):
        installPackages(profile.get('packages', 'mdadm_package'))

    if execute_lines('/sbin/lvm pvs'):
        installPackages(profile.get('packages', 'lvm_package'))

    if os.access('/sys/fs/bcache', os.R_OK):
        installPackages(profile.get('packages', 'bcache_package'))

    if os.path.exists('/sys/firmware/efi'):
        installPackages(profile.get('packages', 'bootloader_package_efi'))
    else:
        installPackages(profile.get('packages', 'bootloader_package_bios'))

    try:
        chroot_execute(profile.get('booting', 'bootloader_config'))
    except NoOptionError:
        pass

    try:
        installPackages(profile.get('packages', 'kernel_package'))
    except NoOptionError:
        pass

    try:
        bootloader_install = profile.get('booting', 'bootloader_install')
    except NoOptionError:
        bootloader_install = None

    if bootloader_install:
        for drive in fsConfigValues()['boot_drives']:
            chroot_execute(bootloader_install.format(drive))
示例#2
0
文件: packaging.py 项目: T3kton/disks
def installBase( install_root, profile ):
  if manager_type == 'apt':
    chroot_execute( '/usr/bin/apt-get install -q -y {0}'.format( profile.get( 'packaging', 'base' ) ) )

  elif manager_type == 'yum':
    chroot_execute( '/usr/bin/yum -y groupinstall {0}'.format( profile.get( 'packaging', 'base' ) ) )
    chroot_execute( '/usr/bin/yum -y reinstall yum centos-release' )  # find a better way to figure out what needs to be re-installed
    execute( 'ash -c "rm {0}/etc/yum.repos.d/*"'.format( install_root ) )  # clean up extra repos that some package might have left behind... this is the last time we will do this.... any package after this we will allow to keep their repos, we are really just after the base ones
    renderTemplates( profile.get( 'packaging', 'source_templates' ).split( ',' ) )

  elif manager_type == 'zypper':
    chroot_execute( '/usr/bin/zypper --non-interactive install {0}'.format( profile.get( 'packaging', 'base' ) ) )
示例#3
0
文件: packaging.py 项目: T3kton/disks
def preBaseSetup( profile ):
  renderTemplates( profile.get( 'packaging', 'prebase_templates' ).split( ',' ) )

  for item in profile.items( 'packaging' ):
    if item[0].startswith( 'install_env_var_' ):
      ( name, value ) = item[1].split( ':', 1 )
      chroot_env[ name ] = value  # tehinically we are affecting all the chroot commands, for now this is ok.

  if manager_type == 'apt':
    for item in profile.items( 'packaging' ):
      if item[0].startswith( 'selection_' ):
        chroot_execute( '/usr/bin/debconf-set-selections', item[1] )

  for item in profile.items( 'packaging' ):
    if item[0].startswith( 'prebase_cmd_' ):
      chroot_execute( item[1] )
示例#4
0
文件: packaging.py 项目: pnhowe/disks
def configSources(install_root, profile, value_map):
    global manager_type
    manager_type = profile.get('packaging', 'manager_type')

    if manager_type not in ('apt', 'yum', 'zypper'):
        raise Exception(
            'Unknwon Packaging manager type "{0}"'.format(manager_type))

    if manager_type == 'yum':
        execute('ash -c "rm {0}/etc/yum.repos.d/*"'.format(install_root))

    key_uris = []
    for repo in value_map['repo_list']:
        if 'key_uri' in repo:
            if repo['type'] != manager_type:
                continue

            uri = repo['key_uri']
            if uri not in key_uris:
                try:
                    proxy = repo['proxy']
                except Exception:
                    proxy = None

                tmp = http_getfile(uri, proxy=proxy)

                if 'key_file' in repo:
                    key_file_path = '{0}/{1}'.format(install_root,
                                                     repo['key_file'])
                    if not os.path.isdir(os.path.dirname(key_file_path)):
                        os.makedirs(os.path.dirname(key_file_path))

                    open(key_file_path, 'wb').write(tmp)

                elif manager_type == 'apt':  # for binary keys, write it to a file ^
                    chroot_execute('/usr/bin/apt-key add -', tmp.decode())

                key_uris.append(uri)

    renderTemplates(profile.get('packaging', 'source_templates').split(','))

    print('Updating Repo Data...')
    if manager_type == 'apt':
        chroot_execute('/usr/bin/apt-get update')