From d79cf7823ed80146898bf17f66114630ff654ced Mon Sep 17 00:00:00 2001 From: z4yx Date: Sun, 5 Apr 2020 14:04:07 +0800 Subject: [PATCH] migrating gitlab-runner,influx,termux --- apt-sync.py | 2 +- gitlab-ci-multi-runner.sh | 24 ++++-------------------- gitlab-runner.sh | 26 ++++---------------------- influxdata.sh | 25 ++++--------------------- termux.sh | 34 ++++++++-------------------------- 5 files changed, 21 insertions(+), 90 deletions(-) diff --git a/apt-sync.py b/apt-sync.py index 715817d..6f45a45 100755 --- a/apt-sync.py +++ b/apt-sync.py @@ -67,7 +67,7 @@ def main(): os, comp, arch, str(args.working_dir.absolute()), filelist[1] ] - print(shell_args) + # print(shell_args) sp.run(shell_args) if args.delete: pass #TODO diff --git a/gitlab-ci-multi-runner.sh b/gitlab-ci-multi-runner.sh index 8f901cf..aa61229 100755 --- a/gitlab-ci-multi-runner.sh +++ b/gitlab-ci-multi-runner.sh @@ -4,16 +4,12 @@ set -e set -o pipefail _here=`dirname $(realpath $0)` -. ${_here}/helpers/apt-download - -[ -z "${LOADED_APT_DOWNLOAD}" ] && (echo "failed to load apt-download"; exit 1) +apt_sync="${_here}/apt-sync.py" BASE_PATH="${TUNASYNC_WORKING_DIR}" +UPSTREAM=${TUNASYNC_UPSTREAM_URL:-"https://packages.gitlab.com/runner/gitlab-ci-multi-runner"} YUM_PATH="${BASE_PATH}/yum" - -UBUNTU_VERSIONS=("trusty" "xenial" "bionic") -DEBIAN_VERSIONS=("wheezy" "jessie" "stretch" "buster") UBUNTU_PATH="${BASE_PATH}/ubuntu/" DEBIAN_PATH="${BASE_PATH}/debian/" @@ -53,22 +49,10 @@ if [[ -z ${DRY_RUN:-} ]]; then fi rm $cfg -if [[ ! -z ${DRY_RUN:-} ]]; then - export APT_DRY_RUN=1 -fi -base_url="https://packages.gitlab.com/runner/gitlab-ci-multi-runner/ubuntu" -for version in ${UBUNTU_VERSIONS[@]}; do - apt-download-binary ${base_url} "$version" "main" "amd64" "${UBUNTU_PATH}" || true - apt-download-binary ${base_url} "$version" "main" "i386" "${UBUNTU_PATH}" || true -done +"$apt_sync" "${UPSTREAM}/ubuntu" @ubuntu-lts main amd64,i386 "$UBUNTU_PATH" echo "Ubuntu finished" - -base_url="https://packages.gitlab.com/runner/gitlab-ci-multi-runner/debian" -for version in ${DEBIAN_VERSIONS[@]}; do - apt-download-binary ${base_url} "$version" "main" "amd64" "${DEBIAN_PATH}" || true - apt-download-binary ${base_url} "$version" "main" "i386" "${DEBIAN_PATH}" || true -done +"$apt_sync" "${UPSTREAM}/debian" @debian-current main amd64,i386 "$DEBIAN_PATH" echo "Debian finished" diff --git a/gitlab-runner.sh b/gitlab-runner.sh index 5ea41c9..b00e441 100755 --- a/gitlab-runner.sh +++ b/gitlab-runner.sh @@ -4,16 +4,12 @@ set -e set -o pipefail _here=`dirname $(realpath $0)` -. ${_here}/helpers/apt-download - -[ -z "${LOADED_APT_DOWNLOAD}" ] && (echo "failed to load apt-download"; exit 1) +apt_sync="${_here}/apt-sync.py" BASE_PATH="${TUNASYNC_WORKING_DIR}" +UPSTREAM=${TUNASYNC_UPSTREAM_URL:-"https://packages.gitlab.com/runner/gitlab-runner"} YUM_PATH="${BASE_PATH}/yum" - -UBUNTU_VERSIONS=("trusty" "xenial" "bionic") -DEBIAN_VERSIONS=("wheezy" "jessie" "stretch" "buster") UBUNTU_PATH="${BASE_PATH}/ubuntu/" DEBIAN_PATH="${BASE_PATH}/debian/" @@ -64,23 +60,9 @@ if [[ -z ${DRY_RUN:-} ]]; then fi rm $cfg -if [[ ! -z ${DRY_RUN:-} ]]; then - export APT_DRY_RUN=1 -fi - -base_url="https://packages.gitlab.com/runner/gitlab-runner/ubuntu" -for version in ${UBUNTU_VERSIONS[@]}; do - apt-download-binary ${base_url} "$version" "main" "amd64" "${UBUNTU_PATH}" || true - apt-download-binary ${base_url} "$version" "main" "i386" "${UBUNTU_PATH}" || true -done +"$apt_sync" "${UPSTREAM}/ubuntu" @ubuntu-lts main amd64,i386 "$UBUNTU_PATH" echo "Ubuntu finished" - -base_url="https://packages.gitlab.com/runner/gitlab-runner/debian" -for version in ${DEBIAN_VERSIONS[@]}; do - apt-download-binary ${base_url} "$version" "main" "amd64" "${DEBIAN_PATH}" || true - apt-download-binary ${base_url} "$version" "main" "i386" "${DEBIAN_PATH}" || true -done +"$apt_sync" "${UPSTREAM}/debian" @debian-current main amd64,i386 "$DEBIAN_PATH" echo "Debian finished" - # vim: ts=4 sts=4 sw=4 diff --git a/influxdata.sh b/influxdata.sh index 156729a..3c2490e 100755 --- a/influxdata.sh +++ b/influxdata.sh @@ -4,9 +4,7 @@ set -e set -o pipefail _here=`dirname $(realpath $0)` -. ${_here}/helpers/apt-download - -[ -z "${LOADED_APT_DOWNLOAD}" ] && (echo "failed to load apt-download"; exit 1) +apt_sync="${_here}/apt-sync.py" BASE_PATH="${TUNASYNC_WORKING_DIR}" BASE_URL=${TUNASYNC_UPSTREAM_URL:-"https://repos.influxdata.com"} @@ -15,8 +13,6 @@ YUM_PATH="${BASE_PATH}/yum" UBUNTU_PATH="${BASE_PATH}/ubuntu" DEBIAN_PATH="${BASE_PATH}/debian" -UBUNTU_VERSIONS=("trusty" "xenial" "bionic") -DEBIAN_VERSIONS=("wheezy" "jessie" "stretch" "buster") EL_VERSIONS=("6" "7" "8") mkdir -p ${YUM_PATH} ${UBUNTU_PATH} ${DEBIAN_PATH} @@ -24,23 +20,10 @@ mkdir -p ${YUM_PATH} ${UBUNTU_PATH} ${DEBIAN_PATH} wget -O ${BASE_PATH}/influxdb.key ${BASE_URL}/influxdb.key # =================== APT repos =============================== -if [[ ! -z ${DRY_RUN:-} ]]; then - export APT_DRY_RUN=1 -fi -base_url="${BASE_URL}/ubuntu" -for version in ${UBUNTU_VERSIONS[@]}; do - for arch in "amd64" "i386" "armhf" "arm64"; do - apt-download-binary ${base_url} "$version" "stable" "$arch" "${UBUNTU_PATH}" || true - done -done -echo "Ubuntu finished" -base_url="${BASE_URL}/debian" -for version in ${DEBIAN_VERSIONS[@]}; do - for arch in "amd64" "i386" "armhf" "arm64"; do - apt-download-binary ${base_url} "$version" "stable" "$arch" "${DEBIAN_PATH}" || true - done -done +"$apt_sync" "${BASE_URL}/ubuntu" @ubuntu-lts stable amd64,i386,armhf,arm64 "$UBUNTU_PATH" +echo "Ubuntu finished" +"$apt_sync" "${BASE_URL}/debian" @debian-current stable amd64,i386,armhf,arm64 "$DEBIAN_PATH" echo "Debian finished" diff --git a/termux.sh b/termux.sh index 5df2ea9..83bc4fa 100755 --- a/termux.sh +++ b/termux.sh @@ -2,35 +2,17 @@ set -e _here=`dirname $(realpath $0)` -. ${_here}/helpers/apt-download -[ -z "${LOADED_APT_DOWNLOAD}" ] && (echo "failed to load apt-download"; exit 1) +apt_sync="${_here}/apt-sync.py" WORKING_DIR="${TUNASYNC_WORKING_DIR}" -ARCHES=("aarch64" "all" "arm" "i686" "x86_64") +ARCH_LIST="aarch64,all,arm,i686,x86_64" -function sync_one_repo() { - base_url="$1" - BASE_PATH="$2" - suite="$3" - component="$4" - [[ ! -d "$BASE_PATH" ]] && mkdir -p "$BASE_PATH" - remote_filelist="${BASE_PATH}/filelist" - [[ -f $remote_filelist ]] && rm $remote_filelist - - for arch in ${ARCHES[@]}; do - echo "start syncing: $base_url ${arch}" - apt-download-binary "${base_url}" "$suite" "$component" "${arch}" "${BASE_PATH}" ${remote_filelist} || true - done - - apt-delete-old-debs ${BASE_PATH} $remote_filelist -} - -sync_one_repo "https://dl.bintray.com/termux/termux-packages-24" "${WORKING_DIR}/termux-packages-24" stable main -sync_one_repo "https://dl.bintray.com/xeffyr/unstable-packages" "${WORKING_DIR}/unstable-packages" unstable main -sync_one_repo "https://dl.bintray.com/xeffyr/x11-packages" "${WORKING_DIR}/x11-packages" x11 main -sync_one_repo "https://dl.bintray.com/grimler/science-packages-24" "${WORKING_DIR}/science-packages-24" science stable -sync_one_repo "https://dl.bintray.com/grimler/game-packages-24" "${WORKING_DIR}/game-packages-24" games stable -sync_one_repo "https://dl.bintray.com/grimler/termux-root-packages-24" "${WORKING_DIR}/termux-root-packages-24" root stable +"$apt_sync" --delete "https://dl.bintray.com/termux/termux-packages-24" stable main $ARCH_LIST "${WORKING_DIR}/termux-packages-24" +"$apt_sync" --delete "https://dl.bintray.com/xeffyr/unstable-packages" unstable main $ARCH_LIST "${WORKING_DIR}/unstable-packages" +"$apt_sync" --delete "https://dl.bintray.com/xeffyr/x11-packages" x11 main $ARCH_LIST "${WORKING_DIR}/x11-packages" +"$apt_sync" --delete "https://dl.bintray.com/grimler/science-packages-24" science stable $ARCH_LIST "${WORKING_DIR}/science-packages-24" +"$apt_sync" --delete "https://dl.bintray.com/grimler/game-packages-24" games stable $ARCH_LIST "${WORKING_DIR}/game-packages-24" +"$apt_sync" --delete "https://dl.bintray.com/grimler/termux-root-packages-24" root stable $ARCH_LIST "${WORKING_DIR}/termux-root-packages-24" echo "finished"