Example #1
0
def main():
    args = utils.DecodeArgs(sys.argv[1])
    utils.SetupLogging(quiet=args['quiet'], verbose=args['verbose'])
    logging.info('Setup Bootstrapper Environment')
    utils.SetupArchLocale()
    InstallPackagesForStagingEnvironment()
    image_path = os.path.join(os.getcwd(), IMAGE_FILE)
    CreateImage(image_path, size_gb=int(args['size_gb']))
    mount_path = utils.CreateTempDirectory(base_dir='/')
    image_mapping = utils.ImageMapper(image_path, mount_path)
    try:
        image_mapping.Map()
        primary_mapping = image_mapping.GetFirstMapping()
        image_mapping_path = primary_mapping['path']
        FormatImage(image_mapping_path)
        try:
            image_mapping.Mount()
            utils.CreateDirectory('/run/shm')
            utils.CreateDirectory(os.path.join(mount_path, 'run', 'shm'))
            InstallArchLinux(mount_path)
            disk_uuid = SetupFileSystem(mount_path, image_mapping_path)
            ConfigureArchInstall(args, mount_path, primary_mapping['parent'],
                                 disk_uuid)
            utils.DeleteDirectory(os.path.join(mount_path, 'run', 'shm'))
            PurgeDisk(mount_path)
        finally:
            image_mapping.Unmount()
        ShrinkDisk(image_mapping_path)
    finally:
        image_mapping.Unmap()
    utils.Run(['parted', image_path, 'set', '1', 'boot', 'on'])
    utils.Sync()
Example #2
0
def SetupLocale():
    utils.LogStep('Set Locale  to US English (UTF-8)')
    utils.SetupArchLocale()
Example #3
0
def InstallPackagesForStagingEnvironment():
    utils.InstallPackages(SETUP_PACKAGES_ESSENTIAL)
    utils.InstallPackages(SETUP_PACKAGES)
    utils.SetupArchLocale()
    utils.AurInstall(name='multipath-tools-git')
    utils.AurInstall(name='zerofree')