Beispiel #1
0
    def add_deb_repository():
        repository_names = {
            ('ubuntu', '16.04'): 'ubuntu-xenial',
            ('ubuntu', '15.10'): 'ubuntu-wily',
            # Dropped Ubuntu 15.04 Vivid Vervet
            # Dropped Ubuntu 14.10 Utopic Unicorn
            ('ubuntu', '14.04'): 'ubuntu-trusty',
            ('debian', 'sid'): 'debian-stretch',
            ('debian', 'testing'): 'debian-stretch',
            ('debian', '9'): 'debian-stretch',
            ('debian', '8'): 'debian-jessie',
            # Dropped Debian 7 Wheezy
        }

        repo = repository_names.get((get_distro(), get_version()), None)
        if repo is None:
            # FIXME: warn/error
            repo = repository_names.get(('debian', 'sid'))

        apt_key = APTKey()
        apt_repo = APTRepo()

        apt_key.recv_keys('58118E89F3A912897C070ADBF76221572C52609D')
        apt_repo.add_repo('deb https://apt.dockerproject.org/repo ' + repo + ' main')
Beispiel #2
0
def is_alpine(versions: Optional[List[str]] = None) -> bool:
    is_version = True
    if versions:
        is_version = get_version() in versions or get_codename() in versions
    return get_distro() == "alpine" and is_version