Skip to content

Instantly share code, notes, and snippets.

@BangL
Last active November 10, 2020 03:58
Show Gist options
  • Save BangL/86c2700e169994bc147ebf076fcb1888 to your computer and use it in GitHub Desktop.
Save BangL/86c2700e169994bc147ebf076fcb1888 to your computer and use it in GitHub Desktop.
chaotic-aur mirroring script
#!/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}"
@PedroHLC
Copy link

PedroHLC commented Jul 9, 2020

Line 8, needs to be changed to:

source_url='rsync://lonewolf-builder.duckdns.org/chaotic-aur/'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment