diff --git a/pypi.sh b/pypi.sh index 5882e61..92c32b5 100755 --- a/pypi.sh +++ b/pypi.sh @@ -1,9 +1,37 @@ #!/bin/bash +BANDERSNATCH=${BANDERSNATCH:-"/usr/local/bin/bandersnatch"} +CONF="/tmp/bandersnatch.conf" +INIT=${INIT:-"0"} + if [ ! -d "$TUNASYNC_WORKING_DIR" ]; then - echo "Directory not exists, fail" - exit 1 + mkdir -p $TUNASYNC_WORKING_DIR + INIT="1" fi echo "Syncing to $TUNASYNC_WORKING_DIR" -/usr/bin/timeout -s INT 3600 /home/tuna/.virtualenvs/bandersnatch/bin/bandersnatch -c /etc/bandersnatch.conf mirror || exit 1 +if [[ $INIT == "0" ]]; then + cat > $CONF << EOF +[mirror] +directory = ${TUNASYNC_WORKING_DIR} +master = https://pypi.python.org +timeout = 15 +workers = 10 +stop-on-error = true +delete-packages = true +EOF + /usr/bin/timeout -s INT 7200 $BANDERSNATCH -c $CONF mirror || exit 1 + +else + cat > $CONF << EOF +[mirror] +directory = ${TUNASYNC_WORKING_DIR} +master = https://pypi.python.org +timeout = 15 +workers = 10 +stop-on-error = false +delete-packages = false +EOF + + $BANDERSNATCH -c $CONF mirror || exit 1 +fi diff --git a/termux.sh b/termux.sh index 9dd1002..a5f6486 100755 --- a/termux.sh +++ b/termux.sh @@ -7,10 +7,13 @@ _here=`dirname $(realpath $0)` BASE_PATH="${TUNASYNC_WORKING_DIR}" -base_url="http://apt.termux.com" +base_url=${TUNASYNC_UPSTREAM_URL:-"http://termux.net"} + ARCHES=("aarch64" "all" "arm" "i686") + for arch in ${ARCHES[@]}; do echo "start syncing: ${arch}" apt-download-binary "${base_url}" "stable" "main" "${arch}" "${BASE_PATH}" || true done + echo "finished"