def ConfigureArchInstall(args, mount_path, parent_path, disk_uuid, aur_packages): relative_builder_path = utils.CopyBuilder(mount_path) packages_dir = utils.CreateTempDirectory(mount_path) utils.Run(['git', 'clone', COMPUTE_IMAGE_PACKAGES_GIT_URL, packages_dir]) utils.CreateDirectory(os.path.join(mount_path, '')) aur_packages_dir = os.path.join(packages_dir, 'aur') for aur_package in aur_packages: utils.CopyFiles(aur_package, aur_packages_dir + '/') packages_dir = os.path.relpath(packages_dir, mount_path) params = { 'packages_dir': '/%s' % packages_dir, 'device': parent_path, 'disk_uuid': disk_uuid, 'accounts': args.accounts, 'debugmode': args.debug, 'quiet': args.quiet, 'verbose': args.verbose, 'packages': args.packages, 'size_gb': args.size_gb } config_arch_py = os.path.join( '/', relative_builder_path, 'arch-image.py') utils.RunChroot(mount_path, '%s "%s"' % (config_arch_py, utils.EncodeArgs(params)), use_custom_path=False) utils.DeleteDirectory(os.path.join(mount_path, relative_builder_path))
def PrepareBootstrap(workspace_dir, mirror_server, use_pacman_keys): utils.LogStep('Setting up Bootstrap Environment') arch_root = os.path.join(workspace_dir, os.listdir(workspace_dir)[0]) mirrorlist = 'Server = {MIRROR_SERVER}'.format(MIRROR_SERVER=mirror_server) utils.AppendFile(os.path.join(arch_root, 'etc/pacman.d/mirrorlist'), mirrorlist) utils.CreateDirectory(os.path.join(arch_root, 'run/shm')) if use_pacman_keys: utils.RunChroot(arch_root, 'pacman-key --init') utils.RunChroot(arch_root, 'pacman-key --populate archlinux') else: utils.ReplaceLine(os.path.join(arch_root, 'etc/pacman.conf'), 'SigLevel', 'SigLevel = Never') # Install the most basic utilities for the bootstrapper. utils.RunChroot(arch_root, 'pacman --noconfirm -Sy python3 sed') return arch_root
def ChrootIntoArchAndBuild(arch_root, relative_builder_path, args): params = { 'quiet': args.quiet, 'verbose': args.verbose, 'packages': args.packages, 'mirror': args.mirror, 'accounts': args.accounts, 'debugmode': args.debug, 'size_gb': args.size_gb } chroot_archenv_script = os.path.join('/', relative_builder_path, 'arch-staging.py') utils.RunChroot( arch_root, '%s "%s"' % (chroot_archenv_script, utils.EncodeArgs(params))) logging.debug('Bootstrap Chroot: sudo %s/bin/arch-chroot %s/', arch_root, arch_root)
def ConfigureArchInstall(args, mount_path, parent_path, disk_uuid): relative_builder_path = utils.CopyBuilder(mount_path) utils.LogStep('Download compute-image-packages') packages_dir = utils.CreateTempDirectory(mount_path) utils.Run(['git', 'clone', COMPUTE_IMAGE_PACKAGES_GIT_URL, packages_dir]) utils.CreateDirectory(os.path.join(mount_path, '')) packages_dir = os.path.relpath(packages_dir, mount_path) params = { 'packages_dir': '/%s' % packages_dir, 'device': parent_path, 'disk_uuid': disk_uuid, 'accounts': args['accounts'], 'debugmode': args['debugmode'], } params.update(args) config_arch_py = os.path.join('/', relative_builder_path, 'arch-image.py') utils.RunChroot(mount_path, '%s "%s"' % (config_arch_py, utils.EncodeArgs(params)), use_custom_path=False) utils.DeleteDirectory(os.path.join(mount_path, relative_builder_path))