updated nodesource

This commit is contained in:
bigeagle 2016-12-11 15:14:30 +08:00
parent f2c13e808e
commit d14fbb732b
No known key found for this signature in database
GPG Key ID: 9171A4571C27920A

View File

@ -3,18 +3,25 @@
function sync_nodesource() {
repo_url="$1"
repo_dir="$2"
lftp_opts="$3"
[ ! -d "$repo_dir" ] && mkdir -p "$repo_dir"
[[ ! -d "$repo_dir" ]] && mkdir -p "$repo_dir"
cd $repo_dir
lftp "${repo_url}/" -e "mirror --verbose -P 5 --delete --only-newer; bye"
lftp "${repo_url}/" -e "mirror --verbose $lftp_opts -P 5 --delete --only-newer; bye"
}
sync_nodesource "https://deb.nodesource.com/node" "${TUNASYNC_WORKING_DIR}/deb"
sync_nodesource "https://deb.nodesource.com/node_0.12" "${TUNASYNC_WORKING_DIR}/deb_0.12"
sync_nodesource "https://deb.nodesource.com/node_4.x" "${TUNASYNC_WORKING_DIR}/deb_4.x"
sync_nodesource "https://deb.nodesource.com/node_6.x" "${TUNASYNC_WORKING_DIR}/deb_6.x"
DEB_BASE_URL="https://deb.nodesource.com"
RPM_BASE_URL="https://rpm.nodesource.com"
sync_nodesource "https://rpm.nodesource.com/pub" "${TUNASYNC_WORKING_DIR}/rpm"
sync_nodesource "https://rpm.nodesource.com/pub_0.12" "${TUNASYNC_WORKING_DIR}/rpm_0.12"
sync_nodesource "https://rpm.nodesource.com/pub_4.x" "${TUNASYNC_WORKING_DIR}/rpm_4.x"
sync_nodesource "https://rpm.nodesource.com/pub_6.x" "${TUNASYNC_WORKING_DIR}/rpm_6.x"
node_versions=("0.10" "0.12" "4.x" "6.x")
declare success=true
for ver in ${node_versions[@]}; do
sync_nodesource "${DEB_BASE_URL}/node_${ver}" "${TUNASYNC_WORKING_DIR}/deb_${ver}" "--exclude db/ --exclude conf/" || success=false
done
for ver in ${node_versions[@]}; do
sync_nodesource "${RPM_BASE_URL}/pub_${ver}" "${TUNASYNC_WORKING_DIR}/rpm_${ver}" || success=false
done
[[ $success == true ]] && exit 0 || exit 1