Skip to content

Instantly share code, notes, and snippets.

@BangL

BangL/syncrepo.sh

Last active Jul 22, 2020
Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@PedroHLC 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
You can’t perform that action at this time.