コード例 #1
0
def InstallGoogleCloudSdk():
    # TODO: There's a google-cloud-sdk in AUR which should be used
    # but it's not optimal for cloud use. The image is too large.
    utils.LogStep('Install Google Cloud SDK')
    usr_share_google = '/usr/share/google'
    archive = os.path.join(usr_share_google, 'google-cloud-sdk.zip')
    unzip_dir = os.path.join(usr_share_google, 'google-cloud-sdk')
    utils.CreateDirectory(usr_share_google)
    utils.DownloadFile(
        'https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.zip',
        archive)
    utils.Run(['unzip', archive, '-d', usr_share_google])
    utils.AppendFile('/etc/bash.bashrc',
                     'export CLOUDSDK_PYTHON=/usr/bin/python2')
    utils.Run([
        os.path.join(unzip_dir, 'install.sh'), '--usage-reporting', 'false',
        '--bash-completion', 'true', '--disable-installation-options',
        '--rc-path', '/etc/bash.bashrc', '--path-update', 'true'
    ],
              cwd=unzip_dir,
              env={'CLOUDSDK_PYTHON': '/usr/bin/python2'})
    utils.Symlink(os.path.join(unzip_dir, 'bin/gcloud'), '/usr/bin/gcloud')
    utils.Symlink(os.path.join(unzip_dir, 'bin/gcutil'), '/usr/bin/gcutil')
    utils.Symlink(os.path.join(unzip_dir, 'bin/gsutil'), '/usr/bin/gsutil')
    utils.SecureDeleteFile(archive)
コード例 #2
0
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
コード例 #3
0
def ForwardSystemdToConsole():
    utils.LogStep('Installing syslinux bootloader')
    utils.AppendFile('/etc/systemd/journald.conf', 'ForwardToConsole=yes')