Last active
November 10, 2020 03:58
-
-
Save BangL/86c2700e169994bc147ebf076fcb1888 to your computer and use it in GitHub Desktop.
chaotic-aur mirroring script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
target="/home/chaotic/http/chaotic-aur" | |
tmp="/home/chaotic/tmp" | |
lock="/home/chaotic/syncrepo.lck" | |
bwlimit=0 | |
source_url='rsync://lonewolf.pedrohlc.com/chaotic-aur/' | |
lastupdate_url='https://lonewolf.pedrohlc.com/chaotic-aur/lastupdate' | |
#### END CONFIG | |
[ ! -d "${target}" ] && mkdir -p "${target}" | |
[ ! -d "${tmp}" ] && mkdir -p "${tmp}" | |
exec 9>"${lock}" | |
flock -n 9 || exit | |
rsync_cmd() { | |
local -a cmd=(rsync -rtlH --copy-unsafe-links --delete-after ${VERBOSE} "--timeout=600" "--contimeout=60" -p \ | |
--delay-updates --no-motd "--temp-dir=${tmp}") | |
if stty &>/dev/null; then | |
cmd+=(-h -v --progress) | |
else | |
cmd+=(--quiet) | |
fi | |
if ((bwlimit>0)); then | |
cmd+=("--bwlimit=$bwlimit") | |
fi | |
"${cmd[@]}" "$@" | |
} | |
if ! tty -s && [[ -f "$target/lastupdate" ]] && diff -b <(curl -Ls "$lastupdate_url") "$target/lastupdate" >/dev/null; then | |
exit 0 | |
fi | |
# sync repo | |
rsync_cmd \ | |
--exclude='/archive' \ | |
--exclude='/lost+found' \ | |
--exclude='/makepkglogs' \ | |
--exclude='/pkgs.txt' \ | |
--exclude='/*.html' \ | |
"${source_url}" \ | |
"${target}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 8, needs to be changed to:
source_url='rsync://lonewolf-builder.duckdns.org/chaotic-aur/'