update docker-ce related files

This commit is contained in:
bigeagle 2017-11-28 00:23:25 +08:00
parent e14262952f
commit 7b86366c56
3 changed files with 0 additions and 148 deletions

0
docker-ce.py Normal file → Executable file
View File

View File

@ -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 <<EOF > ${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"

View File

@ -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