From 7b86366c56591c4bb4bfe3d6f8dca3178e4129a9 Mon Sep 17 00:00:00 2001 From: bigeagle Date: Tue, 28 Nov 2017 00:23:25 +0800 Subject: [PATCH] update docker-ce related files --- docker-ce.py | 0 docker.sh | 72 --------------------------------- helpers/docker-ce-filelist.py | 76 ----------------------------------- 3 files changed, 148 deletions(-) mode change 100644 => 100755 docker-ce.py delete mode 100755 docker.sh delete mode 100755 helpers/docker-ce-filelist.py diff --git a/docker-ce.py b/docker-ce.py old mode 100644 new mode 100755 diff --git a/docker.sh b/docker.sh deleted file mode 100755 index d8835af..0000000 --- a/docker.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# reqires: wget, yum-utils - -set -e -set -o pipefail - -_here=`dirname $(realpath $0)` -. ${_here}/helpers/apt-download -APT_VERSIONS=("debian-wheezy" "debian-jessie" "debian-stretch" "ubuntu-precise" "ubuntu-trusty" "ubuntu-xenial") - -BASE_PATH="${TUNASYNC_WORKING_DIR}" -APT_PATH="${BASE_PATH}/apt/repo" -YUM_PATH="${BASE_PATH}/yum/repo" - -mkdir -p ${APT_PATH} ${YUM_PATH} - -wget -q -N -O ${BASE_PATH}/yum/gpg https://yum.dockerproject.org/gpg -wget -q -N -O ${BASE_PATH}/apt/gpg https://apt.dockerproject.org/gpg - -# YUM mirror -cache_dir="/tmp/yum-docker-cache/" -cfg="/tmp/docker-yum.conf" -cat < ${cfg} -[main] -keepcache=0 - -[centos6] -name=Docker Repository -baseurl=https://yum.dockerproject.org/repo/main/centos/6 -enabled=1 -gpgcheck=0 -gpgkey=https://yum.dockerproject.org/gpg -sslverify=0 - -[centos7] -name=Docker Repository -baseurl=https://yum.dockerproject.org/repo/main/centos/7 -enabled=1 -gpgcheck=0 -gpgkey=https://yum.dockerproject.org/gpg -sslverify=0 -EOF - -[ ! -d ${YUM_PATH}/centos6 ] && mkdir -p ${YUM_PATH}/centos6 -[ ! -d ${YUM_PATH}/centos7 ] && mkdir -p ${YUM_PATH}/centos7 - -if [[ -z ${DRY_RUN:-} ]]; then - reposync -c $cfg -d -p ${YUM_PATH} -e $cache_dir - createrepo --update -v -c $cache_dir -o ${YUM_PATH}/centos6 ${YUM_PATH}/centos7 - createrepo --update -v -c $cache_dir -o ${YUM_PATH}/centos7 ${YUM_PATH}/centos7 -fi -rm $cfg - -# APT mirror -if [[ ! -z ${DRY_RUN:-} ]]; then - export APT_DRY_RUN=1 -fi - -base_url="https://apt.dockerproject.org/repo" -remote_filelist="${APT_PATH}/filelist" -[[ -f $remote_filelist ]] && rm $remote_filelist - -for version in ${APT_VERSIONS[@]}; do - apt-download-binary ${base_url} "$version" "main" "amd64" "${APT_PATH}" ${remote_filelist} || true - apt-download-binary ${base_url} "$version" "main" "i386" "${APT_PATH}" ${remote_filelist} || true - apt-download-binary ${base_url} "$version" "main" "armhf" "${APT_PATH}" ${remote_filelist} || true -done - -apt-delete-old-debs ${APT_PATH} $remote_filelist - -# sync_docker "http://apt.dockerproject.org/" "${TUNASYNC_WORKING_DIR}/apt" -# sync_docker "http://yum.dockerproject.org/" "${TUNASYNC_WORKING_DIR}/yum" diff --git a/helpers/docker-ce-filelist.py b/helpers/docker-ce-filelist.py deleted file mode 100755 index 2a0e9f2..0000000 --- a/helpers/docker-ce-filelist.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python3 -import requests -from pyquery import PyQuery as pq - -meta_urls = [] - - -def is_metafile_url(url): - deb_dists=('debian', 'ubuntu', 'raspbian') - rpm_dists=('fedora', 'centos') - - for dist in deb_dists: - if '/'+dist+'/' not in url: - continue - if '/Contents-' in url: - return True - if '/binary-' in url: - return True - if 'Release' in url: - return True - - for dist in rpm_dists: - if '/'+dist+'/' not in url: - continue - if '/repodata/' in url: - return True - - return False - - -def recursive_get_filelist(base_url, filter_meta=False): - if not base_url.endswith('/'): - yield base_url - return - - r = requests.get(base_url) - if not r.ok: - return - - d = pq(r.text) - for link in d('a'): - if link.text.startswith('..'): - continue - href = base_url + link.text - if filter_meta and is_metafile_url(href): - meta_urls.append(href) - elif link.text.endswith('/'): - yield from recursive_get_filelist(href, filter_meta=filter_meta) - else: - yield href - - -def get_filelist(base_url): - yield from recursive_get_filelist(base_url, filter_meta=True) - - -def get_meta_filelist(): - for url in meta_urls: - yield from recursive_get_filelist(url, filter_meta=False) - - -if __name__ == "__main__": - import argparse - - parser = argparse.ArgumentParser() - parser.add_argument("base_url", default="https://download.docker.com/") - args = parser.parse_args() - - for file_url in get_filelist(args.base_url): - print(file_url, flush=True) - - for file_url in get_meta_filelist(): - print(file_url, flush=True) - - -# vim: ts=4 sw=4 sts=4 expandtab