You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
965 B
38 lines
965 B
#!/bin/bash
|
|
# sync.sh - CyberOS Mirror sync script
|
|
# Recommended to run every hour.
|
|
|
|
|
|
## IMPORTANT: Make sure you change the below variables to
|
|
# point to the mirror you're syncing from.
|
|
|
|
remote_lastupdate="https://mirror.getcyberos.org/lastupdate"
|
|
rsync_mirror="rsync://server.omame.tech/cyberos"
|
|
|
|
## OPTIONAL: Add your rsync arguments here
|
|
rsync_args=(
|
|
# base rsync args, don't touch
|
|
-rtlvH --delete-after --delay-updates --safe-links
|
|
|
|
# put your rsync args here
|
|
--progress
|
|
)
|
|
|
|
## IMPORTANT: Change this path to point to your local mirror.
|
|
mirror_path="cyberos-mirror"
|
|
|
|
mkdir -p "$mirror_path"
|
|
|
|
if [ ! -f "$mirror_path"/lastupdate ] ; then
|
|
echo "0" > "$mirror_path"/lastupdate
|
|
fi
|
|
|
|
lastsync=$(cat "$mirror_path"/lastupdate)
|
|
lastupdate=$(curl "$remote_lastupdate")
|
|
|
|
if [[ $lastupdate != $lastsync ]] ; then
|
|
echo "Mirror out of date, updating..."
|
|
rsync "${rsync_args[@]}" "$rsync_mirror" "$mirror_path"
|
|
else
|
|
echo "Mirror up to date."
|
|
fi
|
|
|