forked from CyberOS/cyberos-mirrorlist
Add sync.sh
parent
b418824570
commit
f461087db7
|
@ -1,4 +1,4 @@
|
|||
|
||||
cyberos-mirror/
|
||||
pkg/
|
||||
src/
|
||||
*.pkg.*
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#!/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
|
Loading…
Reference in New Issue