migrate the mysql sync script

This commit is contained in:
z4yx 2020-04-05 13:24:27 +08:00
parent 2e5b023597
commit 2835a3d4fa

View File

@ -4,9 +4,7 @@ set -e
set -o pipefail set -o pipefail
_here=`dirname $(realpath $0)` _here=`dirname $(realpath $0)`
. ${_here}/helpers/apt-download alias apt-sync="${_here}/apt-sync.py"
[ -z "${LOADED_APT_DOWNLOAD}" ] && (echo "failed to load apt-download"; exit 1)
BASE_PATH="${TUNASYNC_WORKING_DIR}" BASE_PATH="${TUNASYNC_WORKING_DIR}"
BASE_URL="${TUNASYNC_UPSTREAM_URL:-"https://repo.mysql.com"}" BASE_URL="${TUNASYNC_UPSTREAM_URL:-"https://repo.mysql.com"}"
@ -24,40 +22,15 @@ APT_PATH="${BASE_PATH}/apt"
UBUNTU_PATH="${APT_PATH}/ubuntu" UBUNTU_PATH="${APT_PATH}/ubuntu"
DEBIAN_PATH="${APT_PATH}/debian" DEBIAN_PATH="${APT_PATH}/debian"
UBUNTU_VERSIONS=("trusty" "precise" "xenial" "bionic")
DEBIAN_VERSIONS=("wheezy" "jessie" "stretch" "buster")
mkdir -p ${YUM_PATH} ${UBUNTU_PATH} ${DEBIAN_PATH} mkdir -p ${YUM_PATH} ${UBUNTU_PATH} ${DEBIAN_PATH}
# =================== APT repos =============================== # =================== APT repos ===============================
if [[ ! -z ${DRY_RUN:-} ]]; then MYSQL_APT_REPOS="mysql-5.6,mysql-5.7,mysql-tools,connector-python-2.1,mysql-8.0"
export APT_DRY_RUN=1 apt-sync "${BASE_URL}/apt/ubuntu" @ubuntu-lts $MYSQL_APT_REPOS amd64,i386 "${UBUNTU_PATH}"
fi
MYSQL_APT_REPOS=("mysql-5.6" "mysql-5.7" "mysql-tools" "connector-python-2.1" "mysql-8.0")
base_url="${BASE_URL}/apt/ubuntu"
for version in ${UBUNTU_VERSIONS[@]}; do
for repo in ${MYSQL_APT_REPOS[@]}; do
for arch in "amd64" "i386"; do
apt-download-binary ${base_url} "$version" "$repo" "$arch" "${UBUNTU_PATH}" || true
done
done
done
echo "Ubuntu finished" echo "Ubuntu finished"
apt-sync "${BASE_URL}/apt/debian" @debian-current $MYSQL_APT_REPOS amd64,i386 "${DEBIAN_PATH}"
base_url="${BASE_URL}/apt/debian"
for version in ${DEBIAN_VERSIONS[@]}; do
for repo in ${MYSQL_APT_REPOS[@]}; do
for arch in "amd64" "i386"; do
apt-download-binary ${base_url} "$version" "$repo" "$arch" "${DEBIAN_PATH}" || true
done
done
done
echo "Debian finished" echo "Debian finished"
# =================== YUM/DNF repos ========================== # =================== YUM/DNF repos ==========================
cache_dir="/tmp/yum-mysql-cache/" cache_dir="/tmp/yum-mysql-cache/"