20 lines
556 B
Bash
Executable File

#!/bin/sh
. /etc/os-release
REPO_LOCAL="file://${1:-/srv/${ID}}/"
REPO_URL="rsync://rsync.${HOME_URL#*//}"
case "${VERSION_ID}" in
(snapshot) REPO_DIR="downloads/snapshots" ;;
(*) REPO_DIR="downloads/releases/${VERSION_ID}" ;;
esac
REPO_CORE="${REPO_DIR}/targets/${OPENWRT_BOARD}"
REPO_PKGS="${REPO_DIR}/packages/${OPENWRT_ARCH}"
for REPO_DIR in "${REPO_CORE}" "${REPO_PKGS}"; do
mkdir -p "${REPO_LOCAL#*//}${REPO_DIR#*/}"
rsync --bwlimit="8M" --del -r -t -v \
"${REPO_URL}${REPO_DIR}/" \
"${REPO_LOCAL#*//}${REPO_DIR#*/}/"
done