mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-20 04:12:42 +00:00
calculate the size of mysql repo
This commit is contained in:
parent
b1ae8488ac
commit
d2603a85eb
18
mysql.sh
18
mysql.sh
@ -10,9 +10,10 @@ yum_sync="${_here}/yum-sync.py"
|
|||||||
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"}"
|
||||||
MYSQL_RSYNC_UPSTREAM="${DOWNLOADS_RSYNC_UPSTREAM:-rsync://ftp5.gwdg.de/pub/linux/mysql/Downloads/}"
|
MYSQL_RSYNC_UPSTREAM="${DOWNLOADS_RSYNC_UPSTREAM:-rsync://ftp5.gwdg.de/pub/linux/mysql/Downloads/}"
|
||||||
|
export REPO_SIZE_FILE=/tmp/reposize.$RANDOM
|
||||||
|
|
||||||
MYSQL_DOWNLOAD_PATH="${BASE_PATH}/downloads/"
|
MYSQL_DOWNLOAD_PATH="${BASE_PATH}/downloads/"
|
||||||
RSYNC_OPTS="-aHvh --no-o --no-g --stats --exclude .~tmp~/ --delete --delete-excluded --delete-after --delay-updates --safe-links --timeout=120 --contimeout=120"
|
RSYNC_OPTS="-aHv --no-o --no-g --stats --exclude .~tmp~/ --delete --delete-excluded --delete-after --delay-updates --safe-links --timeout=120 --contimeout=120"
|
||||||
USE_IPV6=${USE_IPV6:-"0"}
|
USE_IPV6=${USE_IPV6:-"0"}
|
||||||
if [[ $USE_IPV6 == "1" ]]; then
|
if [[ $USE_IPV6 == "1" ]]; then
|
||||||
RSYNC_OPTS="-6 ${RSYNC_OPTS}"
|
RSYNC_OPTS="-6 ${RSYNC_OPTS}"
|
||||||
@ -23,7 +24,14 @@ 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"
|
||||||
|
|
||||||
mkdir -p ${YUM_PATH} ${UBUNTU_PATH} ${DEBIAN_PATH}
|
# ================ rsync repo.mysql.com ======================
|
||||||
|
|
||||||
|
if [[ -z ${DRY_RUN:-} ]]; then
|
||||||
|
logfifo=/tmp/rsync-out.fifo
|
||||||
|
mkfifo $logfifo
|
||||||
|
awk '/^total size is /{gsub(/,/,"",$4); print "+"$4}' <$logfifo >>"$REPO_SIZE_FILE" &
|
||||||
|
rsync ${RSYNC_OPTS} "${MYSQL_RSYNC_UPSTREAM}" "${MYSQL_DOWNLOAD_PATH}" | tee $logfifo
|
||||||
|
fi
|
||||||
|
|
||||||
# =================== APT repos ===============================
|
# =================== APT repos ===============================
|
||||||
MYSQL_APT_REPOS="mysql-5.6,mysql-5.7,mysql-tools,connector-python-2.1,mysql-8.0"
|
MYSQL_APT_REPOS="mysql-5.6,mysql-5.7,mysql-tools,connector-python-2.1,mysql-8.0"
|
||||||
@ -37,8 +45,4 @@ COMPONENTS="mysql-connectors-community,mysql-tools-community,mysql-8.0-community
|
|||||||
"$yum_sync" "${BASE_URL}/yum/@{comp}/el/@{os_ver}/@{arch}/" 6-8 "$COMPONENTS" x86_64,aarch64 "@{comp}-el@{os_ver}-@{arch}" "$YUM_PATH"
|
"$yum_sync" "${BASE_URL}/yum/@{comp}/el/@{os_ver}/@{arch}/" 6-8 "$COMPONENTS" x86_64,aarch64 "@{comp}-el@{os_ver}-@{arch}" "$YUM_PATH"
|
||||||
echo "YUM finished"
|
echo "YUM finished"
|
||||||
|
|
||||||
# --------- dev.mysql.com --------
|
"${_here}/helpers/size-sum.sh" $REPO_SIZE_FILE --rm
|
||||||
|
|
||||||
if [[ -z ${DRY_RUN:-} ]]; then
|
|
||||||
rsync ${RSYNC_OPTS} "${MYSQL_RSYNC_UPSTREAM}" "${MYSQL_DOWNLOAD_PATH}"
|
|
||||||
fi
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user